This commit is contained in:
Gaspard Jankowiak 2026-06-03 15:27:30 +02:00
commit 8add9d459b
4 changed files with 11611 additions and 40 deletions

View file

@ -1,39 +1,16 @@
function getApplicationId() {
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 (match != null) {
return match[1]
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.type === "COOKIE") {
return browser.cookies.get({
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())
});