mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-24 03:13:45 +02:00
Merge pull request #1166 from ImranR98/dev
- Get real author name for F-Droid (#1076) - Always add Track-only apps with random ID (#1138) - Minor UI fix (#1162) - Fix 'verify latest' option for GitHub (#1163)
This commit is contained in:
@@ -65,7 +65,7 @@ class FDroid extends AppSource {
|
|||||||
) async {
|
) async {
|
||||||
String? appId = await tryInferringAppId(standardUrl);
|
String? appId = await tryInferringAppId(standardUrl);
|
||||||
String host = Uri.parse(standardUrl).host;
|
String host = Uri.parse(standardUrl).host;
|
||||||
return getAPKUrlsFromFDroidPackagesAPIResponse(
|
var details = getAPKUrlsFromFDroidPackagesAPIResponse(
|
||||||
await sourceRequest('https://$host/api/v1/packages/$appId'),
|
await sourceRequest('https://$host/api/v1/packages/$appId'),
|
||||||
'https://$host/repo/$appId',
|
'https://$host/repo/$appId',
|
||||||
standardUrl,
|
standardUrl,
|
||||||
@@ -80,6 +80,23 @@ class FDroid extends AppSource {
|
|||||||
true
|
true
|
||||||
? additionalSettings['filterVersionsByRegEx']
|
? additionalSettings['filterVersionsByRegEx']
|
||||||
: null);
|
: null);
|
||||||
|
if (!hostChanged) {
|
||||||
|
try {
|
||||||
|
var res = await sourceRequest(
|
||||||
|
'https://gitlab.com/fdroid/fdroiddata/-/raw/master/metadata/$appId.yml');
|
||||||
|
String author = res.body
|
||||||
|
.split('\n')
|
||||||
|
.where((l) => l.startsWith('AuthorName: '))
|
||||||
|
.first
|
||||||
|
.split(': ')
|
||||||
|
.sublist(1)
|
||||||
|
.join(': ');
|
||||||
|
details.names.author = author;
|
||||||
|
} catch (e) {
|
||||||
|
// Fail silently
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -111,7 +128,6 @@ class FDroid extends AppSource {
|
|||||||
throw getObtainiumHttpError(res);
|
throw getObtainiumHttpError(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
APKDetails getAPKUrlsFromFDroidPackagesAPIResponse(
|
APKDetails getAPKUrlsFromFDroidPackagesAPIResponse(
|
||||||
Response res, String apkUrlPrefix, String standardUrl, String sourceName,
|
Response res, String apkUrlPrefix, String standardUrl, String sourceName,
|
||||||
@@ -187,3 +203,4 @@ APKDetails getAPKUrlsFromFDroidPackagesAPIResponse(
|
|||||||
throw getObtainiumHttpError(res);
|
throw getObtainiumHttpError(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class GitHub extends AppSource {
|
|||||||
bool verifyLatestTag = additionalSettings['verifyLatestTag'] == true;
|
bool verifyLatestTag = additionalSettings['verifyLatestTag'] == true;
|
||||||
bool dontSortReleasesList =
|
bool dontSortReleasesList =
|
||||||
additionalSettings['dontSortReleasesList'] == true;
|
additionalSettings['dontSortReleasesList'] == true;
|
||||||
String? latestTag;
|
dynamic latestRelease;
|
||||||
if (verifyLatestTag) {
|
if (verifyLatestTag) {
|
||||||
var temp = requestUrl.split('?');
|
var temp = requestUrl.split('?');
|
||||||
Response res = await sourceRequest(
|
Response res = await sourceRequest(
|
||||||
@@ -245,12 +245,20 @@ class GitHub extends AppSource {
|
|||||||
}
|
}
|
||||||
throw getObtainiumHttpError(res);
|
throw getObtainiumHttpError(res);
|
||||||
}
|
}
|
||||||
var jsres = jsonDecode(res.body);
|
latestRelease = jsonDecode(res.body);
|
||||||
latestTag = jsres['tag_name'] ?? jsres['name'];
|
|
||||||
}
|
}
|
||||||
Response res = await sourceRequest(requestUrl);
|
Response res = await sourceRequest(requestUrl);
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
var releases = jsonDecode(res.body) as List<dynamic>;
|
var releases = jsonDecode(res.body) as List<dynamic>;
|
||||||
|
if (latestRelease != null) {
|
||||||
|
var latestTag = latestRelease['tag_name'] ?? latestRelease['name'];
|
||||||
|
if (releases
|
||||||
|
.where((element) =>
|
||||||
|
(element['tag_name'] ?? element['name']) == latestTag)
|
||||||
|
.isEmpty) {
|
||||||
|
releases = [latestRelease, ...releases];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<MapEntry<String, String>> getReleaseAPKUrls(dynamic release) =>
|
List<MapEntry<String, String>> getReleaseAPKUrls(dynamic release) =>
|
||||||
(release['assets'] as List<dynamic>?)
|
(release['assets'] as List<dynamic>?)
|
||||||
@@ -299,13 +307,13 @@ class GitHub extends AppSource {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (latestTag != null &&
|
if (latestRelease != null &&
|
||||||
releases.isNotEmpty &&
|
releases.isNotEmpty &&
|
||||||
latestTag !=
|
latestRelease !=
|
||||||
(releases[releases.length - 1]['tag_name'] ??
|
(releases[releases.length - 1]['tag_name'] ??
|
||||||
releases[0]['name'])) {
|
releases[0]['name'])) {
|
||||||
var ind = releases.indexWhere(
|
var ind = releases.indexWhere((element) =>
|
||||||
(element) => latestTag == (element['tag_name'] ?? element['name']));
|
latestRelease == (element['tag_name'] ?? element['name']));
|
||||||
if (ind >= 0) {
|
if (ind >= 0) {
|
||||||
releases.add(releases.removeAt(ind));
|
releases.add(releases.removeAt(ind));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class IzzyOnDroid extends AppSource {
|
|||||||
Map<String, dynamic> additionalSettings,
|
Map<String, dynamic> additionalSettings,
|
||||||
) async {
|
) async {
|
||||||
String? appId = await tryInferringAppId(standardUrl);
|
String? appId = await tryInferringAppId(standardUrl);
|
||||||
return getAPKUrlsFromFDroidPackagesAPIResponse(
|
return fd.getAPKUrlsFromFDroidPackagesAPIResponse(
|
||||||
await sourceRequest(
|
await sourceRequest(
|
||||||
'https://apt.izzysoft.de/fdroid/api/v1/packages/$appId'),
|
'https://apt.izzysoft.de/fdroid/api/v1/packages/$appId'),
|
||||||
'https://android.izzysoft.de/frepo/$appId',
|
'https://android.izzysoft.de/frepo/$appId',
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
|
|||||||
// ignore: implementation_imports
|
// ignore: implementation_imports
|
||||||
import 'package:easy_localization/src/localization.dart';
|
import 'package:easy_localization/src/localization.dart';
|
||||||
|
|
||||||
const String currentVersion = '0.14.37';
|
const String currentVersion = '0.14.38';
|
||||||
const String currentReleaseTag =
|
const String currentReleaseTag =
|
||||||
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||||
|
|
||||||
|
|||||||
@@ -347,7 +347,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
: () {
|
: () {
|
||||||
runObtainiumExport(pickOnly: true);
|
runObtainiumExport(pickOnly: true);
|
||||||
},
|
},
|
||||||
child: Text(tr('pickExportDir')),
|
child: Text(tr('pickExportDir'),
|
||||||
|
textAlign: TextAlign.center),
|
||||||
)),
|
)),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 16,
|
width: 16,
|
||||||
@@ -360,7 +361,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
snapshot.data == null
|
snapshot.data == null
|
||||||
? null
|
? null
|
||||||
: runObtainiumExport,
|
: runObtainiumExport,
|
||||||
child: Text(tr('obtainiumExport')),
|
child: Text(tr('obtainiumExport'),
|
||||||
|
textAlign: TextAlign.center),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -375,7 +377,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
onPressed: importInProgress
|
onPressed: importInProgress
|
||||||
? null
|
? null
|
||||||
: runObtainiumImport,
|
: runObtainiumImport,
|
||||||
child: Text(tr('obtainiumImport')))),
|
child: Text(tr('obtainiumImport'),
|
||||||
|
textAlign: TextAlign.center))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (snapshot.data != null)
|
if (snapshot.data != null)
|
||||||
|
|||||||
@@ -1230,7 +1230,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
|
|
||||||
Future<MapEntry<int, bool>> import(String appsJSON) async {
|
Future<MapEntry<int, bool>> import(String appsJSON) async {
|
||||||
var decodedJSON = jsonDecode(appsJSON);
|
var decodedJSON = jsonDecode(appsJSON);
|
||||||
var newFormat = !(decodedJSON is List);
|
var newFormat = decodedJSON is! List;
|
||||||
List<App> importedApps =
|
List<App> importedApps =
|
||||||
((newFormat ? decodedJSON['apps'] : decodedJSON) as List<dynamic>)
|
((newFormat ? decodedJSON['apps'] : decodedJSON) as List<dynamic>)
|
||||||
.map((e) => App.fromJson(e))
|
.map((e) => App.fromJson(e))
|
||||||
|
|||||||
@@ -684,7 +684,8 @@ class SourceProvider {
|
|||||||
name = name.isNotEmpty ? name : apk.names.name;
|
name = name.isNotEmpty ? name : apk.names.name;
|
||||||
App finalApp = App(
|
App finalApp = App(
|
||||||
currentApp?.id ??
|
currentApp?.id ??
|
||||||
((!source.appIdInferIsOptional ||
|
(!trackOnly &&
|
||||||
|
(!source.appIdInferIsOptional ||
|
||||||
(source.appIdInferIsOptional && inferAppIdIfOptional))
|
(source.appIdInferIsOptional && inferAppIdIfOptional))
|
||||||
? await source.tryInferringAppId(standardUrl,
|
? await source.tryInferringAppId(standardUrl,
|
||||||
additionalSettings: additionalSettings)
|
additionalSettings: additionalSettings)
|
||||||
@@ -705,8 +706,9 @@ class SourceProvider {
|
|||||||
changeLog: apk.changeLog,
|
changeLog: apk.changeLog,
|
||||||
overrideSource: overrideSource ?? currentApp?.overrideSource,
|
overrideSource: overrideSource ?? currentApp?.overrideSource,
|
||||||
allowIdChange: currentApp?.allowIdChange ??
|
allowIdChange: currentApp?.allowIdChange ??
|
||||||
source.appIdInferIsOptional &&
|
trackOnly ||
|
||||||
inferAppIdIfOptional // Optional ID inferring may be incorrect - allow correction on first install
|
(source.appIdInferIsOptional &&
|
||||||
|
inferAppIdIfOptional) // Optional ID inferring may be incorrect - allow correction on first install
|
||||||
);
|
);
|
||||||
return source.endOfGetAppChanges(finalApp);
|
return source.endOfGetAppChanges(finalApp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -783,10 +783,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: synchronized
|
name: synchronized
|
||||||
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
|
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.0+1"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 0.14.37+231 # When changing this, update the tag in main() accordingly
|
version: 0.14.38+232 # When changing this, update the tag in main() accordingly
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.0 <4.0.0'
|
sdk: '>=3.0.0 <4.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user