-
-
Notifications
You must be signed in to change notification settings - Fork 183
Add HTTP API for programmatic file downloads from Telegram links #186
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
…es and handle errors properly Co-authored-by: krau <71133316+krau@users.noreply.github.com>
…text-aware logging Co-authored-by: krau <71133316+krau@users.noreply.github.com>
krau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that your code is not formatted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taskStatus should also contain progress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added progress tracking in commit 20a5e31. TaskStatusResponse now includes downloaded, total, and progress_pct fields that are updated in real-time during file downloads.
…s tracking Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Code formatted with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need a trusted IP mechanism, which will increase the difficulty of use. We only need a token authentication mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed IP whitelist mechanism in commit 173a5e3. Authentication is now simplified to token-only, making the API easier to use while maintaining security through Bearer token authentication.
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
krau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Startup should be refused and a warning should be displayed when the API token is configured to be empty,
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Added validation in commit 3a6402a. The API server now refuses to start if enabled without a token, displaying: "API is enabled but token is not configured. Please set 'api.token' in your configuration file for security" |
krau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because OnProgress is called frequently, the current implementation causes serious performance and deadlock issues.
Furthermore, the filename handling is inconsistent with the implementation within the bot handler. Please refer to the original code.
Finally, we also need to handle media group messages, still referring to the original code.
… handling Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Fixed in commit 6896bdc:
|
krau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The task creation logic remains inconsistent with the original, and storage rules have not been considered. You should carefully review the original code to ensure that tasks created via the API and tasks created directly using the bot behave exactly the same.
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Fixed in commit e1b4087. API task creation now applies storage rules exactly like bot handlers:
|
krau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still inconsistent. IS-ALBUM rule and filenames are not being handled correctly.
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Fixed in commit ef1ecf9:
|
HTTP API for Telegram File Download - Complete ✅
Changes in This Update
Fixed Album Rule (IS-ALBUM / NEW-FOR-ALBUM) Handling:
NeedNewForAlbum()rule (when dirPath is "NEW-FOR-ALBUM")GetGroupedID()) when NEW-FOR-ALBUM rule appliesImproved Rule Application:
ruleutil.MatchedDirPathtype properly for directory path handlingdirPath.NeedNewForAlbum()instead of string comparisonAlbum Grouping Logic (matching bot handler behavior):
groupId)Example Album Handling:
photo1.jpg,photo2.jpg,photo3.jpg/downloads/photo1/directory:/downloads/photo1/photo1.jpg/downloads/photo1/photo2.jpg/downloads/photo1/photo3.jpgConsistency with Bot Handlers:
Now matches
CreateAndAddBatchTGFileTaskWithEditlogic exactly:dirPath.NeedNewForAlbum()groupIdfor albumsOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.