Opened 20 months ago

Last modified 18 months ago

#2695 assigned enhancement

Include snark-rpc in the distribution

Reported by: idk Owned by: idk
Priority: minor Milestone: undecided
Component: apps/i2psnark Version: 0.9.44
Keywords: Cc:
Parent Tickets: Sensitive: no


I would like to see snark-rpc included in the main router distribution as a way for users to control i2p-anonymized torrents from external, possibly non-web clients. The most convincing use-case I have for snark-rpc is to enable myself to integrate Bittorrent and Browser functionality with my webextension, besides automatically managing torrents like http downloads in a familiar-looking interface to new users, it can eventually be leveraged to allow torrent-based resources to be embedded in I2P Sites or even to host certain static I2P Sites as torrents themselves. In the larger sense though, this is about meeting a group of users halfway, in particular those occasional advanced bittorrent users who control clients remotely via Android applications.


Attachments (1)

transmissionrpc.png (164.8 KB) - added by idk 20 months ago.
Most basic example use-case

Download all attachments as: .zip

Change History (7)

Changed 20 months ago by idk

Attachment: transmissionrpc.png added

Most basic example use-case

comment:1 Changed 20 months ago by zzz

  • Is your proposal to bundle only the RPC handler (100 KB) or the RPC and web UI (400 KB)?
  • Would it be enabled by default?
  • Security issues? Would we need to somehow force the user to change the RPC password?

I looked at my downloads of the plugin, I see 35 unique downloaders of the plugin in 90 days, although there of course are b32 changes and scrapers in there. No way to know how many actual users of the plugin, probably much less. In the last update cycle Dec. 1-10, there were 13 unique downloads of the update. But I only see 3 checks of the plugin update version in 90 days, which may be the truest indication of usage. That's not a strong indication of popularity.

comment:2 Changed 20 months ago by idk

  • The RPC handler is the part I care about, could take or leave the Web UI.
  • Right now nothing I have written to take advantage of it assumes it is present by default. In the future, I would like that to change.
  • Possible, but I'm not fully convinced that it's a big enough deal to force the user to change the default RPC password if it only listens on the localhost. More like a recommendation. Another flow might be possible too, changing the default password when a client connects and having the client cache the new, securely-generated password. That would require a password view(or)reset(or)restore option where the RPC interface is configured in the console, and it would be a feature only if a client supported it, but it would only interfere with the user when they wanted to switch from one RPC client to another, or when they want to use more than one client at a time.

All three of those update requests were probably me. Not making my case there am I? But I think there is something important to consider here is that this isn't a plugin for users really, it's a plugin for developers and bittorrent power users from 10 years ago. Bittorrent power users will do what they want, they mostly seem to prefer the simplicity of Snark's webUI to the flexibility of an RPC server I guess. One or two developers might take an interest(Literally us), but no user is going to take an interest in yet-another-web-client for I2PSnark.

What I think they will take an interest in is if I2P suddenly becomes an option in the applications they already use. So Firefox and Chromium can get torrents in the browser via extensions(Click or right-click menu to add torrents, monitor and launch files from the browser menu, I have everything but launching them so far), that's one way of bringing Snark closer to the average user's experience, but the best way to do it depends on Snark-RPC. If everybody who uses I2P-in-Private-Browsing also used Snark-RPC, not only would Snark-RPC have more users, I believe more people would be using I2P's torrent network. There are probably other cases when controlling an existing I2P torrent client is easier than creating a whole new torrent client just for an application to use.

comment:3 Changed 20 months ago by idk

Also, and there's some time before this becomes a thing I integrate into any application but it is on my list of things to try, I would like to try using browser extensions to allow the embedding of resources from inside torrents as resources on pages. So if an img tag contained a magnet link, followed by a reference to a file contained inside the torrent, then the torrent would be downloaded by snark and displayed as the img. It will require thinking about a way to set the maximum amount of disk space allowed for files downloaded in this way, and maintaining two lists of downloads, user-initiated and page-initiated, and only deleting the page-initiated ones when the quota is met. All seems very accomplishable.

Eventually, a snapshot of a site in browseable form could be distributed with bittorrent, making that site more resistant to takedown, or just somebody forgetting the password or the SD card in the Raspberry Pi crapping out. They could then issue a feed with periodic snapshots and subscribers could host those snapshots, and I could write a protocol handler for the browser extension and maybe make a proposal for the addressbook depending on how it happens, this is way down-the-line, to use those feeds as the way to find download the current content of a desired site. Ultimately what it could lead to is a more decentralized kind of I2P site. Of course things that require a server to interact with are out, but it would be a good way to distribute information like the Wiki that disappeared for a few weeks earlier this year before a dump was made available to us. This is the final outcome I want, but it, and everything leading up to it, depends on Snark-RPC.

Last edited 20 months ago by idk (previous) (diff)

comment:4 Changed 19 months ago by idk

Another possible use would be as a way to integrate with many Android Bittorrent clients, most of which default to being RPC controllers for fully-fledged Bittorrent clients on desktop PC's or servers anyway. Libretorrent is, AFAIK, the only one that defaults to being a fully-fledged torrent client in and of itself, even BiglyBT defaults to being an RPC controller for another client on another machine and must be switched into torrent client mode.

To try it out, I set up BiglyBT as a controller for Snark-RPC on my laptop. BiglyBT's RPC controller on Android is capable of controlling Snark-RPC. Also capable of managing multiple RPC remotes, so we won't break people's existing RPC remotes. They can keep using their seedboxes or whatever other thing I don't need to know about by using a second remote for their Snark controller.

In the scenario where Snark-RPC is running on the Android device, Snark's own UI wouldn't need to enter into the equation, nor would the client being controlled by the RPC controller be on a remote machine. Users would just point their bittorrent RPC client at wherever we put it, since Android doesn't usually have a Web interface up it probably doesn't need to be at that location if we don't want it *there*).

At any rate, it might be a away to get Bittorrent-over-I2P on Android without needing to write an Android UI for Snark. Also again, it's about meeting people halfway with something. It's hard enough to get people to switch to privacy-focused software, but by using Snark-RPC to enable Android bittorrent clients to become Android i2p-bittorrent clients, we don't ask them to adopt new software or adapt to unfamiliar ways of doing things beyond that which is necessary.

comment:5 Changed 19 months ago by zzz

re: comment 4

We don't (and can't) have any server or servlet facilities in Android. We'd have to refactor it to use a socket instead of jetty (JSON splitting), or else bundle some minimal server. We've had similar discussions about i2pcontrol, see comments in apps/i2pcontrol/build.xml

So nothing about un-pluginizing snark-rpc gets you to an Android solution for free. It's a separate effort. Current snark-rpc takes the lazy way of implementing it in a servlet.

comment:6 Changed 18 months ago by zzz

I think there's an easier way than browser extensions. In Deb/Ubuntu? installs we could just register the mime type so we would be a handler.

If you have a clearnet torrent app installed, look in /usr/share/applications for the desktop file, e.g. transmission-gtk.desktop

The second part of the solution would be that the desktop file Exec line specifies a shell script. We'd write that script to check if i2p was running (service or not?), and start and wait a while if not. Then find console port, and launch browser to snark page with params to add the file or magnet link (check config for correct browser, or use sensible-browser). Or, just use json-rpc to add it. But if we're going to load the snark page in the browser anyway, I don't know if it makes to use RPC at all.

tl;dr maybe a desktop file and shell script is sufficient, don't need RPC?

Note: See TracTickets for help on using tickets.