Skip to content

Commit

Permalink
Updated Webapp API
Browse files Browse the repository at this point in the history
  • Loading branch information
star-39 committed Feb 7, 2024
1 parent 1610023 commit 0626a8b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final _router = GoRouter(
builder: (BuildContext context, GoRouterState state) {
return ExportStickerPage(
sn: state.pathParameters['sn'] ?? "", qid: state.uri.queryParameters['qid'] ?? "", hex: state.uri.queryParameters['hex'] ?? "",
ws: state.uri.queryParameters['ws'] ?? defaultWebappSite);
dn: state.uri.queryParameters['dn'] ?? defaultWebappSite);
}),
]),
GoRoute(path: '/settings', builder: (context, state) => const SettingsPage(), routes: <RouteBase>[
Expand Down Expand Up @@ -70,7 +70,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
void initState() {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
WidgetsBinding.instance.addObserver(this);
_brightness = WidgetsBinding.instance.window.platformBrightness;
_brightness = MediaQuery.of(context).platformBrightness;
super.initState();
}

Expand All @@ -84,7 +84,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
void didChangePlatformBrightness() {
if (mounted) {
setState(() {
_brightness = WidgetsBinding.instance.window.platformBrightness;
_brightness = MediaQuery.of(context).platformBrightness;
});
}
super.didChangePlatformBrightness();
Expand Down
6 changes: 3 additions & 3 deletions lib/src/export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class StickerExport {
final String sn;
final String qid;
final String hex;
final String ws;
final String dn;

final dio = Dio();
final ssFiles = <String>[];
Expand All @@ -104,7 +104,7 @@ class StickerExport {
[[]]
];

StickerExport({required this.sn, required this.qid, required this.hex, required this.ws}) {
StickerExport({required this.sn, required this.qid, required this.hex, required this.dn}) {
dio.interceptors.add(RetryInterceptor(
dio: dio,
retries: 3,
Expand All @@ -118,7 +118,7 @@ class StickerExport {
}

Future<void> fetchStickerList() async {
final res = await Dio().get('https://$ws/api/ss?sn=$sn&qid=$qid&hex=$hex&cmd=export');
final res = await Dio().get('https://$dn/webpp/api/ss?sn=$sn&qid=$qid&hex=$hex&cmd=export');
final Map<String, dynamic> wssMap = jsonDecode(res.data);
wss = StickerSet.fromJson(wssMap);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/pages/export_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class ExportStickerPage extends StatefulWidget {
final String sn;
final String qid;
final String hex;
final String ws;
const ExportStickerPage({super.key, required this.sn, required this.qid, required this.hex, required this.ws});
final String dn;
const ExportStickerPage({super.key, required this.sn, required this.qid, required this.hex, required this.dn});

@override
State<ExportStickerPage> createState() => _ExportStickerPage();
Expand All @@ -54,7 +54,7 @@ class _ExportStickerPage extends State<ExportStickerPage> {
Provider.of<ProgressProvider>(context, listen: false).title = "...";
});
//go to done page when done.
StickerExport(sn: widget.sn, qid: widget.qid, hex: widget.hex, ws: widget.ws)
StickerExport(sn: widget.sn, qid: widget.qid, hex: widget.hex, dn: widget.dn)
.installFromRemote(Provider.of<ProgressProvider>(context, listen: false))
.then((value) => context.go("/export/done", extra: value));
}
Expand Down

0 comments on commit 0626a8b

Please sign in to comment.