🐛 Fix captcha on web

This commit is contained in:
LittleSheep 2025-04-03 00:14:11 +08:00
parent 4c9f3e799b
commit f311c1898c
3 changed files with 8 additions and 8 deletions

View File

@ -12,8 +12,9 @@ post {
body:json {
{
"reason": "侮辱 Solar Network 商标,煽动颠覆中华羊国政权,制造不实信息,传播谣言,制造恐慌,寻衅滋事。",
"type": 0,
"reason": "吹哨管理条例 / 滥用吹哨功能,累积三次复核无效吹哨。处以禁用吹哨功能 30 天。",
"type": 1,
"perm_nodes": {"FlagPost":false},
"account_id": 5
}
}

View File

@ -1,3 +1 @@
import 'package:flutter/foundation.dart' show kIsWeb;
export 'captcha_native.dart' if (kIsWeb) 'captcha_web.dart';
export 'captcha_native.dart' if (dart.library.html) 'captcha_web.dart';

View File

@ -1,3 +1,4 @@
// ignore: avoid_web_libraries_in_flutter
import 'dart:html' as html;
import 'dart:ui_web' as ui;
import 'package:easy_localization/easy_localization.dart';
@ -32,7 +33,7 @@ class _CaptchaScreenState extends State<CaptchaScreen> {
});
final iframe = html.IFrameElement()
..src = '${context.read<ConfigProvider>().serverUrl}/captcha?redirect_uri=web'
..src = '${context.read<ConfigProvider>().serverUrl}/captcha'
..style.border = 'none'
..width = '100%'
..height = '100%';
@ -40,7 +41,7 @@ class _CaptchaScreenState extends State<CaptchaScreen> {
html.document.body!.append(iframe);
ui.platformViewRegistry.registerViewFactory(
'captcha-iframe',
(int viewId) => iframe,
(int viewId) => iframe,
);
}
@ -51,4 +52,4 @@ class _CaptchaScreenState extends State<CaptchaScreen> {
body: HtmlElementView(viewType: 'captcha-iframe'),
);
}
}
}