mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-15 11:28:10 +02:00
Stop accidentally sharing GitHub/GitLab PATs with Codeberg, Mullvad (#2423)
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:obtainium/custom_errors.dart';
|
|||||||
import 'package:obtainium/providers/source_provider.dart';
|
import 'package:obtainium/providers/source_provider.dart';
|
||||||
|
|
||||||
class Codeberg extends AppSource {
|
class Codeberg extends AppSource {
|
||||||
GitHub gh = GitHub();
|
GitHub gh = GitHub(hostChanged: true);
|
||||||
Codeberg() {
|
Codeberg() {
|
||||||
name = 'Forgejo (Codeberg)';
|
name = 'Forgejo (Codeberg)';
|
||||||
hosts = ['codeberg.org'];
|
hosts = ['codeberg.org'];
|
||||||
|
@@ -112,13 +112,17 @@ class FDroid extends AppSource {
|
|||||||
bool isGitHub = false;
|
bool isGitHub = false;
|
||||||
bool isGitLab = false;
|
bool isGitLab = false;
|
||||||
try {
|
try {
|
||||||
GitHub().sourceSpecificStandardizeURL(details.changeLog!);
|
GitHub(
|
||||||
|
hostChanged: true,
|
||||||
|
).sourceSpecificStandardizeURL(details.changeLog!);
|
||||||
isGitHub = true;
|
isGitHub = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
GitLab().sourceSpecificStandardizeURL(details.changeLog!);
|
GitLab(
|
||||||
|
hostChanged: true,
|
||||||
|
).sourceSpecificStandardizeURL(details.changeLog!);
|
||||||
isGitLab = true;
|
isGitLab = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//
|
//
|
||||||
|
@@ -13,10 +13,11 @@ import 'package:obtainium/providers/source_provider.dart';
|
|||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
class GitHub extends AppSource {
|
class GitHub extends AppSource {
|
||||||
GitHub() {
|
GitHub({hostChanged = false}) {
|
||||||
hosts = ['github.com'];
|
hosts = ['github.com'];
|
||||||
appIdInferIsOptional = true;
|
appIdInferIsOptional = true;
|
||||||
showReleaseDateAsVersionToggle = true;
|
showReleaseDateAsVersionToggle = true;
|
||||||
|
this.hostChanged = hostChanged;
|
||||||
|
|
||||||
sourceConfigSettingFormItems = [
|
sourceConfigSettingFormItems = [
|
||||||
GeneratedFormTextField(
|
GeneratedFormTextField(
|
||||||
|
@@ -12,10 +12,11 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
class GitLab extends AppSource {
|
class GitLab extends AppSource {
|
||||||
GitLab() {
|
GitLab({bool hostChanged = false}) {
|
||||||
hosts = ['gitlab.com'];
|
hosts = ['gitlab.com'];
|
||||||
canSearch = true;
|
canSearch = true;
|
||||||
showReleaseDateAsVersionToggle = true;
|
showReleaseDateAsVersionToggle = true;
|
||||||
|
this.hostChanged = hostChanged;
|
||||||
|
|
||||||
sourceConfigSettingFormItems = [
|
sourceConfigSettingFormItems = [
|
||||||
GeneratedFormTextField(
|
GeneratedFormTextField(
|
||||||
@@ -144,7 +145,7 @@ class GitLab extends AppSource {
|
|||||||
Map<String, dynamic> additionalSettings,
|
Map<String, dynamic> additionalSettings,
|
||||||
) async {
|
) async {
|
||||||
// Prepare request params
|
// Prepare request params
|
||||||
var names = GitHub().getAppNames(standardUrl);
|
var names = GitHub(hostChanged: true).getAppNames(standardUrl);
|
||||||
String projectUriComponent =
|
String projectUriComponent =
|
||||||
'${Uri.encodeComponent(names.author)}%2F${Uri.encodeComponent(names.name)}';
|
'${Uri.encodeComponent(names.author)}%2F${Uri.encodeComponent(names.name)}';
|
||||||
String? PAT = await getPATIfAny(hostChanged ? additionalSettings : {});
|
String? PAT = await getPATIfAny(hostChanged ? additionalSettings : {});
|
||||||
|
@@ -55,7 +55,7 @@ class Mullvad extends AppSource {
|
|||||||
}
|
}
|
||||||
String? changeLog;
|
String? changeLog;
|
||||||
try {
|
try {
|
||||||
changeLog = (await GitHub().getLatestAPKDetails(
|
changeLog = (await GitHub(hostChanged: true).getLatestAPKDetails(
|
||||||
'https://github.com/mullvad/mullvadvpn-app',
|
'https://github.com/mullvad/mullvadvpn-app',
|
||||||
{'fallbackToOlderReleases': true},
|
{'fallbackToOlderReleases': true},
|
||||||
)).changeLog;
|
)).changeLog;
|
||||||
|
Reference in New Issue
Block a user