mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-06 10:02:50 +00:00
fix: plugins can't execute plugins
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
let resolveRequest: ((data: unknown) => void) | undefined = undefined;
|
let resolveRequest: ((data: unknown) => void) | undefined = undefined;
|
||||||
let source: MessageEventSource | undefined = undefined;
|
let source: MessageEventSource | undefined = undefined;
|
||||||
|
|
||||||
|
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
|
||||||
|
|
||||||
async function post(channel: string, args: unknown[]) {
|
async function post(channel: string, args: unknown[]) {
|
||||||
while (ongoingRequest) {
|
while (ongoingRequest) {
|
||||||
await ongoingRequest;
|
await ongoingRequest;
|
||||||
@@ -35,15 +37,18 @@
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
new Function("Action", "Chara", event.data.script)(
|
const Chara = Object.fromEntries(
|
||||||
Action,
|
|
||||||
Object.fromEntries(
|
|
||||||
event.data.charaChannels.map((name) => [
|
event.data.charaChannels.map((name) => [
|
||||||
name,
|
name,
|
||||||
(...args: unknown[]) => post(name, args),
|
(...args: unknown[]) => post(name, args),
|
||||||
]),
|
]),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
AsyncFunction(
|
||||||
|
"Action",
|
||||||
|
"Chara",
|
||||||
|
'"use strict"\n' + event.data.script,
|
||||||
|
)(Action, Chara);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user