mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-06 07:29:42 +00:00
Compare commits
2 Commits
3209c75144
...
834445eda3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
834445eda3 | ||
|
|
f10a3d4976 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,6 +9,7 @@
|
||||
.history
|
||||
.svn/
|
||||
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
@ -39,6 +39,7 @@ class TrackTile extends HookConsumerWidget {
|
||||
final int? index;
|
||||
final SpotubeTrackObject track;
|
||||
final bool selected;
|
||||
final bool selectionMode;
|
||||
final ValueChanged<bool?>? onChanged;
|
||||
final Future<void> Function()? onTap;
|
||||
final VoidCallback? onLongPress;
|
||||
@ -53,6 +54,7 @@ class TrackTile extends HookConsumerWidget {
|
||||
this.index,
|
||||
required this.track,
|
||||
this.selected = false,
|
||||
this.selectionMode = false,
|
||||
required this.playlist,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
@ -81,6 +83,12 @@ class TrackTile extends HookConsumerWidget {
|
||||
[track.album.images],
|
||||
);
|
||||
|
||||
// Treat either explicit selectionMode or presence of onChanged as selection
|
||||
// context. Some lists enable selection by providing `onChanged` without
|
||||
// toggling a dedicated `selectionMode` flag (e.g. playlists), so we must
|
||||
// disable inner navigation in both cases.
|
||||
final effectiveSelection = selectionMode || onChanged != null;
|
||||
|
||||
return LayoutBuilder(builder: (context, constrains) {
|
||||
return Listener(
|
||||
onPointerDown: (event) {
|
||||
@ -222,7 +230,9 @@ class TrackTile extends HookConsumerWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: switch (track) {
|
||||
child: AbsorbPointer(
|
||||
absorbing: selectionMode,
|
||||
child: switch (track) {
|
||||
SpotubeLocalTrackObject() => Text(
|
||||
track.name,
|
||||
maxLines: 1,
|
||||
@ -232,15 +242,17 @@ class TrackTile extends HookConsumerWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Button(
|
||||
style: ButtonVariance.link.copyWith(
|
||||
padding: (context, states, value) =>
|
||||
EdgeInsets.zero,
|
||||
),
|
||||
onPressed: () {
|
||||
context
|
||||
.navigateTo(TrackRoute(trackId: track.id));
|
||||
},
|
||||
child: Button(
|
||||
style: ButtonVariance.link.copyWith(
|
||||
padding: (context, states, value) =>
|
||||
EdgeInsets.zero,
|
||||
),
|
||||
onPressed: effectiveSelection
|
||||
? null
|
||||
: () {
|
||||
context
|
||||
.navigateTo(TrackRoute(trackId: track.id));
|
||||
},
|
||||
child: Text(
|
||||
track.name,
|
||||
maxLines: 1,
|
||||
@ -251,6 +263,7 @@ class TrackTile extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
if (constrains.mdAndUp) ...[
|
||||
const SizedBox(width: 8),
|
||||
@ -281,20 +294,25 @@ class TrackTile extends HookConsumerWidget {
|
||||
),
|
||||
subtitle: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: track is SpotubeLocalTrackObject
|
||||
child: track is SpotubeLocalTrackObject
|
||||
? Text(
|
||||
track.artists.asString(),
|
||||
)
|
||||
: ClipRect(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 40),
|
||||
child: ArtistLink(
|
||||
artists: track.artists,
|
||||
onOverflowArtistClick: () {
|
||||
context.navigateTo(
|
||||
TrackRoute(trackId: track.id),
|
||||
);
|
||||
},
|
||||
child: AbsorbPointer(
|
||||
absorbing: effectiveSelection,
|
||||
child: ArtistLink(
|
||||
artists: track.artists,
|
||||
onOverflowArtistClick: effectiveSelection
|
||||
? () {}
|
||||
: () {
|
||||
context.navigateTo(
|
||||
TrackRoute(trackId: track.id),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -9,13 +9,16 @@ import 'package:scroll_to_index/scroll_to_index.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
import 'package:spotube/collections/spotube_icons.dart';
|
||||
import 'package:spotube/components/button/back_button.dart';
|
||||
import 'package:spotube/components/dialogs/playlist_add_track_dialog.dart';
|
||||
import 'package:spotube/components/fallbacks/not_found.dart';
|
||||
import 'package:spotube/components/inter_scrollbar/inter_scrollbar.dart';
|
||||
import 'package:spotube/components/track_tile/track_tile.dart';
|
||||
import 'package:spotube/components/ui/button_tile.dart';
|
||||
import 'package:spotube/extensions/constrains.dart';
|
||||
import 'package:spotube/extensions/context.dart';
|
||||
import 'package:spotube/hooks/controllers/use_auto_scroll_controller.dart';
|
||||
import 'package:spotube/models/metadata/metadata.dart';
|
||||
import 'package:spotube/modules/player/player_queue_actions.dart';
|
||||
import 'package:spotube/provider/audio_player/audio_player.dart';
|
||||
import 'package:spotube/provider/audio_player/state.dart';
|
||||
|
||||
@ -55,6 +58,9 @@ class PlayerQueue extends HookConsumerWidget {
|
||||
final controller = useAutoScrollController();
|
||||
final searchText = useState('');
|
||||
|
||||
final selectionMode = useState(false);
|
||||
final selectedTrackIds = useState(<String>{});
|
||||
|
||||
final isSearching = useState(false);
|
||||
|
||||
final tracks = playlist.tracks;
|
||||
@ -131,6 +137,91 @@ class PlayerQueue extends HookConsumerWidget {
|
||||
surfaceOpacity: 0,
|
||||
child: searchBar,
|
||||
)
|
||||
else if (selectionMode.value)
|
||||
AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
surfaceBlur: 0,
|
||||
surfaceOpacity: 0,
|
||||
leading: [
|
||||
IconButton.ghost(
|
||||
icon: const Icon(SpotubeIcons.close),
|
||||
onPressed: () {
|
||||
selectedTrackIds.value = {};
|
||||
selectionMode.value = false;
|
||||
},
|
||||
)
|
||||
],
|
||||
title: SizedBox(
|
||||
height: 30,
|
||||
child: AutoSizeText(
|
||||
'${selectedTrackIds.value.length} selected',
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
trailing: [
|
||||
PlayerQueueActionButton(
|
||||
builder: (context, close) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Gap(12),
|
||||
ButtonTile(
|
||||
style: const ButtonStyle.ghost(),
|
||||
leading:
|
||||
const Icon(SpotubeIcons.selectionCheck),
|
||||
title: Text(context.l10n.select_all),
|
||||
onPressed: () {
|
||||
selectedTrackIds.value =
|
||||
filteredTracks.map((t) => t.id).toSet();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
ButtonTile(
|
||||
style: const ButtonStyle.ghost(),
|
||||
leading: const Icon(SpotubeIcons.playlistAdd),
|
||||
title: Text(context.l10n.add_to_playlist),
|
||||
onPressed: () async {
|
||||
final selected = filteredTracks
|
||||
.where((t) =>
|
||||
selectedTrackIds.value.contains(t.id))
|
||||
.toList();
|
||||
close();
|
||||
if (selected.isEmpty) return;
|
||||
final res = await showDialog<bool?>(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
PlaylistAddTrackDialog(
|
||||
tracks: selected,
|
||||
openFromPlaylist: null,
|
||||
),
|
||||
);
|
||||
if (res == true) {
|
||||
selectedTrackIds.value = {};
|
||||
selectionMode.value = false;
|
||||
}
|
||||
},
|
||||
),
|
||||
ButtonTile(
|
||||
style: const ButtonStyle.ghost(),
|
||||
leading: const Icon(SpotubeIcons.trash),
|
||||
title: Text(context.l10n.remove_from_queue),
|
||||
onPressed: () async {
|
||||
final ids = selectedTrackIds.value.toList();
|
||||
close();
|
||||
if (ids.isEmpty) return;
|
||||
await Future.wait(
|
||||
ids.map((id) => onRemove(id)));
|
||||
if (context.mounted) {
|
||||
selectedTrackIds.value = {};
|
||||
selectionMode.value = false;
|
||||
}
|
||||
},
|
||||
),
|
||||
const Gap(12),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
else
|
||||
AppBar(
|
||||
trailingGap: 0,
|
||||
@ -195,6 +286,20 @@ class PlayerQueue extends HookConsumerWidget {
|
||||
},
|
||||
itemBuilder: (context, i) {
|
||||
final track = filteredTracks.elementAt(i);
|
||||
|
||||
void toggleSelection(String id) {
|
||||
final s = {...selectedTrackIds.value};
|
||||
if (s.contains(id)) {
|
||||
s.remove(id);
|
||||
} else {
|
||||
s.add(id);
|
||||
}
|
||||
selectedTrackIds.value = s;
|
||||
if (selectedTrackIds.value.isEmpty) {
|
||||
selectionMode.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
return AutoScrollTag(
|
||||
key: ValueKey<int>(i),
|
||||
controller: controller,
|
||||
@ -203,15 +308,34 @@ class PlayerQueue extends HookConsumerWidget {
|
||||
playlist: playlist,
|
||||
index: i,
|
||||
track: track,
|
||||
selectionMode: selectionMode.value,
|
||||
selected:
|
||||
selectedTrackIds.value.contains(track.id),
|
||||
onChanged: selectionMode.value
|
||||
? (_) => toggleSelection(track.id)
|
||||
: null,
|
||||
onTap: () async {
|
||||
if (selectionMode.value) {
|
||||
toggleSelection(track.id);
|
||||
return;
|
||||
}
|
||||
if (playlist.activeTrack?.id == track.id) {
|
||||
return;
|
||||
}
|
||||
await onJump(track);
|
||||
},
|
||||
onLongPress: () {
|
||||
if (!selectionMode.value) {
|
||||
selectionMode.value = true;
|
||||
selectedTrackIds.value = {track.id};
|
||||
} else {
|
||||
toggleSelection(track.id);
|
||||
}
|
||||
},
|
||||
leadingActions: [
|
||||
if (!isSearching.value &&
|
||||
searchText.value.isEmpty)
|
||||
searchText.value.isEmpty &&
|
||||
!selectionMode.value)
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 8.0),
|
||||
|
||||
44
lib/modules/player/player_queue_actions.dart
Normal file
44
lib/modules/player/player_queue_actions.dart
Normal file
@ -0,0 +1,44 @@
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter_extension.dart';
|
||||
import 'package:spotube/collections/spotube_icons.dart';
|
||||
import 'package:spotube/extensions/constrains.dart';
|
||||
|
||||
class PlayerQueueActionButton extends StatelessWidget {
|
||||
final Widget Function(BuildContext context, VoidCallback close) builder;
|
||||
|
||||
const PlayerQueueActionButton({
|
||||
super.key,
|
||||
required this.builder,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IconButton.ghost(
|
||||
onPressed: () {
|
||||
final mediaQuery = MediaQuery.sizeOf(context);
|
||||
|
||||
if (mediaQuery.lgAndUp) {
|
||||
showDropdown(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SizedBox(
|
||||
width: 220 * context.theme.scaling,
|
||||
child: Card(
|
||||
padding: EdgeInsets.zero,
|
||||
child: builder(context, () => closeOverlay(context)),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
openSheet(
|
||||
context: context,
|
||||
builder: (context) => builder(context, () => closeSheet(context)),
|
||||
position: OverlayPosition.bottom,
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(SpotubeIcons.moreHorizontal),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ class BlackListPage extends HookConsumerWidget {
|
||||
child: TextField(
|
||||
onChanged: (value) => searchText.value = value,
|
||||
placeholder: Text(context.l10n.search),
|
||||
leading: const Icon(SpotubeIcons.search),
|
||||
// prefixIcon: const Icon(SpotubeIcons.search),
|
||||
),
|
||||
),
|
||||
InterScrollbar(
|
||||
|
||||
@ -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);
|
||||
// }
|
||||
// }
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
)
|
||||
|
||||
|
||||
@ -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"))
|
||||
|
||||
66
pubspec.lock
66
pubspec.lock
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user