Skip to content

Commit

Permalink
Add CORS headers and remove all-urls from manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
colinpannikkat committed Nov 24, 2024
1 parent dea883b commit aff9835
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
6 changes: 2 additions & 4 deletions dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@

"default_title": "GetTheDamClass"
},
"host_permissions": ["<all_urls>"],
"host_permissions": ["*://*.oregonstate.edu/*, https://api.getthedamclass.sarvesh.me/*"],
"permissions" : [
"webRequest",
"scripting",
"activeTab",
"storage",
"notifications"
"storage"
],
"background": {
"service_worker": "src/background.js",
Expand Down
2 changes: 1 addition & 1 deletion dist/src/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/src/popup.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@

"default_title": "GetTheDamClass"
},
"host_permissions": ["<all_urls>"],
"host_permissions": ["*://*.oregonstate.edu/*, https://api.getthedamclass.sarvesh.me/*"],
"permissions" : [
"webRequest",
"scripting",
"activeTab",
"storage",
"notifications"
"storage"
],
"background": {
"service_worker": "src/background.js",
Expand Down
6 changes: 5 additions & 1 deletion src/components/signupform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ function SignupForm() {
fetch("https://api.getthedamclass.sarvesh.me/signup", {
method: "POST",
headers: {
"Content-Type": "application/json"
"Content-Type": "application/json",
'Access-Control-Allow-Credentials' : 'true',
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Methods':'POST',
'Access-Control-Allow-Headers':'application/json',
},
body: JSON.stringify(payload)
})
Expand Down
6 changes: 5 additions & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ async function getCourseList(): Promise<Course[]> {
method: "POST",
headers: {
"Content-Type": "application/json",
'Access-Control-Allow-Credentials' : 'true',
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Methods':'POST',
'Access-Control-Allow-Headers':'application/json',
},
body: JSON.stringify(payload)
})
Expand All @@ -109,7 +113,7 @@ async function getCourseList(): Promise<Course[]> {
return response.json();
})
.then(data => {
console.log("Get sub list was successful:", data);
console.log("Get course list was successful:", data);
cl = data.subs;
return
})
Expand Down

0 comments on commit aff9835

Please sign in to comment.