From 8cca72fc1829ef29f1f3b6d04b75cf13f66fc9c7 Mon Sep 17 00:00:00 2001 From: Gaspard Jankowiak Date: Mon, 1 Jun 2026 15:35:21 +0200 Subject: [PATCH] import --- background.js | 39 +++++++++++++++++++++++++++++++++++++++ manifest.json | 25 +++++++++++++++++++++++++ style.css | 0 3 files changed, 64 insertions(+) create mode 100644 background.js create mode 100644 manifest.json create mode 100644 style.css diff --git a/background.js b/background.js new file mode 100644 index 0000000..0e77a3f --- /dev/null +++ b/background.js @@ -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()) diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..efa09e5 --- /dev/null +++ b/manifest.json @@ -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" + ] + } + ] +} diff --git a/style.css b/style.css new file mode 100644 index 0000000..e69de29