Skip to content

Commit

Permalink
尝试解决跨域问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LiarOnce committed Apr 24, 2024
1 parent 2844e76 commit d73c346
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/assets/js/index/modals/app-details-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const appDetailsModal = {
}
}

const requestOptions = {
mode: 'no-cors'
}

async function reloadAppRatings (appID) {
appDetailsModal.content.ratings.loggedIn.details.innerHTML = '<strong>@?</strong>';
appDetailsModal.content.ratings.loggedIn.points.value = 1;
Expand Down Expand Up @@ -220,7 +224,7 @@ function setAppDetailsModalDetails (appDetails) {
appDetailsModal.content.version.innerText = appDetails.download.version
} else if (appDetails.download.manifest) {
appDetailsModal.content.version.innerText = "..."
fetch(`https://kaios.tri1.workers.dev?url=${appDetails.download.manifest}`).then(async response => {
fetch(`https://kaios.tri1.workers.dev?url=${appDetails.download.manifest}`, requestOptions).then(async response => {
if (response.ok) {
const manifest = await response.json();
if (manifest.version) {
Expand Down
6 changes: 5 additions & 1 deletion src/assets/js/lib/storedb/storedb.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const requestOptions = {
mode: 'no-cors'
}

class StoreDatabaseAPI {
constructor () {
/** Moved to loadDB() */
Expand Down Expand Up @@ -29,7 +33,7 @@ class StoreDatabaseAPI {
generatedAt: null
};
for (const storeURL of this.stores) {
const rawDb = await fetch(storeURL);
const rawDb = await fetch(storeURL, requestOptions);
if (!rawDb.ok) continue;

this.currentStore.index = this.stores.indexOf(storeURL);
Expand Down

0 comments on commit d73c346

Please sign in to comment.