mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-22 17:19:42 +02:00
@@ -34,23 +34,39 @@ class FDroid implements AppSource {
|
|||||||
String standardUrl, List<String> additionalData) async {
|
String standardUrl, List<String> additionalData) async {
|
||||||
Response res = await get(Uri.parse(standardUrl));
|
Response res = await get(Uri.parse(standardUrl));
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
var latestReleaseDiv =
|
var releases = parse(res.body).querySelectorAll('.package-version');
|
||||||
parse(res.body).querySelector('#latest.package-version');
|
if (releases.isEmpty) {
|
||||||
var apkUrl = latestReleaseDiv
|
throw couldNotFindReleases;
|
||||||
?.querySelector('.package-version-download a')
|
|
||||||
?.attributes['href'];
|
|
||||||
if (apkUrl == null) {
|
|
||||||
throw noAPKFound;
|
|
||||||
}
|
}
|
||||||
var version = latestReleaseDiv
|
String? latestVersion = releases[0]
|
||||||
?.querySelector('.package-version-header b')
|
.querySelector('.package-version-header b')
|
||||||
?.innerHtml
|
?.innerHtml
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.last;
|
.sublist(1)
|
||||||
if (version == null) {
|
.join(' ');
|
||||||
|
if (latestVersion == null) {
|
||||||
throw couldNotFindLatestVersion;
|
throw couldNotFindLatestVersion;
|
||||||
}
|
}
|
||||||
return APKDetails(version, [apkUrl]);
|
List<String> apkUrls = releases
|
||||||
|
.where((element) =>
|
||||||
|
element
|
||||||
|
.querySelector('.package-version-header b')
|
||||||
|
?.innerHtml
|
||||||
|
.split(' ')
|
||||||
|
.sublist(1)
|
||||||
|
.join(' ') ==
|
||||||
|
latestVersion)
|
||||||
|
.map((e) =>
|
||||||
|
e
|
||||||
|
.querySelector('.package-version-download a')
|
||||||
|
?.attributes['href'] ??
|
||||||
|
'')
|
||||||
|
.where((element) => element.isNotEmpty)
|
||||||
|
.toList();
|
||||||
|
if (apkUrls.isEmpty) {
|
||||||
|
throw noAPKFound;
|
||||||
|
}
|
||||||
|
return APKDetails(latestVersion, apkUrls);
|
||||||
} else {
|
} else {
|
||||||
throw couldNotFindReleases;
|
throw couldNotFindReleases;
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ import 'package:workmanager/workmanager.dart';
|
|||||||
import 'package:dynamic_color/dynamic_color.dart';
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
|
||||||
const String currentVersion = '0.6.1';
|
const String currentVersion = '0.6.2';
|
||||||
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
|
||||||
|
|
||||||
|
@@ -154,7 +154,8 @@ class _AddAppPageState extends State<AddAppPage> {
|
|||||||
child: const Text('Add'))
|
child: const Text('Add'))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (pickedSource != null)
|
if (pickedSource != null &&
|
||||||
|
pickedSource!.additionalDataDefaults.isNotEmpty)
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
|
@@ -104,6 +104,11 @@ preStandardizeUrl(String url) {
|
|||||||
if (url.toLowerCase().indexOf('https://www.') == 0) {
|
if (url.toLowerCase().indexOf('https://www.') == 0) {
|
||||||
url = 'https://${url.substring(12)}';
|
url = 'https://${url.substring(12)}';
|
||||||
}
|
}
|
||||||
|
url = url
|
||||||
|
.split('/')
|
||||||
|
.where((e) => e.isNotEmpty)
|
||||||
|
.join('/')
|
||||||
|
.replaceFirst(':/', '://');
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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.6.1+45 # When changing this, update the tag in main() accordingly
|
version: 0.6.2+46 # When changing this, update the tag in main() accordingly
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.18.2 <3.0.0'
|
sdk: '>=2.18.2 <3.0.0'
|
||||||
|
Reference in New Issue
Block a user