Files
Obtainium/lib/app_sources/codeberg.dart
Imran Remtulla 6e2c2c592c fix: resolve bugs, dead code, unsafe patterns, and infrastructure issues
HIGH severity:
- Fix Completer double-completion masking CheckUpdatesException as StateError
- Delete orphaned APK files on install-already-pending status code
- Stop transient source-load errors from permanently deleting user app entries
- Await saveApps in setCategories to avoid data inconsistency
- Guard packageManager.openApp double-tap behind installed check
- Fix hashCode.abs() overflow on min int value in DownloadNotification

MEDIUM severity:
- Wrap checkETagHeader client.send in try/finally to prevent resource leak
- Remove unused loadingCompleter dead code in loadApps
- Pass additionalSettings (not {}) in apkcombo sourceRequest call
- Remove dead getRequestHeaders call in coolapk
- Add missing == true on boolean setting checks in fdroidrepo
- Zero-pad month/day in itchio date version string
- Deep-copy form items by value in izzyondroid and codeberg constructors
- Remove redundant double-reverse for sort=none in github release sorting
- Clamp negative gradient stop to valid range in app_list_tile
- Show WebView error state when main frame resource fails to load
- Defer WebView appId changes until page load completes
- Defer category pruning side effect out of build into post-frame callback
- Expand URL regex in import_export to match whitespace-delimited URLs
- Remove future-update-in-build side effect for source notes in add_app
- Add items hash to form reinit check alongside widget key

LOW severity:
- Add 'name' field to all 11 AppSource subclasses that lacked it
- Remove unused source_provider imports from app_detail_widgets, category_editor
- Rename copy-pasted bool show param to bool value on non-show setter pairs
- Delete dead proguard-rules.pro (Gson is not a dependency)
- Remove npm package files from git tracking in assets/translations
- Fix DEVELOPER_GUIDE test directory reference
2026-07-02 14:38:17 +01:00

69 lines
1.9 KiB
Dart

import 'package:obtainium/app_sources/github.dart';
import 'package:obtainium/components/generated_form_model.dart';
import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/providers/source_provider.dart';
class Codeberg extends AppSource {
final GitHub _gh = GitHub(hostChanged: true);
Codeberg() {
name = 'Forgejo (Codeberg)';
hosts = ['codeberg.org'];
additionalSourceAppSpecificSettingFormItems =
List<List<GeneratedFormItem>>.from(_gh.additionalSourceAppSpecificSettingFormItems);
canSearch = true;
searchQuerySettingFormItems = _gh.searchQuerySettingFormItems;
}
@override
String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) {
return standardizeUrlWithRegex(
url,
subdomainPrefix: r'(www\.)?',
pathPattern: r'/[^/]+/[^/]+',
);
}
@override
String? changeLogPageFromStandardUrl(String standardUrl) =>
'$standardUrl/releases';
@override
Future<APKDetails> getLatestAPKDetails(
String standardUrl,
Map<String, dynamic> additionalSettings,
) async {
try {
return await _gh.fetchReleaseDetailsWithTagFallback(
standardUrl,
additionalSettings,
(bool useTagUrl) async {
final standardUri = Uri.parse(standardUrl);
final apiPath =
'/api/v1/repos${standardUri.path}/${useTagUrl ? 'tags' : 'releases'}';
return standardUri
.replace(path: apiPath, queryParameters: {'per_page': '100'})
.toString();
},
null,
);
} catch (e) {
rethrowOrWrapError(e);
}
}
@override
Future<Map<String, List<String>>> search(
String query, {
Map<String, dynamic> querySettings = const {},
}) async {
return _gh.searchCommon(
query,
'https://${hosts[0]}/api/v1/repos/search?q=${Uri.encodeQueryComponent(query)}&limit=100',
'data',
querySettings: querySettings,
);
}
}