sigaloid / LibreTranslate.Net

LibreTranslate c# library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor source code

arivera12 opened this issue · comments

  • Separate class and enums in separate files
  • Downgrade net version to its minimum requirement version
  • Comment source code for intellisense

@sigaloid did you ever make this work properly?

I am getting 403 atm.

I used http client instead, then tried out with webclient and same result with both clients...

I created my own branch for this

https://github.com/sigaloid/LibreTranslate.Net/tree/Development-arivera12

I run the project as-is. It seems that maybe we need the api key?
image

I will try downloading the other project and create my own local server and then try again.

I was able to pull supported cultures but the translate method seems to need the api key.
image

A specific header needs to be added to the web request in order for this library to act as though it is in the web browser. However, this is bypassing the restrictions the server administrator added (evidently the server load justified the need to lock down the API). In addition, there are still heavy rate limits (see below).

For now, we can add the api_key to the constructor
image; this was on my to-do list anyway. This way, legitimate users to the main server with a valid API key can make their requests.

See these github issues: LibreTranslate/LibreTranslate#85 LibreTranslate/LibreTranslate#82

So basically just adding api_key with random value to the request post bypass security?

No, you need an API key from UAV4GEO in order to use it. However, being on the actual website bypasses this because of the headers sent along. I'm fairly certain @uav4geo does not want libraries or developers bypassing this, so the site could be used by humans and only paying developers would use the API.

However we do need an API key to test with once we try to add API functionality. I will try to message him soon. Finals are ending soon so hope to have the free time to add it

Well, in that case we need a temp api key to test it out.

I will be waiting for this then, I have everything almost done, just need to test the translate api.

I created the nuget package, refactored source code, updated readme, just waiting to test the translate method.

I created the nuget package assuming that we just need to provide the api key to the translate method.

https://www.nuget.org/packages/LibreTranslate.Net

I believe I can test this out myself since the API functionality is built into libretranslate. Testing soon

Check out my branch for testing

Well my VPS is out of space and I can't host any more docker containers 😞 As long as it matches the specs here it should work though.

Closing this a moving what is left here: #7