Skip to content

Commit

Permalink
Disable cors for fetching bundle.js
Browse files Browse the repository at this point in the history
  • Loading branch information
acquitelol committed Nov 26, 2023
1 parent faf298f commit ae7e382
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/patches/menu/settings/Updater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default () => {
const res = await fetch(repository.hash, { cache: 'no-cache' }).then(res => res.json());

if (res.object?.sha !== updateHash) {
const bundleCache = await fetch(getFile('bundle.js'), { cache: 'no-cache' }).then(res => res.text())
const bundleCache = await fetch(getFile('bundle.js'), { cache: 'no-cache', mode: 'no-cors' }).then(res => res.text())

setUpdateHash(res.object.sha);
setBundleCache(bundleCache);
Expand Down
2 changes: 1 addition & 1 deletion src/intermediate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function loadBundle(src: string, type: 'url' | 'raw' = 'url') {
async function ensureCache(force = false, hash?: string) {
if ((typeof updater.get('bundleCache') !== 'string') || force) {
try {
const bundleCache = await fetch(common.getFile('bundle.js'), { cache: 'no-cache' }).then(res => res.text())
const bundleCache = await fetch(common.getFile('bundle.js'), { cache: 'no-cache', mode: 'no-cors' }).then(res => res.text())

updater.set('bundleCache', bundleCache);

Expand Down

0 comments on commit ae7e382

Please sign in to comment.