Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ratio limit to Joal #191

Open
ashaychangwani opened this issue Feb 9, 2023 · 5 comments
Open

Add Ratio limit to Joal #191

ashaychangwani opened this issue Feb 9, 2023 · 5 comments

Comments

@ashaychangwani
Copy link

ashaychangwani commented Feb 9, 2023

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=*"]
@laur89
Copy link
Contributor

laur89 commented Feb 9, 2023

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).

@ashaychangwani
Copy link
Author

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?

@anthonyraymond
Copy link
Owner

The UI project is hosted at : https://github.com/anthonyraymond/joal-ui

@ashaychangwani
Copy link
Author

@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?

@anthonyraymond
Copy link
Owner

anthonyraymond commented Feb 15, 2023

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 start or npm 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.port value in server config file src/main/java/resources/application.properties during your tests

@anthonyraymond anthonyraymond linked a pull request Feb 22, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants