Gofile fix#479
Open
TGxIRFAN wants to merge 1 commit intoSilentDemonSD:wzv3from
Open
Conversation
Now upload fine Signed-off-by: AS TG <126592884+TGxIRFAN@users.noreply.github.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the Gofile direct-link generator to compute and send a dynamic, hashed website token and an additional localization header when fetching folder contents, aligning the client headers with Gofile’s current API expectations so uploads/downloads work again. Sequence diagram for updated Gofile folder contents fetchsequenceDiagram
participant Bot as BotDownloader
participant DLG as DirectLinkGenerator
participant Gofile as GofileAPI
Bot->>DLG: requestFolderLinks(folderId)
DLG->>DLG: time_slot = int(time) // 14400
DLG->>DLG: raw = user_agent::en-US::token::time_slot::gf2026x
DLG->>DLG: wt = sha256(raw)
DLG->>Gofile: GET /contents/{id}
activate Gofile
Note right of DLG: Headers
DLG-->>Gofile: User-Agent, Authorization Bearer token
DLG-->>Gofile: X-Website-Token = wt
DLG-->>Gofile: X-BL = en-US
Gofile-->>DLG: JSON folder contents
deactivate Gofile
DLG-->>Bot: directDownloadLinks
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The new
time_slot/wtcomputation introduces several magic constants (14400,gf2026x, locale string) and a specific format; consider extracting these into named constants or a small helper function with a brief comment so it’s clear what they represent and easier to adjust if the API changes again. - Since
time()is used directly to derive the website token, it might be safer to centralize time retrieval (e.g., via a helper or dependency-injected clock) to avoid inconsistencies in testing or in environments with skewed system time.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `time_slot` / `wt` computation introduces several magic constants (`14400`, `gf2026x`, locale string) and a specific format; consider extracting these into named constants or a small helper function with a brief comment so it’s clear what they represent and easier to adjust if the API changes again.
- Since `time()` is used directly to derive the website token, it might be safer to centralize time retrieval (e.g., via a helper or dependency-injected clock) to avoid inconsistencies in testing or in environments with skewed system time.
## Individual Comments
### Comment 1
<location path="bot/helper/mirror_leech_utils/download_utils/direct_link_generator.py" line_range="1231-1232" />
<code_context>
def __fetch_links(session, _id, folderPath="", retry=True):
_url = f"https://api.gofile.io/contents/{_id}?cache=true"
+ time_slot = int(time()) // 14400
+ raw = f"{user_agent}::en-US::{token}::{time_slot}::gf2026x"
+ wt = sha256(raw.encode()).hexdigest()
headers = {
</code_context>
<issue_to_address>
**suggestion:** Avoid duplicating the locale string literal to reduce potential for drift.
The string "en-US" now appears both in `raw` and in the `X-BL` header. To avoid inconsistencies if the locale ever changes or becomes configurable, extract it into a local variable (e.g. `locale = "en-US"`) and reference that in both places.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now upload fine
Summary by Sourcery
Bug Fixes: