mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-08 05:20:59 +03:00
WebClient: 3.44 webcodecs offline (#15722)
* feat(web): zero-readback WebCodecs video path Decoded VideoFrames from js/src/webcodecs.js are handed to Flutter via window.onVideoFrame and imported GPU-side with createImageFromTextureSource; any failure unregisters the hook so the JS side falls back to RGBA readback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(web): load bundled terminal font when Google CDNs are unreachable In air-gapped deployments GoogleFonts.robotoMono() cannot download the terminal font; when index.html signals offline mode, load the copy bundled with the web app under the family name google_fonts registers. Part of the fix for rustdesk/rustdesk-server-pro#996. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * ci: bump windows arm64 to Flutter 3.44.8, add web build patch script apply_flutter_3.44_web_patches.sh prepares a 3.44.x web build on top of the shared source patches: qr_code_scanner's web impl needs dart:ui_web for the removed platformViewRegistry, and flutter/web/fonts is refreshed to the font paths the 3.44 engine requests. The disabled build-rustdesk-web job runs it automatically once FLUTTER_VERSION moves to 3.44.x, and version-guarded 'Patch flutter' steps no longer fail when the guard does not match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(web): prevent stale WebCodecs frames across sessions Signed-off-by: fufesou <linlong1266@gmail.com> * fix(web): harden WebCodecs reconnect and Flutter 3.44 patches Signed-off-by: fufesou <linlong1266@gmail.com> * fix(ci): harden Flutter 3.44 patch input validation Validate required files before checking patch state, parameterize the theme-range validator, and prevent missing inputs from satisfying NO_MATCHES checks. Signed-off-by: fufesou <linlong1266@gmail.com> * Remove unused code Signed-off-by: fufesou <linlong1266@gmail.com> * fix(web): retry font loading and dispose stale decoded images Signed-off-by: fufesou <linlong1266@gmail.com> * remove unused code Signed-off-by: fufesou <linlong1266@gmail.com> * fix(web): Bad state: RenderBox was not laid out Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -12,3 +12,5 @@ Future<void> webSendLocalFiles(
|
||||
required bool isRemote}) {
|
||||
throw UnimplementedError("webSendLocalFiles");
|
||||
}
|
||||
|
||||
Future<void> loadLocalTerminalFontIfNeeded() async {}
|
||||
|
||||
33
flutter/lib/web/terminal_font.dart
Normal file
33
flutter/lib/web/terminal_font.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'dart:html' as html;
|
||||
import 'dart:js' as js;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
bool _loadRequested = false;
|
||||
|
||||
/// When Google CDNs are unreachable, `index.html` sets
|
||||
/// `window.rustdeskLocalFonts` and `GoogleFonts.robotoMono()` cannot download
|
||||
/// the terminal font. Load the copy bundled with the web app instead,
|
||||
/// registered under the family name google_fonts gives the terminal's
|
||||
/// TextStyle ('RobotoMono_regular').
|
||||
Future<void> loadLocalTerminalFontIfNeeded() async {
|
||||
if (_loadRequested || js.context['rustdeskLocalFonts'] != true) {
|
||||
return;
|
||||
}
|
||||
_loadRequested = true;
|
||||
try {
|
||||
final req = await html.HttpRequest.request(
|
||||
'fonts/RobotoMono-Regular.ttf',
|
||||
responseType: 'arraybuffer',
|
||||
);
|
||||
final data = ByteData.view(req.response as ByteBuffer);
|
||||
final loader = FontLoader('RobotoMono_regular')
|
||||
..addFont(Future.value(data));
|
||||
await loader.load();
|
||||
} catch (e) {
|
||||
_loadRequested = false;
|
||||
debugPrint('Failed to load bundled Roboto Mono: $e');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user