wip
This commit is contained in:
parent
8cca72fc18
commit
8add9d459b
4 changed files with 11611 additions and 40 deletions
|
|
@ -1,39 +1,16 @@
|
||||||
function getApplicationId() {
|
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||||
const match = window.location.hash.match(/^#\/job-procedures\/record\/([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})/)
|
if (message.type === "COOKIE") {
|
||||||
if (match != null) {
|
return browser.cookies.get({
|
||||||
return match[1]
|
url: message.url,
|
||||||
|
name: message.key
|
||||||
|
});
|
||||||
|
// const cookie = await browser.cookies.get({
|
||||||
|
// url: message.url,
|
||||||
|
// name: message.key
|
||||||
|
// });
|
||||||
|
// console.log(cookie)
|
||||||
|
// sendResponse({"cookie":cookie});
|
||||||
|
} else {
|
||||||
|
throw `Unkown message type ${message.type}`
|
||||||
}
|
}
|
||||||
throw "Unable to retrieve Application ID";
|
});
|
||||||
}
|
|
||||||
|
|
||||||
async function getApplicantFiles(applicant) {
|
|
||||||
fetch(`https://personal.uni-graz.at/api/erec/job-applications/${applicant.id}`)
|
|
||||||
.then((response) => {
|
|
||||||
console.log(response.body)
|
|
||||||
if (response.ok) {
|
|
||||||
return response.json()
|
|
||||||
}
|
|
||||||
throw "Failed to get application"
|
|
||||||
})
|
|
||||||
.then((jsonData) => {
|
|
||||||
return jsonData.application_files
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function listAllFiles() {
|
|
||||||
const aid = getApplicationId()
|
|
||||||
console.log(`Application ID: ${aid}`)
|
|
||||||
fetch(`https://personal.uni-graz.at/api/erec/job-applications/procedure/${aid}`)
|
|
||||||
.then((response) => {
|
|
||||||
console.log(response.statusText)
|
|
||||||
if (response.ok) {
|
|
||||||
return response.json()
|
|
||||||
}
|
|
||||||
throw "Failed to get list of applications"
|
|
||||||
})
|
|
||||||
.then((jsonData) => {
|
|
||||||
return Promise.allSettled(jsonData.map(getApplicant))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(listAllFiles())
|
|
||||||
|
|
|
||||||
11577
lib/jszip.js
Normal file
11577
lib/jszip.js
Normal file
File diff suppressed because it is too large
Load diff
13
lib/jszip.min.js
vendored
Normal file
13
lib/jszip.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -7,7 +7,10 @@
|
||||||
"id": "gaspard.jankowiak@uni-graz.at"
|
"id": "gaspard.jankowiak@uni-graz.at"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"permissions": ["*://personal.uni-graz.at/*"],
|
"background": {
|
||||||
|
"scripts": ["background.js"]
|
||||||
|
},
|
||||||
|
"permissions": ["*://personal.uni-graz.at/*", "cookies"],
|
||||||
"description": "Downloads all files from a application procedure at the KFU",
|
"description": "Downloads all files from a application procedure at the KFU",
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
|
|
@ -15,7 +18,8 @@
|
||||||
"https://personal.uni-graz.at/*"
|
"https://personal.uni-graz.at/*"
|
||||||
],
|
],
|
||||||
"js": [
|
"js": [
|
||||||
"background.js"
|
"lib/jszip.js",
|
||||||
|
"content.js"
|
||||||
],
|
],
|
||||||
"css": [
|
"css": [
|
||||||
"style.css"
|
"style.css"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue