Skip to content

Commit f6a8213

Browse files
committed
fix: pig show fetch
1 parent 3b27e1b commit f6a8213

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

lib/repository/pighub_session.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// PigHub API session. https://www.pighub.top
66

7+
// ignore_for_file: non_constant_identifier_names
8+
79
import 'dart:math' as math;
810
import 'dart:isolate';
911

@@ -23,26 +25,23 @@ List<PigHubImage>? _cachedImages;
2325

2426
class PigHubImage {
2527
final String id;
26-
final String thumbnail; // relative path, e.g. /data/xxx.jpg
28+
final String image_url; // relative path, e.g. /data/xxx.jpg
2729
final String title;
28-
final String imageType; // "static" or "gif"
2930

3031
const PigHubImage({
3132
required this.id,
32-
required this.thumbnail,
33+
required this.image_url,
3334
required this.title,
34-
required this.imageType,
3535
});
3636

3737
factory PigHubImage.fromJson(Map<String, dynamic> json) => PigHubImage(
3838
id: json["id"].toString(),
39-
thumbnail: json["thumbnail"].toString(),
39+
image_url: json["image_url"].toString(),
4040
title: json["title"].toString(),
41-
imageType: json["image_type"].toString(),
4241
);
4342

4443
/// Full URL of the image.
45-
String get url => "$_base$thumbnail";
44+
String get url => "$_base$image_url";
4645
}
4746

4847
List<dynamic> _extractImageList(dynamic data) {
@@ -86,7 +85,7 @@ Future<List<PigHubImage>> _getAllPigs({bool forceRefresh = false}) async {
8685
return _cachedImages!;
8786
}
8887

89-
final response = await _dio.get("$_base/api/all-images");
88+
final response = await _dio.get("$_base/api/images?sort=0");
9089

9190
// Parse in a background isolate to avoid UI jank on large payloads.
9291
final parsed = await Isolate.run(() => _parsePigImages(response.data));

pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,10 +681,10 @@ packages:
681681
dependency: "direct main"
682682
description:
683683
name: home_widget
684-
sha256: d794a73894012459a4c63b94a6dc2cb3ccaa6eb08fb15b974aa7ac642594aed5
684+
sha256: fece84c7464099873c3ace38394ad7053509a4b0e36e57a1105a6aa31f47f23c
685685
url: "https://pub.dev"
686686
source: hosted
687-
version: "0.9.0"
687+
version: "0.9.3"
688688
hooks:
689689
dependency: transitive
690690
description:

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dependencies:
5858
# Output to system calendar
5959
device_calendar_plus: ^0.4.0
6060
# Homepage Widget
61-
home_widget: 0.9.0
61+
home_widget: ^0.9.3
6262
image: ^4.2.0
6363
catcher_2: ^2.0.0
6464
share_plus: ^13.1.0

0 commit comments

Comments
 (0)