mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 20:57:36 +02:00
Support Gitea repositories (#570)
This commit is contained in:
@ -28,10 +28,10 @@ class GithubAPI {
|
||||
'com.spotify.music': 'spotify',
|
||||
};
|
||||
|
||||
void initialize() async {
|
||||
void initialize(String repoUrl) async {
|
||||
try {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: 'https://api.github.com',
|
||||
baseUrl: repoUrl,
|
||||
));
|
||||
|
||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||
@ -54,10 +54,10 @@ class GithubAPI {
|
||||
Future<Map<String, dynamic>?> getLatestRelease(String repoName) async {
|
||||
try {
|
||||
var response = await _dio.get(
|
||||
'/repos/$repoName/releases/latest',
|
||||
'/repos/$repoName/releases',
|
||||
options: _cacheOptions,
|
||||
);
|
||||
return response.data;
|
||||
return response.data[0];
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
|
@ -23,6 +23,7 @@ class ManagerAPI {
|
||||
late String storedPatchesFile = '/selected-patches.json';
|
||||
late SharedPreferences _prefs;
|
||||
String defaultApiUrl = 'https://releases.revanced.app/';
|
||||
String defaultRepoUrl = 'https://api.github.com';
|
||||
String defaultPatcherRepo = 'revanced/revanced-patcher';
|
||||
String defaultPatchesRepo = 'revanced/revanced-patches';
|
||||
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
|
||||
@ -48,6 +49,17 @@ class ManagerAPI {
|
||||
await _prefs.setString('apiUrl', url);
|
||||
}
|
||||
|
||||
String getRepoUrl() {
|
||||
return _prefs.getString('repoUrl') ?? defaultRepoUrl;
|
||||
}
|
||||
|
||||
Future<void> setRepoUrl(String url) async {
|
||||
if (url.isEmpty || url == ' ') {
|
||||
url = defaultRepoUrl;
|
||||
}
|
||||
await _prefs.setString('repoUrl', url);
|
||||
}
|
||||
|
||||
String getPatchesRepo() {
|
||||
return _prefs.getString('patchesRepo') ?? defaultPatchesRepo;
|
||||
}
|
||||
|
Reference in New Issue
Block a user