This commit is contained in:
Gaspard Jankowiak 2026-06-01 15:35:21 +02:00
commit 8cca72fc18
3 changed files with 64 additions and 0 deletions

39
background.js Normal file
View file

@ -0,0 +1,39 @@
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]
}
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())