Skip to content
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

Feature: Proxy #1

Open
1 task done
bropines opened this issue Nov 8, 2024 · 2 comments
Open
1 task done

Feature: Proxy #1

bropines opened this issue Nov 8, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@bropines
Copy link

bropines commented Nov 8, 2024

Type

Functionality

Issue

since the original author didn't want to, I want to ask you to add socks or http proxy support. I live in a very cool country where booru services are almost constantly being banned

Feature

Proxy

Additional context

No response

Acknowledgements

  • I have searched the existing issues and this is a new and no duplicate or related to another open issue.
@bropines bropines added the enhancement New feature or request label Nov 8, 2024
@Kropatz
Copy link
Owner

Kropatz commented Nov 10, 2024

Sure, can add that in the future.
Have never used one, but from doing some quick googling I'm a little bit surprised that android doesn't support a system wide proxy. Only on WiFi and apps can ignore it?

If you want to hardcode a proxy for the time being, something like this might work (haven't tested it though, copied the instructions from here)

diff --git a/lib/data/dio/app_dio.dart b/lib/data/dio/app_dio.dart
index 8e52faf..6bc7f1b 100644
--- a/lib/data/dio/app_dio.dart
+++ b/lib/data/dio/app_dio.dart
@@ -1,3 +1,5 @@
+import 'dart:io';
+
 import 'package:boorusphere/data/dio/headers_interceptor.dart';
 import 'package:boorusphere/domain/repository/env_repo.dart';
 import 'package:cookie_jar/cookie_jar.dart';
@@ -12,7 +14,14 @@ class AppDio with DioMixin implements Dio {
     required EnvRepo envRepo,
   }) {
     options = BaseOptions();
-    httpClientAdapter = IOHttpClientAdapter();
+    httpClientAdapter = IOHttpClientAdapter(createHttpClient: () {
+      final client = HttpClient();
+      client.findProxy = (uri) {
+        return 'PROXY localhost:8888';
+      };
+      client.addProxyCredentials("localhost", 8888, '', HttpClientBasicCredentials('username', 'password'));
+      return client;
+    });
     final retryDelays = List.generate(5, (index) {
       return Duration(milliseconds: 400 + (100 * (index + 1)));
     });

@bropines
Copy link
Author

even though it seems to me that hardcoding a proxy would not be the best idea. these are all methods, how can I add a proxy? In my understanding It would be normal like this

Screenshot_2024-11-10-17-09-39-155_com hippo ehviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants