Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

fix: Add User-Agent header to fix CDN blockage #155

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

makisukurisu
Copy link
Contributor

This pull request addresses the issue #150, by replacing a default User-Agent header from FlutterDownloader to a custom one.

This effect can also be achieved, as described in #150, by simply removing this header altogether, however I have not tried to do this.

I can provide a screenshot of the app interface with working downloads, as well as console output:
Downloads screenshot
Console screenshot

Feel free to change the user agent, discard other alterations, or just ditch this change in favor of some other edit.

@makisukurisu
Copy link
Contributor Author

Note:
If you try to restart older download tasks, they will still fail, I assume because headers are also saved in the database, so retrying the task sends the same request.

Comment on lines +4 to +5
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visual Studio Code did this by itself:
image

Comment on lines +42 to +43
headers: {'User-Agent': 'Boorusphere/1.4.3'},
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some packages were updated automatically

file_picker: ^5.2.3
flutter_cache_manager: ^3.0.0-nullsafety.1
flutter_displaymode: ^0.6.0
flutter_downloader: ^1.9.0
flutter_downloader: ^1.10.4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped this requirement because app build was getting crazy. Perhaps it's not required.

But I got an error saying that Enumerator was somehow invalid.

@@ -81,6 +80,7 @@ dependencies:
wakelock: ^0.6.2
xml2json: ^6.0.0
yaml: ^3.1.0
extended_image: ^8.2.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, I've got build errors for no fault of mine, reinstalling this dependency resolved the issue.

@nullxception
Copy link
Owner

Thank you so much 😭

@nullxception nullxception merged commit 7c80b72 into nullxception:main Jul 5, 2024
1 check failed
@nullxception nullxception mentioned this pull request Jul 5, 2024
3 tasks
@makisukurisu makisukurisu deleted the danbooru_downloads branch July 6, 2024 08:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants