chore: remove jsf as arm doesn't build

This commit is contained in:
Kingkor Roy Tirtho 2025-11-10 13:07:58 +06:00
parent f10a3d4976
commit 834445eda3
8 changed files with 147 additions and 228 deletions

View File

@ -1,167 +1,167 @@
import 'dart:async';
import 'dart:collection';
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'package:youtube_explode_dart/js_challenge.dart';
// ignore: implementation_imports
import 'package:youtube_explode_dart/src/reverse_engineering/challenges/ejs/ejs.dart';
import 'package:jsf/jsf.dart';
// import 'dart:async';
// import 'dart:collection';
// import 'dart:convert';
// import 'package:flutter/foundation.dart';
// import 'package:http/http.dart' as http;
// import 'package:youtube_explode_dart/js_challenge.dart';
// // ignore: implementation_imports
// import 'package:youtube_explode_dart/src/reverse_engineering/challenges/ejs/ejs.dart';
// import 'package:jsf/jsf.dart';
/// [WIP]
class QuickJSEJSSolver extends BaseJSChallengeSolver {
final _playerCache = <String, String>{};
final _sigCache = <(String, String, JSChallengeType), String>{};
final QuickJSRuntime qjs;
QuickJSEJSSolver._(this.qjs);
// /// [WIP]
// class QuickJSEJSSolver extends BaseJSChallengeSolver {
// final _playerCache = <String, String>{};
// final _sigCache = <(String, String, JSChallengeType), String>{};
// final QuickJSRuntime qjs;
// QuickJSEJSSolver._(this.qjs);
static Future<QuickJSEJSSolver> init() async {
final modules = await EJSBuilder.getJSModules();
final deno = await QuickJSRuntime.init(modules);
return QuickJSEJSSolver._(deno);
}
// static Future<QuickJSEJSSolver> init() async {
// final modules = await EJSBuilder.getJSModules();
// final deno = await QuickJSRuntime.init(modules);
// return QuickJSEJSSolver._(deno);
// }
@override
Future<String> solve(
String playerUrl, JSChallengeType type, String challenge) async {
final key = (playerUrl, challenge, type);
if (_sigCache.containsKey(key)) {
return _sigCache[key]!;
}
// @override
// Future<String> solve(
// String playerUrl, JSChallengeType type, String challenge) async {
// final key = (playerUrl, challenge, type);
// if (_sigCache.containsKey(key)) {
// return _sigCache[key]!;
// }
var playerScript = _playerCache[playerUrl];
if (playerScript == null) {
final resp = await http.get(Uri.parse(playerUrl));
playerScript = _playerCache[playerUrl] = resp.body;
}
final jsCall = EJSBuilder.buildJSCall(playerScript, {
type: [challenge],
});
// var playerScript = _playerCache[playerUrl];
// if (playerScript == null) {
// final resp = await http.get(Uri.parse(playerUrl));
// playerScript = _playerCache[playerUrl] = resp.body;
// }
// final jsCall = EJSBuilder.buildJSCall(playerScript, {
// type: [challenge],
// });
final result = await qjs.eval(jsCall);
// Trim the first and last characters (' delimiters of the JS string)
final data = json.decode(result.substring(1, result.length - 1))
as Map<String, dynamic>;
// final result = await qjs.eval(jsCall);
// // Trim the first and last characters (' delimiters of the JS string)
// final data = json.decode(result.substring(1, result.length - 1))
// as Map<String, dynamic>;
if (data['type'] != 'result') {
throw Exception('Unexpected response type: ${data['type']}');
}
final response = data['responses'][0];
if (response['type'] != 'result') {
throw Exception('Unexpected item response type: ${response['type']}');
}
final decoded = response['data'][challenge];
if (decoded == null) {
throw Exception('No data for challenge: $challenge');
}
// if (data['type'] != 'result') {
// throw Exception('Unexpected response type: ${data['type']}');
// }
// final response = data['responses'][0];
// if (response['type'] != 'result') {
// throw Exception('Unexpected item response type: ${response['type']}');
// }
// final decoded = response['data'][challenge];
// if (decoded == null) {
// throw Exception('No data for challenge: $challenge');
// }
_sigCache[key] = decoded;
// _sigCache[key] = decoded;
return decoded;
}
// return decoded;
// }
@override
void dispose() {
qjs.dispose();
}
}
// @override
// void dispose() {
// qjs.dispose();
// }
// }
class _EvalRequest {
final String code;
final Completer<String> completer;
// class _EvalRequest {
// final String code;
// final Completer<String> completer;
_EvalRequest(this.code, this.completer);
}
// _EvalRequest(this.code, this.completer);
// }
class QuickJSRuntime {
final JsRuntime _runtime;
final StreamController<String> _stdoutController =
StreamController.broadcast();
// class QuickJSRuntime {
// final JsRuntime _runtime;
// final StreamController<String> _stdoutController =
// StreamController.broadcast();
// Queue for incoming eval requests
final Queue<_EvalRequest> _evalQueue = Queue<_EvalRequest>();
bool _isProcessing = false; // Flag to indicate if an eval is currently active
// // Queue for incoming eval requests
// final Queue<_EvalRequest> _evalQueue = Queue<_EvalRequest>();
// bool _isProcessing = false; // Flag to indicate if an eval is currently active
QuickJSRuntime(this._runtime);
// QuickJSRuntime(this._runtime);
/// Disposes the Deno process.
void dispose() {
_stdoutController.close();
_runtime.dispose();
}
// /// Disposes the Deno process.
// void dispose() {
// _stdoutController.close();
// _runtime.dispose();
// }
/// Sends JavaScript code to Deno for evaluation.
/// Assumes single-line input produces single-line output.
Future<String> eval(String code) {
final completer = Completer<String>();
final request = _EvalRequest(code, completer);
_evalQueue.addLast(request); // Add request to the end of the queue
_processQueue(); // Attempt to process the queue
// /// Sends JavaScript code to Deno for evaluation.
// /// Assumes single-line input produces single-line output.
// Future<String> eval(String code) {
// final completer = Completer<String>();
// final request = _EvalRequest(code, completer);
// _evalQueue.addLast(request); // Add request to the end of the queue
// _processQueue(); // Attempt to process the queue
return completer.future;
}
// return completer.future;
// }
// Processes the eval queue.
void _processQueue() {
if (_isProcessing || _evalQueue.isEmpty) {
return; // Already processing or nothing in queue
}
// // Processes the eval queue.
// void _processQueue() {
// if (_isProcessing || _evalQueue.isEmpty) {
// return; // Already processing or nothing in queue
// }
_isProcessing = true;
final request =
_evalQueue.first; // Get the next request without removing it yet
// _isProcessing = true;
// final request =
// _evalQueue.first; // Get the next request without removing it yet
StreamSubscription? currentOutputSubscription;
Completer<void> lineReceived = Completer<void>();
// StreamSubscription? currentOutputSubscription;
// Completer<void> lineReceived = Completer<void>();
currentOutputSubscription = _stdoutController.stream.listen((data) {
if (!lineReceived.isCompleted) {
// Assuming single line output per eval.
// This will capture the first full line or chunk received after sending the code.
request.completer.complete(data.trim());
lineReceived.complete();
currentOutputSubscription
?.cancel(); // Cancel subscription for this request
_evalQueue.removeFirst(); // Remove the processed request
_isProcessing = false; // Mark as no longer processing
_processQueue(); // Attempt to process next item in queue
}
}, onError: (e) {
if (!request.completer.isCompleted) {
request.completer.completeError(e);
lineReceived.completeError(e);
currentOutputSubscription?.cancel();
_evalQueue.removeFirst();
_isProcessing = false;
_processQueue();
}
}, onDone: () {
if (!request.completer.isCompleted) {
request.completer.completeError(
StateError('Deno process closed while awaiting eval result.'));
lineReceived.completeError(
StateError('Deno process closed while awaiting eval result.'));
currentOutputSubscription?.cancel();
_evalQueue.removeFirst();
_isProcessing = false;
_processQueue();
}
});
// currentOutputSubscription = _stdoutController.stream.listen((data) {
// if (!lineReceived.isCompleted) {
// // Assuming single line output per eval.
// // This will capture the first full line or chunk received after sending the code.
// request.completer.complete(data.trim());
// lineReceived.complete();
// currentOutputSubscription
// ?.cancel(); // Cancel subscription for this request
// _evalQueue.removeFirst(); // Remove the processed request
// _isProcessing = false; // Mark as no longer processing
// _processQueue(); // Attempt to process next item in queue
// }
// }, onError: (e) {
// if (!request.completer.isCompleted) {
// request.completer.completeError(e);
// lineReceived.completeError(e);
// currentOutputSubscription?.cancel();
// _evalQueue.removeFirst();
// _isProcessing = false;
// _processQueue();
// }
// }, onDone: () {
// if (!request.completer.isCompleted) {
// request.completer.completeError(
// StateError('Deno process closed while awaiting eval result.'));
// lineReceived.completeError(
// StateError('Deno process closed while awaiting eval result.'));
// currentOutputSubscription?.cancel();
// _evalQueue.removeFirst();
// _isProcessing = false;
// _processQueue();
// }
// });
debugPrint("[QuickJS Solver] Evaluate ${request.code}");
final result = _runtime.eval(request.code);
debugPrint("[QuickJS Solver] Evaluation Result $result");
_stdoutController.add(result);
}
// debugPrint("[QuickJS Solver] Evaluate ${request.code}");
// final result = _runtime.eval(request.code);
// debugPrint("[QuickJS Solver] Evaluation Result $result");
// _stdoutController.add(result);
// }
static Future<QuickJSRuntime> init(String initCode) async {
debugPrint("[QuickJS Solver] Initializing");
debugPrint("[QuickJS Solver] script $initCode");
// static Future<QuickJSRuntime> init(String initCode) async {
// debugPrint("[QuickJS Solver] Initializing");
// debugPrint("[QuickJS Solver] script $initCode");
final runtime = JsRuntime();
// final runtime = JsRuntime();
runtime.execInitScript(initCode);
// runtime.execInitScript(initCode);
return QuickJSRuntime(runtime);
}
}
// return QuickJSRuntime(runtime);
// }
// }

