HirbodBehnam / file2url-go

A Telegram bot to convert files to URL for direct download links.
MIT License
25 stars 12 forks source link

Link Validity #3

Closed zoredeaxx closed 2 years ago

zoredeaxx commented 2 years ago

Hello,

  1. Really appreciate your efforts towards improving the code.

  2. Can you please confirm about the validity of the Generated Link? Is it maximum of 1 day in current context and dependent on the value of memory cache. If that so, what impact would it have to further increase persistent data storage in RAM in terms of RAM usage/requirement.

  3. Is there a possibility of increasing generated link validity by storing it in some kind of session storage/database OR making use of telegram file id instead of uuid for generating the link so that it can be fetched later permanently... .

Regards.

HirbodBehnam commented 2 years ago

Hello

  1. You are welcome. I'll do my best to improve the code because I use this bot a lot myself :)))))
  2. Yes, right now links are valid for a day. Here is the logic in code: https://github.com/HirbodBehnam/file2url-go/blob/5a9772a694f90034e9f2ebb0bab4e1a648d74442/database/memory_cache.go#L32-L45 You can increase the TTL of the tokens or even disable them! But there are two downsides: Memory usage: Each entry uses about 200 bytes. There is also one more thing called file reference which apparently, it needs to be updated after a while because it might get expired. I'm not sure how can I achieve this...
  3. Yes yes, later, I will add database support so you can have persistence data. But before that I should fix the file reference...
zoredeaxx commented 2 years ago

Hello,

  1. Thanks a ton for the insight on RAM usage. Will try to increase validity of the link initially to one month and check the RAM usage.

  2. With regards to file reference issue, I have come across couple of codes written in python for generating direct link of telegram files in which the bot forwards the media to a bin channel for storage and the reference is being made to the File ID of the stored file. The Generated Link remains valid till the time the file is available in the bin channel. If it can be of any help for further development of the code.

  3. Eagerly looking forward for more improvements in the code.

Regards.

HirbodBehnam commented 2 years ago

Thanks for the channel idea. I'll see what I can do. Telegram says that FileRefrence must be cached in client and if it's invalid, I should use messages.getMessages to get it again. I shall go and experiment with it to see what happens...

zoredeaxx commented 2 years ago

Hello,

  1. Thanks once again for considering the suggestion... Your prompt response is highly appreciable.

  2. Just a small query with regards to format for setting BOLT_DB_PATH environment variable. Will setting any 'name' do or it has to be in 'name.db' format.

  3. Eagerly looking for testing the upgrade.

Regards

HirbodBehnam commented 2 years ago

Hello Any arbitrary value will work.

zoredeaxx commented 2 years ago

Hello, Thanks a ton once again. Regards,