-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from NIAEFEUP/develop
- Loading branch information
Showing
121 changed files
with
17,126 additions
and
9,644 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: CI | ||
|
||
on: | ||
push: # Run on pushes to "develop" | ||
branches: | ||
- develop | ||
pull_request: # Run on PRs to "develop" | ||
branches: | ||
- develop | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
|
||
jobs: | ||
prettier: | ||
if: ${{ github.event.pull_request.draft == false }} | ||
|
||
name: Check Javascript code style | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21 | ||
cache: yarn | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Run Prettier | ||
run: yarn format | ||
|
||
eslint: | ||
if: ${{ github.event.pull_request.draft == false }} | ||
|
||
name: Lint Javascript code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21 | ||
cache: yarn | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Run Eslint | ||
run: yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
/node_modules | ||
/dist | ||
/.yarn | ||
/.github | ||
/popup/.next | ||
/popup/.yarn | ||
/popup/.node_modules | ||
/popup/out | ||
|
||
.changes.json | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"useTabs": false, | ||
"tabWidth": 4, | ||
"printWidth": 80, | ||
"singleQuote": false, | ||
"endOfLine": "auto", | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
From [developer.apple.com](https://developer.apple.com/documentation/safariservices/safari_app_extensions/building_a_safari_app_extension#2957927): | ||
|
||
>To develop without a certificate, each time you launch Safari, you need to tell it to load unsigned extensions using the Develop menu: | ||
> To develop without a certificate, each time you launch Safari, you need to tell it to load unsigned extensions using the Develop menu: | ||
> | ||
> Open Safari and choose Safari > Preferences. | ||
> Open Safari and choose Safari > Preferences. | ||
> | ||
> Select the Advanced tab, then select the “Show Develop menu in menu bar” checkbox. | ||
> Select the Advanced tab, then select the “Show Develop menu in menu bar” checkbox. | ||
> | ||
> Choose Develop > Allow Unsigned Extensions, enter your password, and click OK. The Allow Unsigned Extensions setting resets when a user quits Safari, so you need to set it again the next time you launch Safari. | ||
> Choose Develop > Allow Unsigned Extensions, enter your password, and click OK. The Allow Unsigned Extensions setting resets when a user quits Safari, so you need to set it again the next time you launch Safari. | ||
> | ||
> Choose Safari > Preferences and click the Extensions tab. This tab shows the localized description, display name, and version number for the selected Safari app extension. It also provides a more nuanced message about the permissions for the extension. | ||
> Choose Safari > Preferences and click the Extensions tab. This tab shows the localized description, display name, and version number for the selected Safari app extension. It also provides a more nuanced message about the permissions for the extension. | ||
> | ||
> Find your new extension in the list on the left, and enable it by selecting its checkbox. | ||
> Find your new extension in the list on the left, and enable it by selecting its checkbox. | ||
> | ||
> Close Safari Preferences. | ||
> Close Safari Preferences. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ convert mac-icon.png -resize 64x64 -gravity center -background transparent -exte | |
convert mac-icon.png -resize 256x256 -gravity center -background transparent -extent 256x256 [email protected] | ||
convert mac-icon.png -resize 512x512 -gravity center -background transparent -extent 512x512 [email protected] | ||
convert mac-icon.png -resize 1024x1024 -gravity center -background transparent -extent 1024x1024 [email protected] | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,69 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const sigarraRegex = /.*:\/\/sigarra\.up\.pt\/feup\/.*/; | ||
|
||
// Add default values for each option here | ||
const popupOptions = { | ||
navbar: "on", | ||
shortcuts: "on", | ||
autoLogin: "off", | ||
font: "on", | ||
navbar: "on", | ||
shortcuts: "on", | ||
autoLogin: "off", | ||
font: "on", | ||
}; | ||
|
||
chrome.runtime.onInstalled.addListener((object) => { | ||
if (object.reason === "install") { | ||
const reloadFEUPSigarraPages = () => { | ||
chrome.tabs.query({ url: "*://sigarra.up.pt/feup/*" }, (tabs) => { | ||
tabs.forEach((tab) => { | ||
chrome.tabs.reload(tab.id); | ||
}); | ||
tabs.forEach((tab) => { | ||
chrome.tabs.reload(tab.id); | ||
}); | ||
}); | ||
}; | ||
|
||
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { | ||
chrome.tabs.create({ | ||
url: chrome.runtime.getURL("html/autorize.html") | ||
}); | ||
}else{ | ||
chrome.tabs.create({ | ||
url: chrome.runtime.getURL("html/installed.html") | ||
}); | ||
} | ||
chrome.runtime.onInstalled.addListener((object) => { | ||
if (object.reason === "install") { | ||
reloadFEUPSigarraPages(); | ||
|
||
chrome.storage.local.set(popupOptions); | ||
} | ||
if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) { | ||
chrome.tabs.create({ | ||
url: chrome.runtime.getURL("html/autorize.html"), | ||
}); | ||
} else { | ||
chrome.tabs.create({ | ||
url: chrome.runtime.getURL("html/installed.html"), | ||
}); | ||
} | ||
|
||
if (object.reason === "update") { | ||
for (const opt in popupOptions) { | ||
if (chrome.storage.local.get(opt) == null) | ||
chrome.storage.local.set({[opt]: popupOptions[opt]}); | ||
chrome.storage.local.set(popupOptions); | ||
} | ||
} | ||
}); | ||
|
||
if (object.reason === "update") { | ||
reloadFEUPSigarraPages(); | ||
for (const opt in popupOptions) { | ||
if (chrome.storage.local.get(opt) == null) | ||
chrome.storage.local.set({ [opt]: popupOptions[opt] }); | ||
} | ||
} | ||
}); | ||
|
||
chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { | ||
if(!sender.tab.active){ | ||
console.log("tab not active skipping message...") | ||
return; | ||
} | ||
if (message.type == "login") { | ||
const cookie = await chrome.cookies.get({ name: "SI_SESSION", url: sender.tab.url }) | ||
console.log(cookie) | ||
if(cookie == null || cookie.value === "0"){ | ||
sendResponse(false); | ||
return; | ||
if (!sender.tab.active) { | ||
console.log("tab not active skipping message..."); | ||
return; | ||
} | ||
if (message.type == "login") { | ||
const cookie = await chrome.cookies.get({ | ||
name: "SI_SESSION", | ||
url: sender.tab.url, | ||
}); | ||
console.log(cookie); | ||
if (cookie == null || cookie.value === "0") { | ||
sendResponse(false); | ||
return; | ||
} | ||
message.auto_login.verifed = true; | ||
await chrome.storage.local.set({ auto_login: message.auto_login }); | ||
sendResponse(true); | ||
} | ||
message.auto_login.verifed = true; | ||
await chrome.storage.local.set({ auto_login: message.auto_login }); | ||
sendResponse(true); | ||
} | ||
}); | ||
|
||
chrome.permissions.onRemoved.addListener((permissions) => { | ||
//TODO: | ||
}); | ||
chrome.permissions.onRemoved.addListener(() => { | ||
//TODO: | ||
}); |
Oops, something went wrong.