View File

@ -12,13 +12,11 @@
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <flutter_timezone/flutter_timezone_plugin.h>
#include <gtk/gtk_plugin.h>
#include <irondash_engine_context/irondash_engine_context_plugin.h>
#include <local_notifier/local_notifier_plugin.h>
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
#include <open_file_linux/open_file_linux_plugin.h>
#include <screen_retriever_linux/screen_retriever_linux_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin.h>
#include <system_theme/system_theme_plugin.h>
#include <tray_manager/tray_manager_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
@ -43,9 +41,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) gtk_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
gtk_plugin_register_with_registrar(gtk_registrar);
g_autoptr(FlPluginRegistrar) irondash_engine_context_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "IrondashEngineContextPlugin");
irondash_engine_context_plugin_register_with_registrar(irondash_engine_context_registrar);
g_autoptr(FlPluginRegistrar) local_notifier_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "LocalNotifierPlugin");
local_notifier_plugin_register_with_registrar(local_notifier_registrar);
@ -61,9 +56,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);
g_autoptr(FlPluginRegistrar) super_native_extensions_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SuperNativeExtensionsPlugin");
super_native_extensions_plugin_register_with_registrar(super_native_extensions_registrar);
g_autoptr(FlPluginRegistrar) system_theme_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SystemThemePlugin");
system_theme_plugin_register_with_registrar(system_theme_registrar);

View File

@ -9,13 +9,11 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_linux
flutter_timezone
gtk
irondash_engine_context
local_notifier
media_kit_libs_linux
open_file_linux
screen_retriever_linux
sqlite3_flutter_libs
super_native_extensions
system_theme
tray_manager
url_launcher_linux
@ -24,7 +22,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
list(APPEND FLUTTER_FFI_PLUGIN_LIST
flutter_discord_rpc
jsf
metadata_god
)

View File

@ -18,7 +18,6 @@ import flutter_inappwebview_macos
import flutter_new_pipe_extractor
import flutter_secure_storage_macos
import flutter_timezone
import irondash_engine_context
import local_notifier
import media_kit_libs_macos_audio
import open_file_mac
@ -28,7 +27,6 @@ import screen_retriever_macos
import shared_preferences_foundation
import sqflite_darwin
import sqlite3_flutter_libs
import super_native_extensions
import system_theme
import tray_manager
import url_launcher_macos
@ -48,7 +46,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterNewPipeExtractorPlugin.register(with: registry.registrar(forPlugin: "FlutterNewPipeExtractorPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
FlutterTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterTimezonePlugin"))
IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin"))
LocalNotifierPlugin.register(with: registry.registrar(forPlugin: "LocalNotifierPlugin"))
MediaKitLibsMacosAudioPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosAudioPlugin"))
OpenFilePlugin.register(with: registry.registrar(forPlugin: "OpenFilePlugin"))
@ -58,7 +55,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
SystemThemePlugin.register(with: registry.registrar(forPlugin: "SystemThemePlugin"))
TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

View File

@ -422,10 +422,10 @@ packages:
dependency: transitive
description:
name: country_flags
sha256: "78a7bf8aabd7ae1a90087f0c517471ac9ebfe07addc652692f58da0f0f833196"
sha256: "714f2d415e74828eb08787d552a05e94cdf2cbe0607a5656f3e70087cd7bb7e0"
url: "https://pub.dev"
source: hosted
version: "3.3.0"
version: "4.1.0"
coverage:
dependency: transitive
description:
@ -1399,22 +1399,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.5"
irondash_engine_context:
dependency: transitive
description:
name: irondash_engine_context
sha256: "2bb0bc13dfda9f5aaef8dde06ecc5feb1379f5bb387d59716d799554f3f305d7"
url: "https://pub.dev"
source: hosted
version: "0.5.5"
irondash_message_channel:
dependency: transitive
description:
name: irondash_message_channel
sha256: b4101669776509c76133b8917ab8cfc704d3ad92a8c450b92934dd8884a2f060
url: "https://pub.dev"
source: hosted
version: "0.7.0"
jovial_misc:
dependency: transitive
description:
@ -1439,14 +1423,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.7"
jsf:
dependency: "direct main"
description:
name: jsf
sha256: "189ba3b9216702f9b6f2d8ea90fa5acaca13bbe5dd2f72fb38618005b41a737f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
json_annotation:
dependency: "direct main"
description:
@ -1910,14 +1886,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.0.4"
pixel_snap:
dependency: transitive
description:
name: pixel_snap
sha256: "677410ea37b07cd37ecb6d5e6c0d8d7615a7cf3bd92ba406fd1ac57e937d1fb0"
url: "https://pub.dev"
source: hosted
version: "0.1.5"
platform:
dependency: transitive
description:
@ -2107,10 +2075,10 @@ packages:
dependency: "direct main"
description:
name: shadcn_flutter
sha256: af83de199b7c3a965ab24e293cfcafe2764c12b7f911f5b1a427c332029262d9
sha256: "1fd4f798c39d6308dc8f7e94d9e870b5db39fbf417ea95c423c7555ce8227a1c"
url: "https://pub.dev"
source: hosted
version: "0.0.44"
version: "0.0.47"
shared_preferences:
dependency: "direct main"
description:
@ -2428,22 +2396,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.0.3"
super_clipboard:
dependency: transitive
description:
name: super_clipboard
sha256: e73f3bb7e66cc9260efa1dc507f979138e7e106c3521e2dda2d0311f6d728a16
url: "https://pub.dev"
source: hosted
version: "0.9.1"
super_native_extensions:
dependency: transitive
description:
name: super_native_extensions
sha256: b9611dcb68f1047d6f3ef11af25e4e68a21b1a705bbcc3eb8cb4e9f5c3148569
url: "https://pub.dev"
source: hosted
version: "0.9.1"
sync_http:
dependency: transitive
description:
@ -2460,14 +2412,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.4.0"
syntax_highlight:
dependency: transitive
description:
name: syntax_highlight
sha256: "4d3ba40658cadba6ba55d697f29f00b43538ebb6eb4a0ca0e895c568eaced138"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
system_theme:
dependency: "direct main"
description:
@ -2863,4 +2807,4 @@ packages:
version: "1.0.0"
sdks:
dart: ">=3.9.0 <4.0.0"
flutter: ">=3.35.1"
flutter: ">=3.32.3"

View File

@ -104,7 +104,7 @@ dependencies:
ref: dart-3-support
url: https://github.com/KRTirtho/scrobblenaut.git
scroll_to_index: ^3.0.1
shadcn_flutter: ^0.0.42
shadcn_flutter: ^0.0.47
shared_preferences: ^2.2.3
shelf: ^1.4.1
shelf_router: ^1.1.4
@ -161,7 +161,6 @@ dependencies:
flutter_markdown_plus: ^1.0.3
pub_semver: ^2.2.0
change_case: ^1.1.0
jsf: ^0.6.1
dev_dependencies:
build_runner: ^2.4.13

View File

@ -15,13 +15,11 @@
#include <flutter_new_pipe_extractor/flutter_new_pipe_extractor_plugin_c_api.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <flutter_timezone/flutter_timezone_plugin_c_api.h>
#include <irondash_engine_context/irondash_engine_context_plugin_c_api.h>
#include <local_notifier/local_notifier_plugin.h>
#include <media_kit_libs_windows_audio/media_kit_libs_windows_audio_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <screen_retriever_windows/screen_retriever_windows_plugin_c_api.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin_c_api.h>
#include <system_theme/system_theme_plugin.h>
#include <tray_manager/tray_manager_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
@ -46,8 +44,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
FlutterTimezonePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterTimezonePluginCApi"));
IrondashEngineContextPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("IrondashEngineContextPluginCApi"));
LocalNotifierPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("LocalNotifierPlugin"));
MediaKitLibsWindowsAudioPluginCApiRegisterWithRegistrar(
@ -58,8 +54,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi"));
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
SuperNativeExtensionsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi"));
SystemThemePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SystemThemePlugin"));
TrayManagerPluginRegisterWithRegistrar(

View File

@ -12,13 +12,11 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_new_pipe_extractor
flutter_secure_storage_windows
flutter_timezone
irondash_engine_context
local_notifier
media_kit_libs_windows_audio
permission_handler_windows
screen_retriever_windows
sqlite3_flutter_libs
super_native_extensions
system_theme
tray_manager
url_launcher_windows
@ -27,7 +25,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
list(APPEND FLUTTER_FFI_PLUGIN_LIST
flutter_discord_rpc
jsf
metadata_god
smtc_windows
)