github Power2All/nanotorrent v0.4.0
NanoTorrent 0.4.0

5 hours ago

Changes since 0.3.8.

Added

  • Stream a file to a player while it downloads The web interface serves
    byte ranges out of a file that has not finished, at
    GET /api/torrents/{hash}/files/{index}/stream, and the Files tab grows a
    Play button and Copy stream URL for the files worth streaming. Seeking works
    on a partial download: the reader blocks on the piece under the read head and
    the engine fetches it. NanoTorrent launches nothing itself - the URL goes to
    whatever plays it.

  • Right-click a file and play it in VLC or mpv A new shipped example,
    player.rhai, puts a Play item on a file's context menu in the details panel
    and in the web interface, and hands that one file to the player you picked:
    system default, VLC, mpv, or a program of your own. It arrives switched off
    and does nothing until you approve what it asks for.

  • Plugins can draw on a file, and start a program ui_file_menu puts a
    plugin's items on a file's context menu - the only place a plugin draws
    outside its own window - and on_file_menu(id, hash, index, name) tells it
    which item was used and on what. execute is the new permission behind run
    and open: it starts programs as you, reads last in the approval prompt for
    that reason, and every use is logged with the program and its arguments
    before the process starts. Nothing is shelled out, so a filename out of a
    torrent cannot become a second command.

  • Fifteen more calls in the plugin API The file list, the peer list,
    trackers and tracker editing, share limits, queue moves, per-file priorities,
    set_location, add_torrent_file, dht_nodes, listen_port, magnet_uri
    and stream_url - closing the gap against what an authenticated web client
    could already do. stream_url hands a player a URL carrying a token good for
    one file for half an hour, rather than the web interface's password.

  • The Files tab has a selection, a keyboard and a menu Click a file to
    select it - one at a time, since everything a file row does is per-file
    already. Up and Down walk the list, Home and End jump to its ends, and Enter
    or Space folds the folder you are on. Right-clicking a file now always opens
    a menu, starting with Open file, which hands it to whatever this system
    opens it with; plugin items follow underneath. Before this the menu existed
    only if a plugin had put something in it, so with no plugins a right-click
    did nothing at all.

  • Folders fold, in both file lists The Files tab of a torrent's details and
    the Add torrent dialog both drew a tree already, but one you could only
    scroll: a season of episodes in one folder was a wall of rows between you and
    the next folder. Click a folder row to fold or unfold it, in the desktop
    window and in the web interface alike. The web interface's two lists showed
    full paths and are now trees as well. Folding is a view, not a choice: a file
    inside a shut folder keeps whatever it was set to, and the Add dialog adds it
    exactly as if the folder were open.

  • The torrent list takes the keyboard Up and Down move the selection a row
    at a time, Home and End jump to the top and the bottom, and the list scrolls
    to follow. The selection is clamped at both ends rather than wrapping round,
    so holding Down to reach the last row stops there.

  • Two more web API routes GET /api/torrents/{hash}/peers for the swarm
    and GET /api/torrents/{hash}/magnet to export a torrent already added.

Changed

  • The two file lists are drawn as a proper tree The Files tab of a
    torrent's details and the Add torrent dialog both indented their rows, which
    said how deep a file was but not what it sat in: a file three levels down and
    its folder shared no visible line. Both now draw the connectors a file
    manager draws - a line down each folder that still has entries below, an
    elbow at each one, and the elbow closing off at the last. Every row carries
    an icon as well: a folder, or for a file one picked from its extension -
    video, audio, image, archive, disc image, document, subtitles, program and
    code each have their own, and anything unrecognised gets a plain sheet. The
    Add dialog's include checkboxes now stay in a column of their own too; the
    indent used to carry them along with the name, so a deeply nested file put
    its checkbox somewhere else entirely.

  • Plugins can be translated, in a file of their own A plugin's strings go in
    <plugin>_translations.json beside its script - locale first, key second -
    and t("key") reads them. No permission: it is the plugin's own file. A key
    with no translation falls back to English and then to the key itself, so a
    half-translated plugin has no blank controls. The language is read when the
    string is asked for, so a plugin follows a language change without a reload.
    All three shipped examples - example, rss and player - now carry no
    English at all in their scripts, and each ships a catalogue covering all 76
    languages. player also shows the one trap worth avoiding: it stores option
    ids rather than translated labels, so the saved setting survives somebody
    switching language.

  • Eight web-interface tunables are constants again The worker count,
    connection caps, timeouts and body ceiling under Preferences > Web interface >
    Advanced are gone. They were constants until one release made them settings,
    and a worker count is not a decision anyone using a torrent client makes. The
    three brute-force lockout settings stay - a lockout that cannot be switched
    off is a way to lock yourself out. Existing values in the database are simply
    no longer read.

  • Column and chart widths in the web interface are remembered by the browser
    rather than by the server. A phone and a desktop want different column widths
    and the server could only ever hold one answer.

  • axum is no longer compiled in NanoTorrent never served an axum route, but
    two dependency declarations in the vendored librqbit pulled the framework in
    regardless. Six crates leave the build.

Security

  • Cross-site requests can no longer change anything A page on another site
    could submit a form to the web interface and the browser would attach your
    saved credentials to it. Most of the API was already safe by accident - it
    only accepts JSON, which a form cannot send - but the handlers that take no
    body at all (pause, resume, re-check, re-announce, apply settings) did as they
    were told. Requests carrying another site's Origin are now refused. Nothing
    that is not a browser sends an Origin, so scripts and plugins are unaffected.

  • A torrent can no longer name a Windows drive as a folder A path component
    of C: passes every check a torrent path is given - it is not "..", and holds
    no separator - but joining it throws the download folder away. Writes were
    already guarded; what was not was every OTHER reader of that name, including
    the new Open file action, which could be made to open an arbitrary existing
    file. Such a torrent is now refused when it is added.

  • A torrent filename can no longer inject a line into a playlist The .m3u
    the web interface hands a media player put the filename in its body unescaped,
    so a newline in it appended a line of the torrent author's choosing - a second
    URL, which the player would then fetch.

  • Failed logins are only counted when a password was actually tried A
    request with no credentials at all - a browser asking what this is so it can
    prompt, a bookmark, a port scan - counted toward the lockout, so five of them
    locked the owner out for an hour. A real guess always carries the header, so
    the brute-force limit is unchanged.

  • The proxy password is no longer read back over HTTP It has to be stored in
    the clear, because it is replayed to the proxy, but every load of the settings
    drawer was sending it to the browser. It now reports only whether one is set.

  • X-Content-Type-Options: nosniff on every response, not only on the page.

Fixed

  • The fold marker on a folder row is now visible The Files tab and the Add
    torrent dialog marked an open folder with a small triangle, typed as U+25BE
    and U+25B8. Segoe UI has neither: the shaper returned the empty .notdef box
    for both, so the marker was a blank space whichever way the folder was
    turned. It is drawn now rather than typed, like every other icon in the
    window, which is also what makes it follow the theme.

  • The self-signed certificate now names the loopback addresses It covered
    localhost and the machine's hostname but not 127.0.0.1 or ::1, so a
    player opening a stream URL by address reported a name mismatch on top of the
    expected unknown-issuer warning. VLC now raises one question rather than two,
    and accepting it once sticks.

Don't miss a new nanotorrent release

NewReleases is sending notifications on new releases.