diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 7aaae25..e49f0d0 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -10,5 +10,5 @@
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
- ]
+ ],
}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 2c0a7aa..e881a8b 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -3,4 +3,15 @@
"java.configuration.updateBuildConfiguration": "interactive",
"cmake.sourceDirectory": "/home/mulverine/Documents/Workspace/personal/refracture/refracture-music/packages/client-flutter/linux",
"terminal.integrated.persistentSessionReviveProcess": "never",
+ "dart.flutterSdkPaths": [
+ "packages/client-flutter/.fvm/flutter_sdk"
+ ],
+ "search.exclude": {
+ "**/.fvm": true
+ },
+ // Remove from file watching
+ "files.watcherExclude": {
+ "**/.fvm": true
+ },
+ "dart.flutterSdkPath": "/home/mulverine/Documents/Workspace/personal/refracture/refracture-music/packages/client-flutter/.fvm/flutter_sdk"
}
\ No newline at end of file
diff --git a/packages/client-flutter/.fvm/flutter_sdk b/packages/client-flutter/.fvm/flutter_sdk
new file mode 120000
index 0000000..20a84fe
--- /dev/null
+++ b/packages/client-flutter/.fvm/flutter_sdk
@@ -0,0 +1 @@
+/home/mulverine/fvm/versions/3.10.1
\ No newline at end of file
diff --git a/packages/client-flutter/.fvm/fvm_config.json b/packages/client-flutter/.fvm/fvm_config.json
new file mode 100644
index 0000000..9474807
--- /dev/null
+++ b/packages/client-flutter/.fvm/fvm_config.json
@@ -0,0 +1,4 @@
+{
+ "flutterSdkVersion": "3.10.1",
+ "flavors": {}
+}
\ No newline at end of file
diff --git a/packages/client-flutter/lib/app/core.dart b/packages/client-flutter/lib/app/core.dart
index 5d0d93b..8d6f10c 100644
--- a/packages/client-flutter/lib/app/core.dart
+++ b/packages/client-flutter/lib/app/core.dart
@@ -16,6 +16,8 @@ import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;
import 'package:shelf_router/shelf_router.dart' as shelf_router;
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
+import 'package:webf/devtools.dart';
+import 'package:webf/webf.dart';
// ignore: must_be_immutable
@@ -30,12 +32,12 @@ class AppCore extends InheritedWidget {
String? loadFailure;
- late JavascriptRuntime runtime;
+ late WebF runtime;
AppCore({
super.key,
required Widget child,
- }) : super(child: child);
+ }) : super(child: Row(children: [child]));
@override
bool updateShouldNotify(AppCore oldWidget) => runtime != oldWidget.runtime;
@@ -59,78 +61,110 @@ class AppCore extends InheritedWidget {
}
loadRuntime() async {
- runtime = getJavascriptRuntime();
-
- await runtime.enableFetch();
-
- await runtime.enableHandlePromises();
-
- runtime.onMessage('initDatabase', (init) async {
- unit[init.name]!.initDB(init);
- });
-
- runtime.addXhrHandler(XhrHandlerStage.preRequest, (url, method, {body, headers, response}) async {
- print(url);
- if (url.host == 'app.music') {
- print({
- url, method, body, headers, response
- });
- return XhrHandle(XhrHandleType.respond, XhtmlHttpResponseInfo(statusCode: 200, statusText: 'OK'), "");
- }
- return XhrHandle(XhrHandleType.skip);
- });
-
- runtime.onMessage('print', (message) {
- print(message);
- });
+ runtime = WebF(
+ devToolsService: ChromeDevToolsService(),
+ bundle: WebFBundle.fromContent("""
+
+ ${unit.values.map((unit) {
+ if (unit.bundle == null) {
+ return '';
+ }
+ return """
+
+ """;
+ }).join('\n')}
+ test
+ """, contentType: ContentType.html, url: 'http://app.music'),
+ onLoad: (controller) {
+ print(runtime.devToolsService!.isolateServer);
+ },
+ onLoadError: (error, trace) {
+ logger.f(error, stackTrace: trace);
+ },
+ onJSError: (error) {
+ logger.f(error);
+ },
+ viewportHeight: 0,
+ viewportWidth: 0,
+ );
- runtime.onMessage('addPlugin', (plugin) async {
- final String index = ['plugin', ...plugin.index].join('.');
-
- unit[index] = UnitManager(
- core: this,
- logger: logger,
- name: plugin.name,
- index: ['plugin', ...plugin.index],
- src: plugin.src,
- tag: plugin.tag,
- hash: plugin.hash,
- );
-
- String? errored;
-
- unit[index]!.loaded.future.catchError((error) {
- if (plugin.name == 'Base') {
- logger.f('[Music UI] fatal: $error');
- loadFailure = error;
- } else {
- logger.e('[Music UI] error: $error');
- }
+ runApp(runtime);
+
+ print(runtime);
+
+ // runtime = getJavascriptRuntime();
+
+ // await runtime.enableFetch();
+
+ // await runtime.enableHandlePromises();
+
+ // runtime.onMessage('initDatabase', (init) async {
+ // unit[init.name]!.initDB(init);
+ // });
+
+ // runtime.addXhrHandler(XhrHandlerStage.preRequest, (url, method, {body, headers, response}) async {
+ // print(url);
+ // if (url.host == 'app.music') {
+ // print({
+ // url, method, body, headers, response
+ // });
+ // return XhrHandle(XhrHandleType.respond, XhtmlHttpResponseInfo(statusCode: 200, statusText: 'OK'), "");
+ // }
+ // return XhrHandle(XhrHandleType.skip);
+ // });
+
+ // runtime.onMessage('print', (message) {
+ // print(message);
+ // });
+
+ // runtime.onMessage('addPlugin', (plugin) async {
+ // final String index = ['plugin', ...plugin.index].join('.');
+
+ // unit[index] = UnitManager(
+ // core: this,
+ // logger: logger,
+ // name: plugin.name,
+ // index: ['plugin', ...plugin.index],
+ // src: plugin.src,
+ // tag: plugin.tag,
+ // hash: plugin.hash,
+ // );
+
+ // String? errored;
+
+ // unit[index]!.loaded.future.catchError((error) {
+ // if (plugin.name == 'Base') {
+ // logger.f('[Music UI] fatal: $error');
+ // loadFailure = error;
+ // } else {
+ // logger.e('[Music UI] error: $error');
+ // }
- errored = error;
- });
+ // errored = error;
+ // });
- await unit[index]!.load();
+ // await unit[index]!.load();
- if (unit[index]!.bundle != null) {
- await loadRuntime();
+ // if (unit[index]!.bundle != null) {
+ // await loadRuntime();
- return { "success": true };
- }
+ // return { "success": true };
+ // }
- return { "success": false, "error": errored };
- });
+ // return { "success": false, "error": errored };
+ // });
- await runtime.evaluateAsync("""var window = global = globalThis;""");
+ // await runtime.evaluateAsync("""var window = global = globalThis;""");
- for (final unit in unit.values) {
- if (unit.bundle != null) {
- await runtime.evaluateAsync("""var MusicVersion = ${await unit.secure.storage['databaseVersion'] ?? '0'}');""");
- await runtime.evaluateAsync("""var ${unit.name};""");
- print(await runtime.evaluateAsync(unit.bundle!));
- runtime.executePendingJob();
- }
- }
+ // for (final unit in unit.values) {
+ // if (unit.bundle != null) {
+ // await runtime.evaluateAsync("""var MusicVersion = ${await unit.secure.storage['databaseVersion'] ?? '0'}');""");
+ // await runtime.evaluateAsync("""var ${unit.name};""");
+ // print(await runtime.evaluateAsync(unit.bundle!));
+ // }
+ // }
}
Future load() async {
diff --git a/packages/client-flutter/lib/main.dart b/packages/client-flutter/lib/main.dart
index 8b6b76d..0c5bdf8 100644
--- a/packages/client-flutter/lib/main.dart
+++ b/packages/client-flutter/lib/main.dart
@@ -1,10 +1,14 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:refracture_music/app/core.dart';
+import 'package:webf/webf.dart';
import 'views/navigation.dart';
void main() {
+ HttpCacheController.mode = HttpCacheMode.NO_CACHE;
+
+
runApp(AppCore(child: const MusicApp())..load());
}
diff --git a/packages/client-flutter/linux/flutter/generated_plugin_registrant.cc b/packages/client-flutter/linux/flutter/generated_plugin_registrant.cc
index 1933d56..29ed651 100644
--- a/packages/client-flutter/linux/flutter/generated_plugin_registrant.cc
+++ b/packages/client-flutter/linux/flutter/generated_plugin_registrant.cc
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) bitsdojo_window_linux_registrar =
@@ -24,4 +25,7 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
+ g_autoptr(FlPluginRegistrar) webf_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "WebfPlugin");
+ webf_plugin_register_with_registrar(webf_registrar);
}
diff --git a/packages/client-flutter/linux/flutter/generated_plugins.cmake b/packages/client-flutter/linux/flutter/generated_plugins.cmake
index 02ed2d6..2dc46d2 100644
--- a/packages/client-flutter/linux/flutter/generated_plugins.cmake
+++ b/packages/client-flutter/linux/flutter/generated_plugins.cmake
@@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_acrylic
flutter_js
flutter_secure_storage_linux
+ webf
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
diff --git a/packages/client-flutter/macos/Flutter/GeneratedPluginRegistrant.swift b/packages/client-flutter/macos/Flutter/GeneratedPluginRegistrant.swift
index 5876bad..31746b2 100644
--- a/packages/client-flutter/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/packages/client-flutter/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -10,7 +10,9 @@ import flutter_js
import flutter_secure_storage_macos
import macos_window_utils
import path_provider_foundation
+import shared_preferences_foundation
import sqflite
+import webf
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin"))
@@ -18,5 +20,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
MacOSWindowUtilsPlugin.register(with: registry.registrar(forPlugin: "MacOSWindowUtilsPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
+ SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
+ WebFPlugin.register(with: registry.registrar(forPlugin: "WebFPlugin"))
}
diff --git a/packages/client-flutter/packages/flutter_js b/packages/client-flutter/packages/flutter_js
index 5a90177..ae58aa8 160000
--- a/packages/client-flutter/packages/flutter_js
+++ b/packages/client-flutter/packages/flutter_js
@@ -1 +1 @@
-Subproject commit 5a9017783f3e26e720d2e8e9d3c87f145b17b202
+Subproject commit ae58aa8be960a35d85619f8992d68dfa0a436b81
diff --git a/packages/client-flutter/pubspec.lock b/packages/client-flutter/pubspec.lock
index d4b3775..a87ed20 100644
--- a/packages/client-flutter/pubspec.lock
+++ b/packages/client-flutter/pubspec.lock
@@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: archive
- sha256: "49b1fad315e57ab0bbc15bcbb874e83116a1d78f77ebd500a4af6c9407d6b28e"
+ sha256: "20071638cbe4e5964a427cfa0e86dce55d060bc7d82d56f3554095d7239a8765"
url: "https://pub.dev"
source: hosted
- version: "3.3.8"
+ version: "3.4.2"
args:
dependency: transitive
description:
@@ -109,10 +109,10 @@ packages:
dependency: transitive
description:
name: collection
- sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
+ sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
url: "https://pub.dev"
source: hosted
- version: "1.17.2"
+ version: "1.17.1"
convert:
dependency: transitive
description:
@@ -133,10 +133,10 @@ packages:
dependency: "direct main"
description:
name: cryptography
- sha256: "11d083541666d80bba21190d35ff70b2497c81e064e82d1b8a07d801f7c7e282"
+ sha256: df156c5109286340817d21fa7b62f9140f17915077127dd70f8bd7a2a0997a35
url: "https://pub.dev"
source: hosted
- version: "2.6.0"
+ version: "2.5.0"
cupertino_icons:
dependency: "direct main"
description:
@@ -161,6 +161,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
+ file:
+ dependency: transitive
+ description:
+ name: file
+ sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
@@ -271,6 +279,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.1.0"
+ hive:
+ dependency: transitive
+ description:
+ name: hive
+ sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.2.3"
http:
dependency: "direct main"
description:
@@ -299,10 +315,18 @@ packages:
dependency: transitive
description:
name: image
- sha256: a72242c9a0ffb65d03de1b7113bc4e189686fc07c7147b8b41811d0dd0e0d9bf
+ sha256: "6e703d5e2f8c63fb31a77753915c1ec8baebde8088844e0d29f71b8f0b108888"
url: "https://pub.dev"
source: hosted
- version: "4.0.17"
+ version: "4.1.0"
+ intl:
+ dependency: transitive
+ description:
+ name: intl
+ sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.18.1"
js:
dependency: transitive
description:
@@ -339,10 +363,10 @@ packages:
dependency: "direct main"
description:
name: logger
- sha256: ba3bc83117b2b49bdd723c0ea7848e8285a0fbc597ba09203b20d329d020c24a
+ sha256: "6bbb9d6f7056729537a4309bda2e74e18e5d9f14302489cc1e93f33b3fe32cac"
url: "https://pub.dev"
source: hosted
- version: "2.0.2"
+ version: "2.0.2+1"
macos_window_utils:
dependency: transitive
description:
@@ -355,18 +379,18 @@ packages:
dependency: transitive
description:
name: matcher
- sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
+ sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
url: "https://pub.dev"
source: hosted
- version: "0.12.16"
+ version: "0.12.15"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
- sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
+ sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
url: "https://pub.dev"
source: hosted
- version: "0.5.0"
+ version: "0.2.0"
meta:
dependency: transitive
description:
@@ -463,6 +487,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.7.3"
+ quiver:
+ dependency: transitive
+ description:
+ name: quiver
+ sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.2.1"
+ shared_preferences:
+ dependency: transitive
+ description:
+ name: shared_preferences
+ sha256: "0344316c947ffeb3a529eac929e1978fcd37c26be4e8468628bac399365a3ca1"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.2.0"
+ shared_preferences_android:
+ dependency: transitive
+ description:
+ name: shared_preferences_android
+ sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.2.1"
+ shared_preferences_foundation:
+ dependency: transitive
+ description:
+ name: shared_preferences_foundation
+ sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.4"
+ shared_preferences_linux:
+ dependency: transitive
+ description:
+ name: shared_preferences_linux
+ sha256: c2eb5bf57a2fe9ad6988121609e47d3e07bb3bdca5b6f8444e4cf302428a128a
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.1"
+ shared_preferences_platform_interface:
+ dependency: transitive
+ description:
+ name: shared_preferences_platform_interface
+ sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.1"
+ shared_preferences_web:
+ dependency: transitive
+ description:
+ name: shared_preferences_web
+ sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.2.1"
+ shared_preferences_windows:
+ dependency: transitive
+ description:
+ name: shared_preferences_windows
+ sha256: f763a101313bd3be87edffe0560037500967de9c394a714cd598d945517f694f
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.1"
shelf:
dependency: "direct main"
description:
@@ -488,10 +576,10 @@ packages:
dependency: transitive
description:
name: source_span
- sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
+ sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
url: "https://pub.dev"
source: hosted
- version: "1.10.0"
+ version: "1.9.1"
sqflite:
dependency: "direct main"
description:
@@ -576,10 +664,10 @@ packages:
dependency: transitive
description:
name: test_api
- sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
+ sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
url: "https://pub.dev"
source: hosted
- version: "0.6.0"
+ version: "0.5.1"
typed_data:
dependency: transitive
description:
@@ -596,14 +684,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
- web:
+ web_socket_channel:
dependency: transitive
description:
- name: web
- sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
+ name: web_socket_channel
+ sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.0"
+ webf:
+ dependency: "direct main"
+ description:
+ name: webf
+ sha256: "7f4323ac9e2dbb2350f8588da17d7f072d71ad7621ac9339e3fe140a6e47be35"
url: "https://pub.dev"
source: hosted
- version: "0.1.4-beta"
+ version: "0.15.0+2"
win32:
dependency: transitive
description:
@@ -637,5 +733,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
- dart: ">=3.1.0 <4.0.0"
- flutter: ">=3.7.0"
+ dart: ">=3.0.1 <4.0.0"
+ flutter: ">=3.10.0"
diff --git a/packages/client-flutter/pubspec.yaml b/packages/client-flutter/pubspec.yaml
index 0f4bff6..ba9169f 100644
--- a/packages/client-flutter/pubspec.yaml
+++ b/packages/client-flutter/pubspec.yaml
@@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
- sdk: '>=3.0.6 <4.0.0'
+ sdk: '>=3.0.1 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
@@ -48,11 +48,12 @@ dependencies:
shelf: ^1.4.1
shelf_router: ^1.1.4
flutter_secure_storage: ^8.1.0
- cryptography: ^2.6.0
logger: ^2.0.2
sync_http: ^0.3.1
flutter_js:
path: packages/flutter_js
+ webf: ^0.15.0+2
+ cryptography: ^2.5.0
dev_dependencies:
flutter_test:
diff --git a/packages/client-flutter/windows/flutter/generated_plugin_registrant.cc b/packages/client-flutter/windows/flutter/generated_plugin_registrant.cc
index 9e6781d..39f5557 100644
--- a/packages/client-flutter/windows/flutter/generated_plugin_registrant.cc
+++ b/packages/client-flutter/windows/flutter/generated_plugin_registrant.cc
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
BitsdojoWindowPluginRegisterWithRegistrar(
@@ -20,4 +21,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FlutterJsPlugin"));
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
+ WebfPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("WebfPlugin"));
}
diff --git a/packages/client-flutter/windows/flutter/generated_plugins.cmake b/packages/client-flutter/windows/flutter/generated_plugins.cmake
index 772c46a..1801274 100644
--- a/packages/client-flutter/windows/flutter/generated_plugins.cmake
+++ b/packages/client-flutter/windows/flutter/generated_plugins.cmake
@@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_acrylic
flutter_js
flutter_secure_storage_windows
+ webf
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST