🐛 Fix captcha on web
This commit is contained in:
		| @@ -12,8 +12,9 @@ post { | |||||||
|  |  | ||||||
| body:json { | body:json { | ||||||
|   { |   { | ||||||
|     "reason": "侮辱 Solar Network 商标,煽动颠覆中华羊国政权,制造不实信息,传播谣言,制造恐慌,寻衅滋事。", |     "reason": "吹哨管理条例 / 滥用吹哨功能,累积三次复核无效吹哨。处以禁用吹哨功能 30 天。", | ||||||
|     "type": 0, |     "type": 1, | ||||||
|  |     "perm_nodes": {"FlagPost":false}, | ||||||
|     "account_id": 5 |     "account_id": 5 | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,3 +1 @@ | |||||||
| import 'package:flutter/foundation.dart' show kIsWeb; | export 'captcha_native.dart' if (dart.library.html) 'captcha_web.dart'; | ||||||
|  |  | ||||||
| export 'captcha_native.dart' if (kIsWeb) 'captcha_web.dart'; |  | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | // ignore: avoid_web_libraries_in_flutter | ||||||
| import 'dart:html' as html; | import 'dart:html' as html; | ||||||
| import 'dart:ui_web' as ui; | import 'dart:ui_web' as ui; | ||||||
| import 'package:easy_localization/easy_localization.dart'; | import 'package:easy_localization/easy_localization.dart'; | ||||||
| @@ -32,7 +33,7 @@ class _CaptchaScreenState extends State<CaptchaScreen> { | |||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     final iframe = html.IFrameElement() |     final iframe = html.IFrameElement() | ||||||
|       ..src = '${context.read<ConfigProvider>().serverUrl}/captcha?redirect_uri=web' |       ..src = '${context.read<ConfigProvider>().serverUrl}/captcha' | ||||||
|       ..style.border = 'none' |       ..style.border = 'none' | ||||||
|       ..width = '100%' |       ..width = '100%' | ||||||
|       ..height = '100%'; |       ..height = '100%'; | ||||||
| @@ -40,7 +41,7 @@ class _CaptchaScreenState extends State<CaptchaScreen> { | |||||||
|     html.document.body!.append(iframe); |     html.document.body!.append(iframe); | ||||||
|     ui.platformViewRegistry.registerViewFactory( |     ui.platformViewRegistry.registerViewFactory( | ||||||
|       'captcha-iframe', |       'captcha-iframe', | ||||||
|           (int viewId) => iframe, |       (int viewId) => iframe, | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user