C9Glax / tranga-website

Web-Frontend for Tranga-API
GNU General Public License v3.0
17 stars 10 forks source link

Custom RateLimit setting #39

Closed C9Glax closed 6 months ago

C9Glax commented 7 months ago

@db-2001 Hey do you have any ideas on how to design this? https://github.com/C9Glax/tranga/issues/109

Right now requestLimits (apart from MangaDex which is very strict) use byte 1 and a value of 1 request per second. API is already done. Already did the UserAgent as that was Straightforward enough, but am kinda stumped on how I want to do this.

db-2001 commented 7 months ago

I'm a little bit lost on what youre asking. Are you asking do I have a way to design the front end to allow for custom user agents and rate limits per site? Or how to actually implement the rate limiting? For the former, yes I have an idea. I wanted to put all the connectors in a section on the settings page so that eventually when global search is enabled, you could disable connectors you didn't want to search, these settings could just go there. For the latter, I don't have any offhand knowledge about rate limiting but I could look into it?

Could you also clarify what you mean by requestType in the API? I'm not sure what/how the byte 1 you mentioned is being used.

C9Glax commented 7 months ago

Oh I was asking about the design yes. The API is already done and (hopefully) working, it's just a frontend thing. The global search thing sounds cool and putting in the ratelimits there sounds like a good idea 👍🏼

Could you also clarify what you mean by requestType in the API? I'm not sure what/how the byte 1 you mentioned is being used.

I was trying to explain how it works at the moment. Different requesttypes (e.g. a website, an author-information, an image) have different bytevalues. I think only Mangadex has that though and all others just use a bytevalue of 1. thats what i meant

db-2001 commented 7 months ago

Ah okay, I think I get it. I'll try and mock up something and put in a pull request sometime this weekend. Couple questions, does the bytevalue need to be handled on the front-end side? If so what do the different bytevalue for MDex correspond to? Second question, should the global search be implemented on the front-end side or server side, I can do it pretty easily on the front end side but, I feel like storing which connectors are enabled/disabled should be handled by the API.

C9Glax commented 7 months ago

Couple questions, does the bytevalue need to be handled on the front-end side

Kind of, if you want to configure a specific request rate limit then yes. The bytevalues are in every constrcutor, for example here.

I feel like storing which connectors are enabled/disabled should be handled by the API.

Yea this would also fall in line with disabling connectors if chrome fails.

So I guess should be implemented on api side...

db-2001 commented 7 months ago

Can you add GET API calls so I can populate the value of the textbox with the saved rate limit. Adding Logs to those functions so it's easy to check what the rate limit has been updated to from the logs would be nice as well, if possible.