Add Ratio limit to Joal
Hi!
Joal is absolutely perfect for my use case, except that it has got me close to getting banned a couple of times, when I forget to take the torrent off and it keeps uploading. Even setting a speed of 1mbps over a span of 3 days can rack up over 200gb of upload, which is suspicious to say the least.
For that, I've added a ratio limit of 1.0. I'm aware that this has already been addressed in the past in #38, but since I needed a temporary fix, I decided to write something myself here: https://github.com/ashaychangwani/joal-ratio/tree/addRatioLimit
I haven't opened a PR yet, because I'm not sure the code is up to your standards, however I just want to use this as a starting point and iterate to make it more functional and cleaner, as well as improving the test coverage.
Could you tell me how I can compile the same code into a way that I can use it with my media-stack?
I'm currently using the following docker-compose script to run Joal:
joal:
image: anthonyraymond/joal:2.1.33
container_name: joal
restart: unless-stopped
volumes:
- /storage/joal:/data
ports:
- 9092:9092
command: ["--joal-conf=/data", "--spring.main.web-environment=true", "--server.port=*", "--joal.ui.path.prefix=*", "--joal.ui.secret-token=*"]
I haven't opened a PR yet
Easier to discuss code under PR. They cost nothing, just fire away.
Could you tell me how I can compile the same code into a way that I can use it with my media-stack
In the project dir do docker build . -t custom-joal, then use that as you image in docker(-compose).
Noted, I've opened the PR!
How can I unminify the JS scripts so I can add an option to configure the ratio on the config screen?
The UI project is hosted at : https://github.com/anthonyraymond/joal-ui
@anthonyraymond Not sure if this belongs here, but how can I modify the code to the UI and then port the changes to the current repo? For example, if I make changes here, what are the commands to generate this file?
Hello @ashaychangwani thanks for contributing to the project 👍. You'll find some advice below to help you sort that out. Before you dive in, note that the current version is going to be replaced with a fully rewritten one (won't happen in 2023 IMO, maybe in 2024). I'm trying to rethink the whole project from the ground up and i'm also switching to golang. It's far from being done, i'm doing that on my spare time and i don't have much these days 😆 .
Anyway, here is what you need:
yarn build or npm run build will build those files. New files will have a different name. Delete existing and replace with the new ones).
Please follow the following while implementing :
- [ ] Ensure the project still start even if the joal.conf does not contains the new entries
- [ ] Make the ratio-limit an object containing (bool enabled, int maxRatio), don't inline those two properties in the JoalConfig please.
- [ ] Make it opt-in (off by default)
- [ ] As is, the feature only work if the upload happen in a single session (ratio is not considered reach if a upload 50%, stop, upload the remaining 50%). Please add a side note to the UI config page.
Side note: if you want to try your code without having to build every time:
- Start the server in your IDE of choice
- Start the ui from command line
yarn startornpm run start, (if i remember well it support hot reloading) - From http://localhost:3000, change the connection settings to match the server on localhost (again, if i remember well, the port being listened by the server is randomized, you may want to change
server.portvalue in server config filesrc/main/java/resources/application.propertiesduring your tests