mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-12 13:35:37 +02:00
fix: Improve API URL handling and force init after setting a new config
This commit is contained in:
parent
c333fa3c33
commit
6c2ceed91f
4 changed files with 26 additions and 56 deletions
|
@ -9,8 +9,7 @@ import 'package:revanced_manager/models/patch.dart';
|
|||
|
||||
@lazySingleton
|
||||
class GithubAPI {
|
||||
final String apiUrl = 'https://api.github.com';
|
||||
final Dio _dio = Dio();
|
||||
final Dio _dio = Dio(BaseOptions(baseUrl: 'https://api.github.com'));
|
||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||
final Options _cacheOptions = buildCacheOptions(
|
||||
const Duration(days: 1),
|
||||
|
@ -37,7 +36,7 @@ class GithubAPI {
|
|||
Future<Map<String, dynamic>?> _getLatestRelease(String repoName) async {
|
||||
try {
|
||||
var response = await _dio.get(
|
||||
'$apiUrl/repos/$repoName/releases/latest',
|
||||
'/repos/$repoName/releases/latest',
|
||||
options: _cacheOptions,
|
||||
);
|
||||
return response.data;
|
||||
|
@ -55,7 +54,7 @@ class GithubAPI {
|
|||
'src/main/kotlin/app/revanced/patches/${repoAppPath[packageName]}';
|
||||
try {
|
||||
var response = await _dio.get(
|
||||
'$apiUrl/repos/$repoName/commits',
|
||||
'/repos/$repoName/commits',
|
||||
queryParameters: {
|
||||
'path': path,
|
||||
'per_page': 3,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue