mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-22 10:23:45 +02:00
Add 'sky22333/hubproxy' support for GitHub (#2513)
This commit is contained in:
@@ -606,10 +606,20 @@ class AppsProvider with ChangeNotifier {
|
||||
app.url,
|
||||
overrideSource: app.overrideSource,
|
||||
);
|
||||
String downloadUrl = await source.apkUrlPrefetchModifier(
|
||||
app.apkUrls[app.preferredApkIndex].value,
|
||||
var additionalSettingsPlusSourceConfig = {
|
||||
...app.additionalSettings,
|
||||
...(await source.getSourceConfigValues(
|
||||
app.additionalSettings,
|
||||
settingsProvider,
|
||||
)),
|
||||
};
|
||||
String downloadUrl = await source.assetUrlPrefetchModifier(
|
||||
await source.generalReqPrefetchModifier(
|
||||
app.apkUrls[app.preferredApkIndex].value,
|
||||
additionalSettingsPlusSourceConfig,
|
||||
),
|
||||
app.url,
|
||||
app.additionalSettings,
|
||||
additionalSettingsPlusSourceConfig,
|
||||
);
|
||||
var notif = DownloadNotification(app.finalName, 100);
|
||||
notificationsProvider?.cancel(notif.id);
|
||||
@@ -1324,15 +1334,26 @@ class AppsProvider with ChangeNotifier {
|
||||
evenIfSingleChoice: true,
|
||||
);
|
||||
if (tempFileUrl != null) {
|
||||
var s = SourceProvider().getSource(
|
||||
apps[id]!.app.url,
|
||||
overrideSource: apps[id]!.app.overrideSource,
|
||||
);
|
||||
var additionalSettingsPlusSourceConfig = {
|
||||
...apps[id]!.app.additionalSettings,
|
||||
...(await s.getSourceConfigValues(
|
||||
apps[id]!.app.additionalSettings,
|
||||
settingsProvider,
|
||||
)),
|
||||
};
|
||||
fileUrl = MapEntry(
|
||||
tempFileUrl.key,
|
||||
await (SourceProvider().getSource(
|
||||
await s.assetUrlPrefetchModifier(
|
||||
await s.generalReqPrefetchModifier(
|
||||
tempFileUrl.value,
|
||||
additionalSettingsPlusSourceConfig,
|
||||
),
|
||||
apps[id]!.app.url,
|
||||
overrideSource: apps[id]!.app.overrideSource,
|
||||
)).apkUrlPrefetchModifier(
|
||||
tempFileUrl.value,
|
||||
apps[id]!.app.url,
|
||||
apps[id]!.app.additionalSettings,
|
||||
additionalSettingsPlusSourceConfig,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@@ -249,6 +249,15 @@ class SettingsProvider with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool? getSettingBool(String settingId) {
|
||||
return prefs?.getBool(settingId) ?? false;
|
||||
}
|
||||
|
||||
void setSettingBool(String settingId, bool value) {
|
||||
prefs?.setBool(settingId, value);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Map<String, int> get categories =>
|
||||
Map<String, int>.from(jsonDecode(prefs?.getString('categories') ?? '{}'));
|
||||
|
||||
|
@@ -686,14 +686,27 @@ abstract class AppSource {
|
||||
bool followRedirects = true,
|
||||
Object? postBody,
|
||||
}) async {
|
||||
var sp = SettingsProvider();
|
||||
await sp.initializeSettings();
|
||||
getSourceConfigValues(additionalSettings, sp);
|
||||
var additionalSettingsPlusSourceConfig = {
|
||||
...additionalSettings,
|
||||
...(await getSourceConfigValues(additionalSettings, sp)),
|
||||
};
|
||||
url = await generalReqPrefetchModifier(
|
||||
url,
|
||||
additionalSettingsPlusSourceConfig,
|
||||
);
|
||||
var method = postBody == null ? 'GET' : 'POST';
|
||||
var requestHeaders = await getRequestHeaders(additionalSettings);
|
||||
var requestHeaders = await getRequestHeaders(
|
||||
additionalSettingsPlusSourceConfig,
|
||||
);
|
||||
var streamedResponseUrlWithResponseAndClient =
|
||||
await sourceRequestStreamResponse(
|
||||
method,
|
||||
url,
|
||||
requestHeaders,
|
||||
additionalSettings,
|
||||
additionalSettingsPlusSourceConfig,
|
||||
followRedirects: followRedirects,
|
||||
postBody: postBody,
|
||||
);
|
||||
@@ -911,12 +924,19 @@ abstract class AppSource {
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<String> apkUrlPrefetchModifier(
|
||||
String apkUrl,
|
||||
Future<String> assetUrlPrefetchModifier(
|
||||
String assetUrl,
|
||||
String standardUrl,
|
||||
Map<String, dynamic> additionalSettings,
|
||||
) async {
|
||||
return apkUrl;
|
||||
return assetUrl;
|
||||
}
|
||||
|
||||
Future<String> generalReqPrefetchModifier(
|
||||
String reqUrl,
|
||||
Map<String, dynamic> additionalSettings,
|
||||
) async {
|
||||
return reqUrl;
|
||||
}
|
||||
|
||||
bool canSearch = false;
|
||||
|
Reference in New Issue
Block a user