import
This commit is contained in:
commit
8cca72fc18
3 changed files with 64 additions and 0 deletions
39
background.js
Normal file
39
background.js
Normal 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())
|
||||
25
manifest.json
Normal file
25
manifest.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "KF-Application-Downloader",
|
||||
"version": "0.1.0",
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "gaspard.jankowiak@uni-graz.at"
|
||||
}
|
||||
},
|
||||
"permissions": ["*://personal.uni-graz.at/*"],
|
||||
"description": "Downloads all files from a application procedure at the KFU",
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"https://personal.uni-graz.at/*"
|
||||
],
|
||||
"js": [
|
||||
"background.js"
|
||||
],
|
||||
"css": [
|
||||
"style.css"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
0
style.css
Normal file
0
style.css
Normal file
Loading…
Add table
Add a link
Reference in a new issue