RNS Logo

rns.recipes

Community Forum

Forum / Help / Dynamically adding new files to a nomadnet site without restarting the daemon

Dynamically adding new files to a nomadnet site without restarting the daemon

NomadNet

Started by welo ·

Sup, so I'm currently making a yt-dlp proxy that lets you download any youtube video (or anything else downloadable by yt-dlp which includes a lot of webistes) and then makes it downloadable by anyone connecting to that nomadnet site.

However there's the issue that any new file that is created is not able to be downloaded till you restart the nomadnet --daemon (which I've been using to serve the pages), yea I could theoretically restart the program every download (I already have a background daemon for the downloader anyways) but that's not the cleanest solution and would spam announcements + cause occasional downtime for the site.

There's a few page serving dedicated programs just for serving but I don't know if they suffer from the same problem. is there any nice way around this?

Sidenote, if I manually go to the file url using rBrowser on my site I get something like this

_io.BufferedReader name='/home/welo/.reticulum/storage/resources/12ed7865854141af87c06799b9f35c4d7f4208a5f21a98af03d20ac825c7bf53'> which doesn't exist if the file did not exist during startup (server never respond), but also this leaks the server's path to reticulum and exposes people's username which is bad, I attempted to do this on some pages that weren't my own but doing so never returns anything, so I'm not sure if my config is just busted or they are using a page serving application instead of just putting nomadnet as a daemon but I'm pointing it out just in case.

Mark bc7291552be7a58f...

It looks like rBrowser hasn't implemented support for stream-based file transfers. When RNS transfers files, it can use a file descriptor / BufferedReader based stream instead of loading the entire file into memory first (stupid if you're transferring gigabytes). On the other end, the receiver will also get a file object back, which the application can read from, or move to where it needs it. Much more efficient and lightweight. So, rBrowser will have to just update the code a bit so it works correctly.

Mark bc7291552be7a58f...

You can just register one file path handler such as "download" or whatever, and then pass an id as query parameter, then stream the file from disk with a response object. For something like this, though, it's probably better to write a custom server that serves the pages than using nomadnet to host it. From rngit, for example, you can download any file from any point in a repository's history. You can look at the source code to see how it works.

I was aware you could query files (saw it in the nomadnet release notes) but I never found any documentation on it so I just sorta ignored it so I'll look into that. The rest of the source code is written in rust and response object seems to a purely python thing but including a 5 line program for this (since it is its own file) functionality should be doable.

Creating a custom server is also probably doable but it's outside of the scope of what I want to do (and am confident in doing) and could be booted on later; assuming that making a custom server doesn't also require the whole thing being written in python. I was also making this with the intention of being to slot it into any nomadsite by simply copying over the executable but given it requires running a daemon (which I could spawn when the page is first loaded, maybe?), that might be a hard sell.

LinuxinaBit 2b4116b574e3a4f3...

You can configure the interval with which NomadNet re-scans files, using ~/.nomadnet/config like so:

# Automatic rescan interval of the pages directory in minutes.
# Default: int = 0 (no rescan)
page_refresh_interval = 0

The above does in fact work, but the minimum time is 1 minute, which is still a bit slow for my use case of instantly allowing the user to download what has been uploaded (plus I don't have a way of detecting it so I can't even tell the end user to wait). I did try putting the value as 0.01, but it's an int value. It'll work for now as a temporarily solution as I get past the MVP stage

Post a Reply

Markdown

Supports Markdown: **bold**, *italic*, `code`, ```code blocks```, [links](url)

Log in to upload images

Proof of work verification for anonymous posting

Copied to clipboard