- Introduced a new Flutter project for the cxyz Android manga/comic reader, including essential files such as pubspec.yaml, AndroidManifest.xml, and Gradle configuration. - Added .gitignore files to exclude unnecessary files and directories for both the main project and Android-specific files. - Implemented initial README.md with project description, features, setup instructions, and API details for ComicLand, MangaRead, and MangaTown. - Configured analysis options and dependencies in pubspec.yaml to support Flutter development. - Established a pnpm workspace and lockfile for dependency management. - Included various Android resources such as icons, styles, and launch backgrounds for a complete application setup.
32 lines
916 B
Dart
32 lines
916 B
Dart
import 'package:flutter/painting.dart';
|
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
|
|
|
/// Cache manager that attaches ComicLand CDN Referer/Origin headers.
|
|
class HeaderCacheManager extends CacheManager {
|
|
HeaderCacheManager(this.headers)
|
|
: super(
|
|
Config(
|
|
'cxyzHeaderCache',
|
|
fileService: _HeaderHttpFileService(headers),
|
|
),
|
|
);
|
|
|
|
final Map<String, String> headers;
|
|
}
|
|
|
|
class _HeaderHttpFileService extends HttpFileService {
|
|
_HeaderHttpFileService(this.headers);
|
|
|
|
final Map<String, String> headers;
|
|
|
|
@override
|
|
Future<FileServiceResponse> get(String url, {Map<String, String>? headers}) {
|
|
final merged = <String, String>{...this.headers, ...?headers};
|
|
return super.get(url, headers: merged);
|
|
}
|
|
}
|
|
|
|
ImageProvider headerNetworkImage(String url, Map<String, String> headers) {
|
|
return NetworkImage(url, headers: headers);
|
|
}
|