Skip to content

Commit

Permalink
🚑 fix: sandboxed mode & chrome extension & frontend
Browse files Browse the repository at this point in the history
Signed-off-by: SimonShiki <[email protected]>
  • Loading branch information
SimonShiki committed Nov 12, 2023
1 parent fb83acb commit 4211941
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion extension/scripts/content-script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const scriptElem = document.createElement('script');
const extInstance = typeof browser !== 'undefined' ? browser : chrome;
scriptElem.setAttribute('type', 'text/javascript');
scriptElem.setAttribute('src', extInstance.runtime.getURL('/scripts/chibi.user.js'));
scriptElem.setAttribute('src', extInstance.runtime.getURL('/scripts/eureka-loader.user.js'));
(document.head || document.documentElement).appendChild(scriptElem);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eureka-loader",
"displayName": "Eureka",
"version": "6",
"version": "6.1",
"description": "Universal scratch extension loader.",
"repository": "https://github.com/EurekaScratch/eureka",
"author": "SimonShiki",
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function getExtensionInfo () {
* @param event Event from the frontend.
*/
async function messageHandler (event: MessageEvent) {
if (event.origin !== 'https://chibi.codingclip.cc') return;
if (event.origin !== 'https://eureka.codingclip.cc') return;
if (!('type' in event.data)) return;
switch ((event.data as MothDispatched).type) {
// Handshake: send current extension info in order to prepare frontend.
Expand Down
4 changes: 2 additions & 2 deletions src/loader/sandbox.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class ExtensionWorker {
this.initialRegistrations = [];

Promise.all(initialRegistrations).then(() =>
dispatch.call('scratchAdapter', 'onWorkerInit', id)
dispatch.call('loader', 'onWorkerInit', id)
);
} catch (e) {
dispatch.call('scratchAdapter', 'onWorkerInit', id, e);
dispatch.call('loader', 'onWorkerInit', id, e);
}
});
});
Expand Down

0 comments on commit 4211941

Please sign in to comment.