Changeset 3fbd8b8


Ignore:
Timestamp:
Feb 19, 2012 7:52:16 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
13731e7
Parents:
3876f74f
Message:
  • Fix custom tracker list
  • Add tracker config form
  • Remove custom tracker from create form
  • More icons in buttons
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java

    r3876f74f r3fbd8b8  
    99import java.io.OutputStream;
    1010import java.util.ArrayList;
     11import java.util.Collections;
     12import java.util.Comparator;
    1113import java.util.HashMap;
    1214import java.util.HashSet;
     
    3638 */
    3739public class SnarkManager implements Snark.CompleteListener {
    38     private static SnarkManager _instance = new SnarkManager();
    39     public static SnarkManager instance() { return _instance; }
    4040   
    4141    /**
     
    5858    private Thread _monitor;
    5959    private volatile boolean _running;
     60    private final Map<String, String> _trackerMap;
    6061   
    6162    public static final String PROP_I2CP_HOST = "i2psnark.i2cpHost";
     
    9091    public static final int DEFAULT_REFRESH_DELAY_SECS = 60;
    9192
     93    /**
     94     *  "name", "announceURL=websiteURL" pairs
     95     *  '=' in announceURL must be escaped as &#44;
     96     */
     97    private static final String DEFAULT_TRACKERS[] = {
     98//       "Postman", "http://YRgrgTLGnbTq2aZOZDJQ~o6Uk5k6TK-OZtx0St9pb0G-5EGYURZioxqYG8AQt~LgyyI~NCj6aYWpPO-150RcEvsfgXLR~CxkkZcVpgt6pns8SRc3Bi-QSAkXpJtloapRGcQfzTtwllokbdC-aMGpeDOjYLd8b5V9Im8wdCHYy7LRFxhEtGb~RL55DA8aYOgEXcTpr6RPPywbV~Qf3q5UK55el6Kex-6VCxreUnPEe4hmTAbqZNR7Fm0hpCiHKGoToRcygafpFqDw5frLXToYiqs9d4liyVB-BcOb0ihORbo0nS3CLmAwZGvdAP8BZ7cIYE3Z9IU9D1G8JCMxWarfKX1pix~6pIA-sp1gKlL1HhYhPMxwyxvuSqx34o3BqU7vdTYwWiLpGM~zU1~j9rHL7x60pVuYaXcFQDR4-QVy26b6Pt6BlAZoFmHhPcAuWfu-SFhjyZYsqzmEmHeYdAwa~HojSbofg0TMUgESRXMw6YThK1KXWeeJVeztGTz25sL8AAAA.i2p/announce.php=http://tracker.postman.i2p/"
     99//       , "eBook", "http://E71FRom6PZNEqTN2Lr8P-sr23b7HJVC32KoGnVQjaX6zJiXwhJy2HsXob36Qmj81TYFZdewFZa9mSJ533UZgGyQkXo2ahctg82JKYZfDe5uDxAn1E9YPjxZCWJaFJh0S~UwSs~9AZ7UcauSJIoNtpxrtbmRNVFLqnkEDdLZi26TeucfOmiFmIWnVblLniWv3tG1boE9Abd-6j3FmYVrRucYuepAILYt6katmVNOk6sXmno1Eynrp~~MBuFq0Ko6~jsc2E2CRVYXDhGHEMdt-j6JUz5D7S2RIVzDRqQyAZLKJ7OdQDmI31przzmne1vOqqqLC~1xUumZVIvF~yOeJUGNjJ1Vx0J8i2BQIusn1pQJ6UCB~ZtZZLQtEb8EPVCfpeRi2ri1M5CyOuxN0V5ekmPHrYIBNevuTCRC26NP7ZS5VDgx1~NaC3A-CzJAE6f1QXi0wMI9aywNG5KGzOPifcsih8eyGyytvgLtrZtV7ykzYpPCS-rDfITncpn5hliPUAAAA.i2p/pub/bt/announce.php=http://de-ebook-archiv.i2p/pub/bt/"
     100//       , "Gaytorrents", "http://uxPWHbK1OIj9HxquaXuhMiIvi21iK0~ZiG9d8G0840ZXIg0r6CbiV71xlsqmdnU6wm0T2LySriM0doW2gUigo-5BNkUquHwOjLROiETnB3ZR0Ml4IGa6QBPn1aAq2d9~g1r1nVjLE~pcFnXB~cNNS7kIhX1d6nLgYVZf0C2cZopEow2iWVUggGGnAA9mHjE86zLEnTvAyhbAMTqDQJhEuLa0ZYSORqzJDMkQt90MV4YMjX1ICY6RfUSFmxEqu0yWTrkHsTtRw48l~dz9wpIgc0a0T9C~eeWvmBFTqlJPtQZwntpNeH~jF7nlYzB58olgV2HHFYpVYD87DYNzTnmNWxCJ5AfDorm6AIUCV2qaE7tZtI1h6fbmGpGlPyW~Kw5GXrRfJwNvr6ajwAVi~bPVnrBwDZezHkfW4slOO8FACPR28EQvaTu9nwhAbqESxV2hCTq6vQSGjuxHeOuzBOEvRWkLKOHWTC09t2DbJ94FSqETmZopTB1ukEmaxRWbKSIaAAAA.i2p/announce.php=http://gaytorrents.i2p/"
     101//       , "NickyB", "http://9On6d3cZ27JjwYCtyJJbowe054d5tFnfMjv4PHsYs-EQn4Y4mk2zRixatvuAyXz2MmRfXG-NAUfhKr0KCxRNZbvHmlckYfT-WBzwwpiMAl0wDFY~Pl8cqXuhfikSG5WrqdPfDNNIBuuznS0dqaczf~OyVaoEOpvuP3qV6wKqbSSLpjOwwAaQPHjlRtNIW8-EtUZp-I0LT45HSoowp~6b7zYmpIyoATvIP~sT0g0MTrczWhbVTUZnEkZeLhOR0Duw1-IRXI2KHPbA24wLO9LdpKKUXed05RTz0QklW5ROgR6TYv7aXFufX8kC0-DaKvQ5JKG~h8lcoHvm1RCzNqVE-2aiZnO2xH08H-iCWoLNJE-Td2kT-Tsc~3QdQcnEUcL5BF-VT~QYRld2--9r0gfGl-yDrJZrlrihHGr5J7ImahelNn9PpkVp6eIyABRmJHf2iicrk3CtjeG1j9OgTSwaNmEpUpn4aN7Kx0zNLdH7z6uTgCGD9Kmh1MFYrsoNlTp4AAAA.i2p/bittorrent/announce.php=http://nickyb.i2p/bittorrent/"
     102//       , "Orion", "http://gKik1lMlRmuroXVGTZ~7v4Vez3L3ZSpddrGZBrxVriosCQf7iHu6CIk8t15BKsj~P0JJpxrofeuxtm7SCUAJEr0AIYSYw8XOmp35UfcRPQWyb1LsxUkMT4WqxAT3s1ClIICWlBu5An~q-Mm0VFlrYLIPBWlUFnfPR7jZ9uP5ZMSzTKSMYUWao3ejiykr~mtEmyls6g-ZbgKZawa9II4zjOy-hdxHgP-eXMDseFsrym4Gpxvy~3Fv9TuiSqhpgm~UeTo5YBfxn6~TahKtE~~sdCiSydqmKBhxAQ7uT9lda7xt96SS09OYMsIWxLeQUWhns-C~FjJPp1D~IuTrUpAFcVEGVL-BRMmdWbfOJEcWPZ~CBCQSO~VkuN1ebvIOr9JBerFMZSxZtFl8JwcrjCIBxeKPBmfh~xYh16BJm1BBBmN1fp2DKmZ2jBNkAmnUbjQOqWvUcehrykWk5lZbE7bjJMDFH48v3SXwRuDBiHZmSbsTY6zhGY~GkMQHNGxPMMSIAAAA.i2p/bt/announce.php=http://orion.i2p/bt/"
     103//       , "anonymity", "http://8EoJZIKrWgGuDrxA3nRJs1jsPfiGwmFWL91hBrf0HA7oKhEvAna4Ocx47VLUR9retVEYBAyWFK-eZTPcvhnz9XffBEiJQQ~kFSCqb1fV6IfPiV3HySqi9U5Caf6~hC46fRd~vYnxmaBLICT3N160cxBETqH3v2rdxdJpvYt8q4nMk9LUeVXq7zqCTFLLG5ig1uKgNzBGe58iNcsvTEYlnbYcE930ABmrzj8G1qQSgSwJ6wx3tUQNl1z~4wSOUMan~raZQD60lRK70GISjoX0-D0Po9WmPveN3ES3g72TIET3zc3WPdK2~lgmKGIs8GgNLES1cXTolvbPhdZK1gxddRMbJl6Y6IPFyQ9o4-6Rt3Lp-RMRWZ2TG7j2OMcNSiOmATUhKEFBDfv-~SODDyopGBmfeLw16F4NnYednvn4qP10dyMHcUASU6Zag4mfc2-WivrOqeWhD16fVAh8MoDpIIT~0r9XmwdaVFyLcjbXObabJczxCAW3fodQUnvuSkwzAAAA.i2p/anonymityTracker/announce.php=http://anonymityweb.i2p/anonymityTracker/"
     104//       , "The freak's tracker", "http://mHKva9x24E5Ygfey2llR1KyQHv5f8hhMpDMwJDg1U-hABpJ2NrQJd6azirdfaR0OKt4jDlmP2o4Qx0H598~AteyD~RJU~xcWYdcOE0dmJ2e9Y8-HY51ie0B1yD9FtIV72ZI-V3TzFDcs6nkdX9b81DwrAwwFzx0EfNvK1GLVWl59Ow85muoRTBA1q8SsZImxdyZ-TApTVlMYIQbdI4iQRwU9OmmtefrCe~ZOf4UBS9-KvNIqUL0XeBSqm0OU1jq-D10Ykg6KfqvuPnBYT1BYHFDQJXW5DdPKwcaQE4MtAdSGmj1epDoaEBUa9btQlFsM2l9Cyn1hzxqNWXELmx8dRlomQLlV4b586dRzW~fLlOPIGC13ntPXogvYvHVyEyptXkv890jC7DZNHyxZd5cyrKC36r9huKvhQAmNABT2Y~pOGwVrb~RpPwT0tBuPZ3lHYhBFYmD8y~AOhhNHKMLzea1rfwTvovBMByDdFps54gMN1mX4MbCGT4w70vIopS9yAAAA.i2p/bytemonsoon/announce.php"
     105//       , "mastertracker", "http://VzXD~stRKbL3MOmeTn1iaCQ0CFyTmuFHiKYyo0Rd~dFPZFCYH-22rT8JD7i-C2xzYFa4jT5U2aqHzHI-Jre4HL3Ri5hFtZrLk2ax3ji7Qfb6qPnuYkuiF2E2UDmKUOppI8d9Ye7tjdhQVCy0izn55tBaB-U7UWdcvSK2i85sauyw3G0Gfads1Rvy5-CAe2paqyYATcDmGjpUNLoxbfv9KH1KmwRTNH6k1v4PyWYYnhbT39WfKMbBjSxVQRdi19cyJrULSWhjxaQfJHeWx5Z8Ev4bSPByBeQBFl2~4vqy0S5RypINsRSa3MZdbiAAyn5tr5slWR6QdoqY3qBQgBJFZppy-3iWkFqqKgSxCPundF8gdDLC5ddizl~KYcYKl42y9SGFHIukH-TZs8~em0~iahzsqWVRks3zRG~tlBcX2U3M2~OJs~C33-NKhyfZT7-XFBREvb8Szmd~p66jDxrwOnKaku-G6DyoQipJqIz4VHmY9-y5T8RrUcJcM-5lVoMpAAAA.i2p/announce.php=http://tracker.mastertracker.i2p/"
     106//       , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/"
     107       "Postman", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
     108       ,"Welterde", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
     109       ,"Diftracker", "http://n--XWjHjUPjnMNrSwXA2OYXpMIUL~u4FNXnrt2HtjK3y6j~4SOClyyeKzd0zRPlixxkCe2wfBIYye3bZsaqAD8bd0QMmowxbq91WpjsPfKMiphJbePKXtYAVARiy0cqyvh1d2LyDE-6wkvgaw45hknmS0U-Dg3YTJZbAQRU2SKXgIlAbWCv4R0kDFBLEVpReDiJef3rzAWHiW8yjmJuJilkYjMwlfRjw8xx1nl2s~yhlljk1pl13jGYb0nfawQnuOWeP-ASQWvAAyVgKvZRJE2O43S7iveu9piuv7plXWbt36ef7ndu2GNoNyPOBdpo9KUZ-NOXm4Kgh659YtEibL15dEPAOdxprY0sYUurVw8OIWqrpX7yn08nbi6qHVGqQwTpxH35vkL8qrCbm-ym7oQJQnNmSDrNTyWYRFSq5s5~7DAdFDzqRPW-pX~g0zEivWj5tzkhvG9rVFgFo0bpQX3X0PUAV9Xbyf8u~v8Zbr9K1pCPqBq9XEr4TqaLHw~bfAAAA.i2p/announce.php=http://diftracker.i2p/"
     110//       , "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
     111//       ,"Exotrack", "http://blbgywsjubw3d2zih2giokakhe3o2cko7jtte4risb3hohbcoyva.b32.i2p/announce.php=http://exotrack.i2p/"
     112    };
     113   
     114    /** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */
     115    public static final String PROP_TRACKERS = "i2psnark.trackers";
     116
     117    private static final SnarkManager _instance = new SnarkManager();
     118
     119    public static SnarkManager instance() { return _instance; }
     120
    92121    private SnarkManager() {
    93122        _snarks = new ConcurrentHashMap();
     
    101130        if (!_configFile.isAbsolute())
    102131            _configFile = new File(_context.getConfigDir(), CONFIG_FILE);
     132        _trackerMap = Collections.synchronizedMap(new TreeMap(new IgnoreCaseComparator()));
    103133        loadConfig(null);
    104134    }
     
    313343        _util.setUseOpenTrackers(bOT);
    314344        getDataDir().mkdirs();
     345        initTrackerMap();
    315346    }
    316347   
     
    13591390
    13601391    /**
    1361      *  "name", "announceURL=websiteURL" pairs
    1362      */
    1363     private static final String DEFAULT_TRACKERS[] = {
    1364 //       "Postman", "http://YRgrgTLGnbTq2aZOZDJQ~o6Uk5k6TK-OZtx0St9pb0G-5EGYURZioxqYG8AQt~LgyyI~NCj6aYWpPO-150RcEvsfgXLR~CxkkZcVpgt6pns8SRc3Bi-QSAkXpJtloapRGcQfzTtwllokbdC-aMGpeDOjYLd8b5V9Im8wdCHYy7LRFxhEtGb~RL55DA8aYOgEXcTpr6RPPywbV~Qf3q5UK55el6Kex-6VCxreUnPEe4hmTAbqZNR7Fm0hpCiHKGoToRcygafpFqDw5frLXToYiqs9d4liyVB-BcOb0ihORbo0nS3CLmAwZGvdAP8BZ7cIYE3Z9IU9D1G8JCMxWarfKX1pix~6pIA-sp1gKlL1HhYhPMxwyxvuSqx34o3BqU7vdTYwWiLpGM~zU1~j9rHL7x60pVuYaXcFQDR4-QVy26b6Pt6BlAZoFmHhPcAuWfu-SFhjyZYsqzmEmHeYdAwa~HojSbofg0TMUgESRXMw6YThK1KXWeeJVeztGTz25sL8AAAA.i2p/announce.php=http://tracker.postman.i2p/"
    1365 //       , "eBook", "http://E71FRom6PZNEqTN2Lr8P-sr23b7HJVC32KoGnVQjaX6zJiXwhJy2HsXob36Qmj81TYFZdewFZa9mSJ533UZgGyQkXo2ahctg82JKYZfDe5uDxAn1E9YPjxZCWJaFJh0S~UwSs~9AZ7UcauSJIoNtpxrtbmRNVFLqnkEDdLZi26TeucfOmiFmIWnVblLniWv3tG1boE9Abd-6j3FmYVrRucYuepAILYt6katmVNOk6sXmno1Eynrp~~MBuFq0Ko6~jsc2E2CRVYXDhGHEMdt-j6JUz5D7S2RIVzDRqQyAZLKJ7OdQDmI31przzmne1vOqqqLC~1xUumZVIvF~yOeJUGNjJ1Vx0J8i2BQIusn1pQJ6UCB~ZtZZLQtEb8EPVCfpeRi2ri1M5CyOuxN0V5ekmPHrYIBNevuTCRC26NP7ZS5VDgx1~NaC3A-CzJAE6f1QXi0wMI9aywNG5KGzOPifcsih8eyGyytvgLtrZtV7ykzYpPCS-rDfITncpn5hliPUAAAA.i2p/pub/bt/announce.php=http://de-ebook-archiv.i2p/pub/bt/"
    1366 //       , "Gaytorrents", "http://uxPWHbK1OIj9HxquaXuhMiIvi21iK0~ZiG9d8G0840ZXIg0r6CbiV71xlsqmdnU6wm0T2LySriM0doW2gUigo-5BNkUquHwOjLROiETnB3ZR0Ml4IGa6QBPn1aAq2d9~g1r1nVjLE~pcFnXB~cNNS7kIhX1d6nLgYVZf0C2cZopEow2iWVUggGGnAA9mHjE86zLEnTvAyhbAMTqDQJhEuLa0ZYSORqzJDMkQt90MV4YMjX1ICY6RfUSFmxEqu0yWTrkHsTtRw48l~dz9wpIgc0a0T9C~eeWvmBFTqlJPtQZwntpNeH~jF7nlYzB58olgV2HHFYpVYD87DYNzTnmNWxCJ5AfDorm6AIUCV2qaE7tZtI1h6fbmGpGlPyW~Kw5GXrRfJwNvr6ajwAVi~bPVnrBwDZezHkfW4slOO8FACPR28EQvaTu9nwhAbqESxV2hCTq6vQSGjuxHeOuzBOEvRWkLKOHWTC09t2DbJ94FSqETmZopTB1ukEmaxRWbKSIaAAAA.i2p/announce.php=http://gaytorrents.i2p/"
    1367 //       , "NickyB", "http://9On6d3cZ27JjwYCtyJJbowe054d5tFnfMjv4PHsYs-EQn4Y4mk2zRixatvuAyXz2MmRfXG-NAUfhKr0KCxRNZbvHmlckYfT-WBzwwpiMAl0wDFY~Pl8cqXuhfikSG5WrqdPfDNNIBuuznS0dqaczf~OyVaoEOpvuP3qV6wKqbSSLpjOwwAaQPHjlRtNIW8-EtUZp-I0LT45HSoowp~6b7zYmpIyoATvIP~sT0g0MTrczWhbVTUZnEkZeLhOR0Duw1-IRXI2KHPbA24wLO9LdpKKUXed05RTz0QklW5ROgR6TYv7aXFufX8kC0-DaKvQ5JKG~h8lcoHvm1RCzNqVE-2aiZnO2xH08H-iCWoLNJE-Td2kT-Tsc~3QdQcnEUcL5BF-VT~QYRld2--9r0gfGl-yDrJZrlrihHGr5J7ImahelNn9PpkVp6eIyABRmJHf2iicrk3CtjeG1j9OgTSwaNmEpUpn4aN7Kx0zNLdH7z6uTgCGD9Kmh1MFYrsoNlTp4AAAA.i2p/bittorrent/announce.php=http://nickyb.i2p/bittorrent/"
    1368 //       , "Orion", "http://gKik1lMlRmuroXVGTZ~7v4Vez3L3ZSpddrGZBrxVriosCQf7iHu6CIk8t15BKsj~P0JJpxrofeuxtm7SCUAJEr0AIYSYw8XOmp35UfcRPQWyb1LsxUkMT4WqxAT3s1ClIICWlBu5An~q-Mm0VFlrYLIPBWlUFnfPR7jZ9uP5ZMSzTKSMYUWao3ejiykr~mtEmyls6g-ZbgKZawa9II4zjOy-hdxHgP-eXMDseFsrym4Gpxvy~3Fv9TuiSqhpgm~UeTo5YBfxn6~TahKtE~~sdCiSydqmKBhxAQ7uT9lda7xt96SS09OYMsIWxLeQUWhns-C~FjJPp1D~IuTrUpAFcVEGVL-BRMmdWbfOJEcWPZ~CBCQSO~VkuN1ebvIOr9JBerFMZSxZtFl8JwcrjCIBxeKPBmfh~xYh16BJm1BBBmN1fp2DKmZ2jBNkAmnUbjQOqWvUcehrykWk5lZbE7bjJMDFH48v3SXwRuDBiHZmSbsTY6zhGY~GkMQHNGxPMMSIAAAA.i2p/bt/announce.php=http://orion.i2p/bt/"
    1369 //       , "anonymity", "http://8EoJZIKrWgGuDrxA3nRJs1jsPfiGwmFWL91hBrf0HA7oKhEvAna4Ocx47VLUR9retVEYBAyWFK-eZTPcvhnz9XffBEiJQQ~kFSCqb1fV6IfPiV3HySqi9U5Caf6~hC46fRd~vYnxmaBLICT3N160cxBETqH3v2rdxdJpvYt8q4nMk9LUeVXq7zqCTFLLG5ig1uKgNzBGe58iNcsvTEYlnbYcE930ABmrzj8G1qQSgSwJ6wx3tUQNl1z~4wSOUMan~raZQD60lRK70GISjoX0-D0Po9WmPveN3ES3g72TIET3zc3WPdK2~lgmKGIs8GgNLES1cXTolvbPhdZK1gxddRMbJl6Y6IPFyQ9o4-6Rt3Lp-RMRWZ2TG7j2OMcNSiOmATUhKEFBDfv-~SODDyopGBmfeLw16F4NnYednvn4qP10dyMHcUASU6Zag4mfc2-WivrOqeWhD16fVAh8MoDpIIT~0r9XmwdaVFyLcjbXObabJczxCAW3fodQUnvuSkwzAAAA.i2p/anonymityTracker/announce.php=http://anonymityweb.i2p/anonymityTracker/"
    1370 //       , "The freak's tracker", "http://mHKva9x24E5Ygfey2llR1KyQHv5f8hhMpDMwJDg1U-hABpJ2NrQJd6azirdfaR0OKt4jDlmP2o4Qx0H598~AteyD~RJU~xcWYdcOE0dmJ2e9Y8-HY51ie0B1yD9FtIV72ZI-V3TzFDcs6nkdX9b81DwrAwwFzx0EfNvK1GLVWl59Ow85muoRTBA1q8SsZImxdyZ-TApTVlMYIQbdI4iQRwU9OmmtefrCe~ZOf4UBS9-KvNIqUL0XeBSqm0OU1jq-D10Ykg6KfqvuPnBYT1BYHFDQJXW5DdPKwcaQE4MtAdSGmj1epDoaEBUa9btQlFsM2l9Cyn1hzxqNWXELmx8dRlomQLlV4b586dRzW~fLlOPIGC13ntPXogvYvHVyEyptXkv890jC7DZNHyxZd5cyrKC36r9huKvhQAmNABT2Y~pOGwVrb~RpPwT0tBuPZ3lHYhBFYmD8y~AOhhNHKMLzea1rfwTvovBMByDdFps54gMN1mX4MbCGT4w70vIopS9yAAAA.i2p/bytemonsoon/announce.php"
    1371 //       , "mastertracker", "http://VzXD~stRKbL3MOmeTn1iaCQ0CFyTmuFHiKYyo0Rd~dFPZFCYH-22rT8JD7i-C2xzYFa4jT5U2aqHzHI-Jre4HL3Ri5hFtZrLk2ax3ji7Qfb6qPnuYkuiF2E2UDmKUOppI8d9Ye7tjdhQVCy0izn55tBaB-U7UWdcvSK2i85sauyw3G0Gfads1Rvy5-CAe2paqyYATcDmGjpUNLoxbfv9KH1KmwRTNH6k1v4PyWYYnhbT39WfKMbBjSxVQRdi19cyJrULSWhjxaQfJHeWx5Z8Ev4bSPByBeQBFl2~4vqy0S5RypINsRSa3MZdbiAAyn5tr5slWR6QdoqY3qBQgBJFZppy-3iWkFqqKgSxCPundF8gdDLC5ddizl~KYcYKl42y9SGFHIukH-TZs8~em0~iahzsqWVRks3zRG~tlBcX2U3M2~OJs~C33-NKhyfZT7-XFBREvb8Szmd~p66jDxrwOnKaku-G6DyoQipJqIz4VHmY9-y5T8RrUcJcM-5lVoMpAAAA.i2p/announce.php=http://tracker.mastertracker.i2p/"
    1372 //       , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/"
    1373        "Postman", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
    1374        ,"Welterde", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
    1375        ,"Diftracker", "http://n--XWjHjUPjnMNrSwXA2OYXpMIUL~u4FNXnrt2HtjK3y6j~4SOClyyeKzd0zRPlixxkCe2wfBIYye3bZsaqAD8bd0QMmowxbq91WpjsPfKMiphJbePKXtYAVARiy0cqyvh1d2LyDE-6wkvgaw45hknmS0U-Dg3YTJZbAQRU2SKXgIlAbWCv4R0kDFBLEVpReDiJef3rzAWHiW8yjmJuJilkYjMwlfRjw8xx1nl2s~yhlljk1pl13jGYb0nfawQnuOWeP-ASQWvAAyVgKvZRJE2O43S7iveu9piuv7plXWbt36ef7ndu2GNoNyPOBdpo9KUZ-NOXm4Kgh659YtEibL15dEPAOdxprY0sYUurVw8OIWqrpX7yn08nbi6qHVGqQwTpxH35vkL8qrCbm-ym7oQJQnNmSDrNTyWYRFSq5s5~7DAdFDzqRPW-pX~g0zEivWj5tzkhvG9rVFgFo0bpQX3X0PUAV9Xbyf8u~v8Zbr9K1pCPqBq9XEr4TqaLHw~bfAAAA.i2p/announce.php=http://diftracker.i2p/"
    1376 //       , "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
    1377 //       ,"Exotrack", "http://blbgywsjubw3d2zih2giokakhe3o2cko7jtte4risb3hohbcoyva.b32.i2p/announce.php=http://exotrack.i2p/"
    1378     };
    1379    
    1380     /** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */
    1381     public static final String PROP_TRACKERS = "i2psnark.trackers";
    1382     private static Map<String, String> trackerMap = null;
    1383     /** sorted map of name to announceURL=baseURL */
     1392     *  Sorted map of name to announceURL=baseURL
     1393     *  Modifiable, not a copy
     1394     */
    13841395    public Map<String, String> getTrackers() {
    1385         if (trackerMap != null) // only do this once, can't be updated while running
    1386             return trackerMap;
    1387         Map<String, String> rv = new TreeMap();
     1396        return _trackerMap;
     1397    }
     1398
     1399    /** @since 0.9 */
     1400    private void initTrackerMap() {
    13881401        String trackers = _config.getProperty(PROP_TRACKERS);
    13891402        if ( (trackers == null) || (trackers.trim().length() <= 0) )
    13901403            trackers = _context.getProperty(PROP_TRACKERS);
     1404        _trackerMap.clear();
    13911405        if ( (trackers == null) || (trackers.trim().length() <= 0) ) {
    13921406            for (int i = 0; i < DEFAULT_TRACKERS.length; i += 2)
    1393                 rv.put(DEFAULT_TRACKERS[i], DEFAULT_TRACKERS[i+1]);
     1407                _trackerMap.put(DEFAULT_TRACKERS[i], DEFAULT_TRACKERS[i+1]);
    13941408        } else {
    1395             StringTokenizer tok = new StringTokenizer(trackers, ",");
    1396             while (tok.hasMoreTokens()) {
    1397                 String pair = tok.nextToken();
    1398                 int split = pair.indexOf('=');
    1399                 if (split <= 0)
    1400                     continue;
    1401                 String name = pair.substring(0, split).trim();
    1402                 String url = pair.substring(split+1).trim();
     1409            String[] toks = trackers.split(",");
     1410            for (int i = 0; i < toks.length; i += 2) {
     1411                String name = toks[i].trim().replace("&#44;", ",");
     1412                String url = toks[i+1].trim().replace("&#44;", ",");
    14031413                if ( (name.length() > 0) && (url.length() > 0) )
    1404                     rv.put(name, url);
    1405             }
    1406         }
    1407        
    1408         trackerMap = rv;
    1409         return trackerMap;
    1410     }
    1411    
     1414                    _trackerMap.put(name, url);
     1415            }
     1416        }
     1417    }
     1418
     1419    /** @since 0.9 */
     1420    public void setDefaultTrackerMap() {
     1421        _trackerMap.clear();
     1422        for (int i = 0; i < DEFAULT_TRACKERS.length; i += 2) {
     1423            _trackerMap.put(DEFAULT_TRACKERS[i], DEFAULT_TRACKERS[i+1]);
     1424        }
     1425        if (_config.remove(PROP_TRACKERS) != null) {
     1426            saveConfig();
     1427        }
     1428    }
     1429
     1430    /** @since 0.9 */
     1431    public void saveTrackerMap() {
     1432        StringBuilder buf = new StringBuilder(2048);
     1433        boolean comma = false;
     1434        for (Map.Entry<String, String> e : _trackerMap.entrySet()) {
     1435            if (comma)
     1436                buf.append(',');
     1437            else
     1438                comma = true;
     1439            buf.append(e.getKey().replace(",", "&#44;")).append(',').append(e.getValue().replace(",", "&#44;"));
     1440        }
     1441        _config.setProperty(PROP_TRACKERS, buf.toString());
     1442        saveConfig();
     1443    }
     1444
    14121445    private static class TorrentFilenameFilter implements FilenameFilter {
    14131446        private static final TorrentFilenameFilter _filter = new TorrentFilenameFilter();
     
    14291462        }
    14301463    }
     1464
     1465    /**
     1466     *  ignore case, current locale
     1467     *  @since 0.9
     1468     */
     1469    private static class IgnoreCaseComparator implements Comparator<String> {
     1470        public int compare(String l, String r) {
     1471            return l.toLowerCase().compareTo(r.toLowerCase());
     1472        }
     1473    }
    14311474}
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r3876f74f r3fbd8b8  
    261261            out.write("<div class=\"logshim\"></div></div>\n");
    262262            writeConfigForm(out, req);
     263            writeTrackerForm(out, req);
    263264        } else {
    264265            writeTorrents(out, req);
     
    651652                                  seedPct, eepHost, eepPort, i2cpHost, i2cpPort, i2cpOpts,
    652653                                  upLimit, upBW, useOpenTrackers, openTrackers, theme);
     654        } else if ("Save2".equals(action)) {
     655            String taction = req.getParameter("taction");
     656            if (taction != null)
     657                processTrackerForm(taction, req);
    653658        } else if ("Create".equals(action)) {
    654659            String baseData = req.getParameter("baseFile");
     
    656661                File baseFile = new File(_manager.getDataDir(), baseData);
    657662                String announceURL = req.getParameter("announceURL");
    658                 String announceURLOther = req.getParameter("announceURLOther");
    659                 if ( (announceURLOther != null) && (announceURLOther.trim().length() > "http://.i2p/announce".length()) )
    660                     announceURL = announceURLOther;
     663                // make the user add a tracker on the config form now
     664                //String announceURLOther = req.getParameter("announceURLOther");
     665                //if ( (announceURLOther != null) && (announceURLOther.trim().length() > "http://.i2p/announce".length()) )
     666                //    announceURL = announceURLOther;
    661667
    662668                if (announceURL == null || announceURL.length() <= 0)
     
    710716                    snark.startTorrent();
    711717            }
     718        } else {
     719            _manager.addMessage("Unknown POST action: \"" + action + '\"');
     720        }
     721    }
     722
     723    /** @since 0.9 */
     724    private void processTrackerForm(String action, HttpServletRequest req) {
     725        if (action.equals(_("Delete selected"))) {
     726            boolean changed = false;
     727            Map<String, String> trackers = _manager.getTrackers();
     728            Enumeration e = req.getParameterNames();
     729            while (e.hasMoreElements()) {
     730                 Object o = e.nextElement();
     731                 if (!(o instanceof String))
     732                     continue;
     733                 String k = (String) o;
     734                 if (!k.startsWith("delete_"))
     735                     continue;
     736                 k = k.substring(7);
     737                 if (trackers.remove(k) != null) {
     738                    _manager.addMessage(_("Removed") + ": " + k);
     739                    changed = true;
     740                }
     741            }
     742            if (changed) {
     743                _manager.saveTrackerMap();
     744            }
     745        } else if (action.equals(_("Add tracker"))) {
     746            String name = req.getParameter("tname");
     747            String hurl = req.getParameter("thurl");
     748            String aurl = req.getParameter("taurl");
     749            if (name != null && hurl != null && aurl != null) {
     750                name = name.trim();
     751                hurl = hurl.trim();
     752                aurl = aurl.trim().replace("=", "&#61;");
     753                if (name.length() > 0 && hurl.startsWith("http://") && aurl.startsWith("http://")) {
     754                    Map<String, String> trackers = _manager.getTrackers();
     755                    trackers.put(name, aurl + '=' + hurl);
     756                    _manager.saveTrackerMap();
     757                } else {
     758                    _manager.addMessage(_("Enter valid tracker name and URLs"));
     759                }
     760            } else {
     761                _manager.addMessage(_("Enter valid tracker name and URLs"));
     762            }
     763        } else if (action.equals(_("Restore defaults"))) {
     764            _manager.setDefaultTrackerMap();
     765            _manager.addMessage(_("Restored default trackers"));
    712766        } else {
    713767            _manager.addMessage("Unknown POST action: \"" + action + '\"');
     
    12231277        // not supporting from file at the moment, since the file name passed isn't always absolute (so it may not resolve)
    12241278        //out.write("From file: <input type=\"file\" name=\"newFile\" size=\"50\" value=\"" + newFile + "\" /><br>");
    1225         out.write("<input type=\"submit\" value=\"");
     1279        out.write("<input type=\"submit\" class=\"add\" value=\"");
    12261280        out.write(_("Add torrent"));
    12271281        out.write("\" name=\"foo\" ><br>\n");
     
    12701324        out.write(_("Open trackers only"));
    12711325        out.write("</option>\n");
    1272         Map trackers = _manager.getTrackers();
    1273         for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
    1274             Map.Entry entry = (Map.Entry)iter.next();
    1275             String name = (String)entry.getKey();
    1276             String announceURL = (String)entry.getValue();
     1326        Map<String, String> trackers = _manager.getTrackers();
     1327        for (Map.Entry<String, String> entry : trackers.entrySet()) {
     1328            String name = entry.getKey();
     1329            String announceURL = entry.getValue();
    12771330            int e = announceURL.indexOf('=');
    12781331            if (e > 0)
    1279                 announceURL = announceURL.substring(0, e);
     1332                announceURL = announceURL.substring(0, e).replace("&#61;", "=");
    12801333            if (announceURL.equals(_lastAnnounceURL))
    12811334                announceURL += "\" selected=\"selected";
     
    12831336        }
    12841337        out.write("</select>\n");
    1285         out.write(_("or"));
    1286         out.write("&nbsp;<input type=\"text\" name=\"announceURLOther\" size=\"57\" value=\"http://\" " +
    1287                   "title=\"");
    1288         out.write(_("Specify custom tracker announce URL"));
    1289         out.write("\" > " +
    1290                   "<input type=\"submit\" value=\"");
     1338        // make the user add a tracker on the config form now
     1339        //out.write(_("or"));
     1340        //out.write("&nbsp;<input type=\"text\" name=\"announceURLOther\" size=\"57\" value=\"http://\" " +
     1341        //          "title=\"");
     1342        //out.write(_("Specify custom tracker announce URL"));
     1343        //out.write("\" > " +
     1344        out.write(" <input type=\"submit\" class=\"create\" value=\"");
    12911345        out.write(_("Create torrent"));
    12921346        out.write("\" name=\"foo\" >\n" +
     
    14831537    }
    14841538   
     1539    /** @since 0.9 */
     1540    private void writeTrackerForm(PrintWriter out, HttpServletRequest req) throws IOException {
     1541        StringBuilder buf = new StringBuilder(1024);
     1542        buf.append("<form action=\"/i2psnark/configure\" method=\"POST\">\n" +
     1543                  "<div class=\"configsectionpanel\"><div class=\"snarkConfig\">\n" +
     1544                  "<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" >\n" +
     1545                  "<input type=\"hidden\" name=\"action\" value=\"Save2\" >\n" +
     1546                  "<span class=\"snarkConfigTitle\">" +
     1547                  "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "config.png\"> ");
     1548        buf.append(_("Trackers"));
     1549        buf.append("</span><hr>\n"   +
     1550                   "<table><tr><th>")
     1551           //.append(_("Remove"))
     1552           .append("</th><th>")
     1553           .append(_("Name"))
     1554           .append("</th><th>")
     1555           .append(_("Website URL"))
     1556           .append("</th><th>")
     1557           .append(_("Announce URL"))
     1558           .append("</th></tr>\n");
     1559        Map<String, String> trackers = _manager.getTrackers();
     1560        for (Map.Entry<String, String> entry : trackers.entrySet()) {
     1561            String name = entry.getKey();
     1562            String announceURL = entry.getValue();
     1563            int e = announceURL.indexOf('=');
     1564            if (e <= 0)
     1565                continue;
     1566            String homeURL = announceURL.substring(e + 1);
     1567            announceURL = announceURL.substring(0, e).replace("&#61;", "=");
     1568            buf.append("<tr><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"delete_")
     1569               .append(name).append("\">" +
     1570                       "</td><td align=\"left\">").append(name)
     1571               .append("</td><td align=\"left\">").append(urlify(homeURL, 35))
     1572               .append("</td><td align=\"left\">").append(urlify(announceURL, 35))
     1573               .append("</td></tr>\n");
     1574        }
     1575        buf.append("<tr><td align=\"center\"><b>")
     1576           .append(_("Add")).append(":</b></td>" +
     1577                   "<td align=\"left\"><input type=\"text\" size=\"16\" name=\"tname\"></td>" +
     1578                   "<td align=\"left\"><input type=\"text\" size=\"40\" name=\"thurl\"></td>" +
     1579                   "<td align=\"left\"><input type=\"text\" size=\"40\" name=\"taurl\"></td></tr>\n" +
     1580                   "<td colspan=\"2\"></td><td colspan=\"2\" align=\"left\">\n" +
     1581                   "<input type=\"submit\" name=\"taction\" class=\"default\" value=\"").append(_("Add tracker")).append("\">\n" +
     1582                   "<input type=\"submit\" name=\"taction\" class=\"delete\" value=\"").append(_("Delete selected")).append("\">\n" +
     1583                   // "<input type=\"reset\" class=\"cancel\" value=\"").append(_("Cancel")).append("\">\n" +
     1584                   "<input type=\"submit\" name=\"taction\" class=\"reload\" value=\"").append(_("Restore defaults")).append("\">\n" +
     1585                   "<input type=\"submit\" name=\"taction\" class=\"add\" value=\"").append(_("Add tracker")).append("\">\n" +
     1586                   "</td></tr></table></div></div></form>\n");
     1587        out.write(buf.toString());
     1588    }
     1589
    14851590    private void writeConfigLink(PrintWriter out) throws IOException {
    14861591        out.write("<div class=\"configsection\"><span class=\"snarkConfig\">\n" +
     
    16321737    /** @since 0.7.14 */
    16331738    private static String urlify(String s) {
     1739        return urlify(s, 100);
     1740    }
     1741   
     1742    /** @since 0.9 */
     1743    private static String urlify(String s, int max) {
    16341744        StringBuilder buf = new StringBuilder(256);
    16351745        // browsers seem to work without doing this but let's be strict
    16361746        String link = urlEncode(s);
    1637         buf.append("<a href=\"").append(link).append("\">").append(link).append("</a>");
     1747        String display;
     1748        if (s.length() <= max)
     1749            display = link;
     1750        else
     1751            display = urlEncode(s.substring(0, max)) + "&hellip;";
     1752        buf.append("<a href=\"").append(link).append("\">").append(display).append("</a>");
    16381753        return buf.toString();
    16391754    }
  • installer/resources/themes/snark/ubergine/snark.css

    r3876f74f r3fbd8b8  
    526526}
    527527
     528input.default { width: 1px; height: 1px; visibility: hidden; }
     529
    528530input.accept {
    529531     background: #989 url('../../console/images/accept.png') no-repeat 2px center;
     532     padding: 2px 3px 2px 20px !important;
     533     min-height: 22px;
     534}
     535
     536input.add {
     537     background: #989 url('../../console/images/add.png') no-repeat 2px center;
     538     padding: 2px 3px 2px 20px !important;
     539     min-height: 22px;
     540}
     541
     542input.create {
     543     background: #989 url('images/create.png') no-repeat 2px center;
     544     padding: 2px 3px 2px 20px !important;
     545     min-height: 22px;
     546}
     547
     548input.cancel {
     549     background: #989 url('../../console/images/cancel.png') no-repeat 2px center;
     550     padding: 2px 3px 2px 20px !important;
     551     min-height: 22px;
     552}
     553
     554input.create {
     555     background: #989 url('images/create.png') no-repeat 2px center;
     556     padding: 2px 3px 2px 20px !important;
     557     min-height: 22px;
     558}
     559
     560input.delete {
     561     background: #989 url('../../console/images/delete.png') no-repeat 2px center;
     562     padding: 2px 3px 2px 20px !important;
     563     min-height: 22px;
     564}
     565
     566input.reload {
     567     background: #989 url('../../console/images/arrow_refresh.png') no-repeat 2px center;
    530568     padding: 2px 3px 2px 20px !important;
    531569     min-height: 22px;
  • installer/resources/themes/snark/vanilla/snark.css

    r3876f74f r3fbd8b8  
    550550}
    551551
     552input.default { width: 1px; height: 1px; visibility: hidden; }
     553
    552554input.accept {
    553555     background: #f3efc7 url('../../console/images/accept.png') no-repeat 2px center;
     556     padding: 2px 3px 2px 20px !important;
     557     min-height: 22px;
     558}
     559
     560input.add {
     561     background: #f3efc7 url('../../console/images/add.png') no-repeat 2px center;
     562     padding: 2px 3px 2px 20px !important;
     563     min-height: 22px;
     564}
     565
     566input.cancel {
     567     background: #f3efc7 url('../../console/images/cancel.png') no-repeat 2px center;
     568     padding: 2px 3px 2px 20px !important;
     569     min-height: 22px;
     570}
     571
     572input.create {
     573     background: #f3efc7 url('images/create.png') no-repeat 2px center;
     574     padding: 2px 3px 2px 20px !important;
     575     min-height: 22px;
     576}
     577
     578input.delete {
     579     background: #f3efc7 url('../../console/images/delete.png') no-repeat 2px center;
     580     padding: 2px 3px 2px 20px !important;
     581     min-height: 22px;
     582}
     583
     584input.reload {
     585     background: #f3efc7 url('../../console/images/arrow_refresh.png') no-repeat 2px center;
    554586     padding: 2px 3px 2px 20px !important;
    555587     min-height: 22px;
Note: See TracChangeset for help on using the changeset viewer.