mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-25 11:53:45 +02:00
Merge pull request #1411 from akramer-zibra/fix-gitlab-request-headers
Solve issues with gitlab .apk files and cloudflare protection
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:html/parser.dart';
|
import 'package:html/parser.dart';
|
||||||
@@ -104,6 +105,21 @@ class GitLab extends AppSource {
|
|||||||
String? changeLogPageFromStandardUrl(String standardUrl) =>
|
String? changeLogPageFromStandardUrl(String standardUrl) =>
|
||||||
'$standardUrl/-/releases';
|
'$standardUrl/-/releases';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Map<String, String>?> getRequestHeaders(
|
||||||
|
Map<String, dynamic> additionalSettings,
|
||||||
|
{bool forAPKDownload = false}) async {
|
||||||
|
// Change headers to pacify, e.g. cloudflare protection
|
||||||
|
// Related to: (#1397, #1389, #1384, #1382, #1381, #1380, #1359, #854, #785, #697)
|
||||||
|
var headers = <String, String>{};
|
||||||
|
headers[HttpHeaders.refererHeader] = 'https://${hosts[0]}';
|
||||||
|
if (headers.isNotEmpty) {
|
||||||
|
return headers;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<APKDetails> getLatestAPKDetails(
|
Future<APKDetails> getLatestAPKDetails(
|
||||||
String standardUrl,
|
String standardUrl,
|
||||||
|
|||||||
Reference in New Issue
Block a user