mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-13 13:26:43 +02:00
Use public GitLab search API (#1147)
This commit is contained in:
@ -48,12 +48,6 @@ class GitLab extends AppSource {
|
||||
label: tr('fallbackToOlderReleases'), defaultValue: true)
|
||||
]
|
||||
];
|
||||
searchQuerySettingFormItems = [
|
||||
GeneratedFormTextField('PAT',
|
||||
label: tr('gitlabPATLabel').split('(')[0],
|
||||
password: true,
|
||||
required: false)
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
@ -86,18 +80,8 @@ class GitLab extends AppSource {
|
||||
@override
|
||||
Future<Map<String, List<String>>> search(String query,
|
||||
{Map<String, dynamic> querySettings = const {}}) async {
|
||||
String? PAT;
|
||||
if (!hostChanged) {
|
||||
PAT = await getPATIfAny({});
|
||||
if (PAT == null) {
|
||||
throw CredsNeededError(name);
|
||||
}
|
||||
}
|
||||
if ((querySettings['PAT'] as String?)?.isNotEmpty == true) {
|
||||
PAT = querySettings['PAT'];
|
||||
}
|
||||
var url =
|
||||
'https://$host/api/v4/search?${PAT?.isNotEmpty == true ? 'private_token=$PAT&' : ''}scope=projects&search=${Uri.encodeQueryComponent(query)}';
|
||||
'https://$host/api/v4/projects?search=${Uri.encodeQueryComponent(query)}';
|
||||
var res = await sourceRequest(url);
|
||||
if (res.statusCode != 200) {
|
||||
throw getObtainiumHttpError(res);
|
||||
|
Reference in New Issue
Block a user