Skip to content

Commit

Permalink
feat: update url
Browse files Browse the repository at this point in the history
  • Loading branch information
SiriusKoan committed Jan 31, 2024
1 parent 9cb37d6 commit 94873f5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BASE_URL = "https://e3p.nycu.edu.tw";

// handle fetching data
var options;

Expand All @@ -10,7 +12,7 @@ chrome.runtime.onConnect.addListener(function(port) {
Cookie: `MoodleSession=${response["session"]}`
}
};
fetch("https://e3.nycu.edu.tw", options)
fetch(BASE_URL, options)
.then(res => {
return res.text();
})
Expand All @@ -21,7 +23,7 @@ chrome.runtime.onConnect.addListener(function(port) {
});
})
} else if (response["type"] == "course") {
let url = `https://e3.nycu.edu.tw/local/courseextension/index.php?courseid=${response["id"]}&scope=assignment`
let url = `${BASE_URL}/local/courseextension/index.php?courseid=${response["id"]}&scope=assignment`
fetch(url, options)
.then(res => {
return res.text();
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BASE_URL = "https://e3p.nycu.edu.tw";

// handle processing and rednering data
const port = chrome.runtime.connect({
name: "connection"
Expand Down Expand Up @@ -142,7 +144,7 @@ function flushTable() {

function fetchCourseData() {
chrome.cookies.get({
url: "https://e3.nycu.edu.tw/my/",
url: BASE_URL,
name: "MoodleSession"
}, function(d) {
// fetch data
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.1",
"manifest_version": 3,
"permissions": ["cookies", "storage"],
"host_permissions": ["https://e3.nycu.edu.tw/*"],
"host_permissions": ["https://e3p.nycu.edu.tw/*"],
"background": {
"service_worker": "background.js"
},
Expand Down
2 changes: 1 addition & 1 deletion popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</head>
<body>
<h1 id="main-title">
<a href="https://e3.nycu.edu.tw" target="_blank" title="https://e3.nycu.edu.tw">E3 Schedule</a>
<a href="https://e3p.nycu.edu.tw" target="_blank" title="https://e3p.nycu.edu.tw">E3 Schedule</a>
<span id="refresh-btn" class="fa fa-refresh"></span>
</h1>
<hr>
Expand Down

0 comments on commit 94873f5

Please sign in to comment.