Skip to content

Commit

Permalink
tryfix: #494 by replacing Image.network, which doesn't use Dio, wit…
Browse files Browse the repository at this point in the history
…h `CachedNetworkImage` that utilizes WebVPN proxy
  • Loading branch information
w568w committed Feb 26, 2025
1 parent 404340c commit ce8ea68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion lib/page/subpage_timetable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'dart:io';
import 'dart:ui';

import 'package:auto_size_text/auto_size_text.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dan_xi/common/constant.dart';
import 'package:dan_xi/common/feature_registers.dart';
import 'package:dan_xi/generated/l10n.dart';
Expand All @@ -32,6 +33,7 @@ import 'package:dan_xi/repository/fdu/edu_service_repository.dart';
import 'package:dan_xi/repository/fdu/postgraduate_timetable_repository.dart';
import 'package:dan_xi/repository/fdu/time_table_repository.dart';
import 'package:dan_xi/repository/forum/forum_repository.dart';
import 'package:dan_xi/util/io/cache_manager_with_webvpn.dart';
import 'package:dan_xi/util/lazy_future.dart';
import 'package:dan_xi/util/noticing.dart';
import 'package:dan_xi/util/platform_universal.dart';
Expand Down Expand Up @@ -183,7 +185,14 @@ class TimetableSubPageState extends PlatformSubpageState<TimetableSubPage> {
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.network(imageUrl),
CachedNetworkImage(
imageUrl: imageUrl,
cacheManager: DefaultCacheManagerWithWebvpn(),
// Ensure shape is the same as the loading indicator
fit: BoxFit.contain,
progressIndicatorBuilder:
(context, url, progress) =>
PlatformCircularProgressIndicator()),
TextField(controller: controller)
],
),
Expand Down
4 changes: 3 additions & 1 deletion lib/util/webvpn_proxy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ class WebvpnProxy {
"forum.fduhole.com":
"https://webvpn.fudan.edu.cn/https/77726476706e69737468656265737421f6f853892a7e6e546b0086a09d1b203a46",
"image.fduhole.com":
"https://webvpn.fudan.edu.cn/https/77726476706e69737468656265737421f9fa409b227e6e546b0086a09d1b203ab8"
"https://webvpn.fudan.edu.cn/https/77726476706e69737468656265737421f9fa409b227e6e546b0086a09d1b203ab8",
"yjsxk.fudan.edu.cn":
"https://webvpn.fudan.edu.cn/http/77726476706e69737468656265737421e9fd52842c7e6e457a0987e29d51367bba7b"
};

static PersonInfo? _personInfo;
Expand Down

0 comments on commit ce8ea68

Please sign in to comment.