From 561a9c34da09fb783b53cc2dd9100b855febcad3 Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 10 May 2020 17:21:00 -0400 Subject: [PATCH] 0.1 --- README.txt | 63 +++++++++++++++++++++++++++++++++++++ i2psnark | 79 +++++++++++++++++++++++++++++++++++++++++++++++ i2psnark.desktop | 13 ++++++++ i2psnark.png | Bin 0 -> 2392 bytes install.sh | 11 +++++++ 5 files changed, 166 insertions(+) create mode 100644 README.txt create mode 100755 i2psnark create mode 100644 i2psnark.desktop create mode 100644 i2psnark.png create mode 100755 install.sh diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..eca1d97 --- /dev/null +++ b/README.txt @@ -0,0 +1,63 @@ +i2psnark-launcher +ALPHA version 0.1 2020-05-10 +============================== + +This is a simple file and URL handler script that stuffs the magnet URL +or torrent file path into i2psnark. + +It also checks to see if i2p is running first, and starts it if not. + + + +SUPPORTED PLATFORMS +------------------- + +Linux Debian/Ubuntu type systems only. +I2P must be installed either as a debian package, +or as a manual install in $HOME/i2p. + +For best results, I2P dev build 0.9.45-18 or higher required. + +I2P dev build 0.9.45-18 or higher required for clicking on files. +magnet links will still work, but you have to click on the +'Add Torrent' header in i2psnark to get it to open up. + +Browser: It tries first the routerconsole.browser configuration in i2p, +then sensible-browser (it's a debian wrapper script), then firefox. + + +INSTALLATION +------------ + +Don't trust me, read the install.sh and i2psnark scripts before +installing them. + +If you want to test before running install.sh, +try './i2psnark foo' to see what it does. + +To install it, run './install.sh' +It will ask for your sudo password to put it in /usr/bin + + +USAGE +----- + +After installing it, clicking on a .torrent file in nautilus +will ask you if you want to open the file with i2psnark. + +In your browser, when you click on a magnet link or torrent file link, +it will ask you what application to open it with. +Browse to /usr/bin and select i2psnark. + +All the script does is copy the magnet link or path +to i2psnark "Add Torrent" form. + + +BUGS +---- + +Please report bugs and patches on zzz.i2p. + +If things go well maybe we'll add this to our installers and packages. + +zzz diff --git a/i2psnark b/i2psnark new file mode 100755 index 0000000..0bae9d0 --- /dev/null +++ b/i2psnark @@ -0,0 +1,79 @@ +#!/bin/sh +# +# handler for i2psnark torrent files and magnet links +# +# version 0.1 +# +# zzz 2020-05-10 +# +if [ $# -ne 1 ] +then + echo "usage: $0 link" + exit 1 +fi + +ARG="$1" +I2PURL=http://localhost:7657/ + +wget "$I2PURL" -o /dev/null -O /dev/null +if [ $? -ne 0 ] +then + # check local install + I2PROUTER="$HOME/i2p/i2prouter" + if [ ! -x "$I2PROUTER" ] + then + # check system install + I2PROUTER=i2prouter + type "$I2PROUTER" > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "i2prouter is not installed" + exit 1 + fi + fi + "$I2PROUTER" status > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "Starting I2P..." + "$I2PROUTER" start + # wait up to 5 minutes + i=0 + while [ $i -lt 60 ] + do + wget "$I2PURL" -o /dev/null -O /dev/null + if [ $? -ne 0 ] + then + echo "waiting for i2psnark..." + sleep 10 + break; + fi + echo "waiting for i2p..." + sleep 5 + true $((i++)) + done + else + echo "I2P running but console not up?" + exit 1 + fi +fi + +BROWSER=`grep '^routerconsole.browser=' "$HOME/.i2p/router.config" 2> /dev/null | cut -d '=' -f 2` +if [ "x$BROWSER" = "x" ] +then + BROWSER=sensible-browser + type "$BROWSER" > /dev/null 2>&1 + if [ $? -ne 0 ] + then + BROWSER=firefox + fi +fi + +wget "${I2PURL}i2psnark/" -o /dev/null -O /dev/null +if [ $? -ne 0 ] +then + echo "I2P is running but i2psnark is not, start it first" + "$BROWSER" "${I2PURL}configwebapps" + exit 1 +fi + +"$BROWSER" "${I2PURL}i2psnark/?nofilter_newURL=$ARG#add" diff --git a/i2psnark.desktop b/i2psnark.desktop new file mode 100644 index 0000000..dc7169b --- /dev/null +++ b/i2psnark.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Name=i2psnark +GenericName=BitTorrent Client +X-GNOME-FullName=i2psnark BitTorrent Client +Comment=Download and share files with i2psnark +Exec=i2psnark %u +Icon=i2psnark +Terminal=false +Type=Application +MimeType=application/x-bittorrent;x-scheme-handler/magnet; +Categories=Network;FileTransfer;P2P;GTK; +X-Ubuntu-Gettext-Domain=i2p +X-AppInstall-Keywords=torrent diff --git a/i2psnark.png b/i2psnark.png new file mode 100644 index 0000000000000000000000000000000000000000..e8d7fb51b5b6fbbd5bf1e4dcb21fd494862d68ca GIT binary patch literal 2392 zcmX|@dpOhm8^=GJ*;wYZIfTe^XpSQ$JZiGVJB1&M1J5+Q~H0w^FC z27|3JGz>8`2DNZFocI5L6lf z3fvzADiN7raGXsbT1cI5F*_JI^Aa-Cg<<67P%^0HWw26TsRE=?NSJGoD-ys~R)Fsz z-}M{RFp8MbQIJ%Twma*uri{KACnq42TGTmw_0w$X+H|rScc)_s8k4psvz!nz3%nTSG2mSq^ zun-(L0Q~%bf;?DUT%4YszI^#|L483j_gLiVNU|4so5wa1g=FDiQ3H$&hz6xVKMCkW z0gVW-em79Tt;cOp!8*VcOu;$>Ad3ew6beia51X6>U0tBE5~QVp)2BgrIKbh+!oosZ zTboEEy4ZX%FE20sMtW>vEGw7A%wW=J&Q3l~^T2)z*xK5Xx`1UXAex#QRsh31ut{5A zTUU3zp`p67G!CbvsH`j_Cx_6~gfA_D-d@n&4q95k{rjMy0SE-3wiYBL06HCbdjlE` zS_hVwmxqUkdwY93Iy&m>>jeUVNOa?ipn}im7Zw%{@$<8?veK*4<4WS<4(>-^R2zZ5wR^iQrowi5` z{|twHAdDfG);M?$dYyM@6i46q!L!9uXJ=j2#hyoIu0;*qj!s%Nc(HUedgylYude!1 z^iWq>t!MpX3qi11|cy2+E6>-m&an_bJ%9evEp zTfYY3(VP5r6Gj{eQ75%LPt;Y<-FB<<(M!JGRSBLE6ufT*GVnT&9>{P5BvmF&xiVQ` zCt5T{-dDZ^V@3q7ixj^}UUXmH`b5|6OeQ=Uu6`){4+&oVyWXXP&-B~o{C7S5;W+p{ zO;+^DD>L3@-wUfcUi-Y~#>Xe7MxEX{g!cPq+gOJ!-0syM zH5Ct-;r5V<{2z1OCx^upmY$A{ufvqAn)5LWe|_11H9z2=+kK_pb1@DZL6yB6-x6+o zCNyO)>hTb!&WNQhM5CuKSx^7$z)DWLA`a3QROyRbr6u*5=Sk&BZRJ z87#ODyLTp(H(4urLoW)-j^&c1z>&`Sfh` zLwW4%h{;`n=3l*LUx`LHwI9wsp+IQ|~YxEv_o?89p4~Je`hx5vxzYf4ollEvR z8*>pMC)+R=QEwZcVQYBT0w^Ti=COZ~Bh>VF@f9s&E-vHy7{X#)*0&Av;w5cW*e*#Z zr`3LOw1odLIUzLs`Z~U?@`J~S{N1HZ$Q^NMbAy7#rI;q}_pw9M<*S<4vS)7B5qbYO z$2-ckee3M%>N@+1DDzQk@B0gpV=5`3MP`2udk9NBT+2R0(zkxv9rj680(RmVK0H-3qyr$dg$?x{&--jdk)79wMkBm@vBk#uw_edxdCPaV zWBjJ8X1RZ7T&%Hg$CVUkp3t{q9@UDQr%gop_#L>lujaFUA)!co_}bH!NTe#P%JR+b zf+N|y3ggBm)Tr;+d>}DsM%y$|C8pBygE_VKm?Al+jgf2U@(Nemv$(}%vO6a?S6=dS z2Pwc?yRH~p4Z-&8HJ6MW{3YqQ9ocb@Cr_p8gVsfvH}M?<#V=!Bu{{T^@+*8_#kFc(ZJ@~a*zLV$ x;Gd#LJEkXdnmDazRYrFyiP(`L*POjLu9GrV&=gdal=ADVK%;t4YIlU3`5(?&>*D|b literal 0 HcmV?d00001 diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..ca8da00 --- /dev/null +++ b/install.sh @@ -0,0 +1,11 @@ +#!/bin/sh -x +# +# install the i2psnark launcher +# + +# these are for the .torrent file association +cp i2psnark.desktop "$HOME/.local/share/applications/" +cp i2psnark.png "$HOME/.local/share/icons/hicolor/48x48/apps/" + +# this is the launcher script +sudo cp i2psnark /usr/bin