diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-05-01 14:40:54 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-05-01 14:40:54 +0200 |
| commit | 5db4632757d047d023e4162f1f28bdb19cc95c6d (patch) | |
| tree | 24cb341bcc05230b374481a59987ef44b56b3bbf /Info/9/3 | |
| parent | 96eb6fe00126f0946a7fa952c267ffc8ddb03fe8 (diff) | |
| download | unterricht-5db4632757d047d023e4162f1f28bdb19cc95c6d.tar.gz unterricht-5db4632757d047d023e4162f1f28bdb19cc95c6d.zip | |
Revert "generalize loading of Online-IDE logins"
This reverts commit 96eb6fe00126f0946a7fa952c267ffc8ddb03fe8.
Student view doesnot have the index.
Diffstat (limited to 'Info/9/3')
| -rw-r--r-- | Info/9/3/Planet/modellierung/landung/online-ide.md | 54 |
1 files changed, 16 insertions, 38 deletions
diff --git a/Info/9/3/Planet/modellierung/landung/online-ide.md b/Info/9/3/Planet/modellierung/landung/online-ide.md index f98c74cf..e94e77fa 100644 --- a/Info/9/3/Planet/modellierung/landung/online-ide.md +++ b/Info/9/3/Planet/modellierung/landung/online-ide.md @@ -14,48 +14,28 @@ include-after: | console.error('Error fetching JSON:', error); } } - - const findInMenu = (selector, keywords) => { - // Sucht in allen Links der Seite nach den Modulen - const links = Array.from(document.querySelectorAll(`a[href*="${selector}"]`)); - const match = links.find(a => keywords.some(k => a.innerText.toLowerCase().includes(k.toLowerCase()))); - return match ? match.href : (links.length > 0 ? links[0].href : null); - }; // Get the user's firstname via the moodle generico filter const firstname = "{firstname}"; const lastname = "{lastname}"; - let loginsUrl = null; - - function fetchLogin() { - fetchJson(loginsUrl).then((logins) => { - if (logins) { - for (const user of logins) { - if (!(user.Name.includes("{firstname}") && user.Name.includes("{lastname}"))) - continue; - - let loginDiv = document.querySelector(".oide-login"); - loginDiv.innerHTML = `Benutzername: ${user.Benutzername}<br>Passwort: ${user.Passwort}`; - } - } - }); - } - - const sleep = ms => new Promise(r => setTimeout(r, ms)); - async function updateLogin() { - for(let i = 0; i < 10; i++) { - loginsUrl = findInMenu("/mod/resource/", ["Online-IDE Logins"]); - if (loginsUrl) { - fetchLogin(); - break; + + const resource = 90441121; + // Moodle some insists in wrapping urls in <a> tags breaking the JS code. + // We use a base64 encoding for the url: https://lernplattform.bycs.de/mod/resource/view.php?id= + const resourceUrl = "aHR0cHM6Ly9sZXJucGxhdHRmb3JtLmJ5Y3MuZGUvbW9kL3Jlc291cmNlL3ZpZXcucGhwP2lkPQo="; + const url = window.atob(resourceUrl) + resource; + + fetchJson(url).then((logins) => { + if (logins) { + for (const user of logins) { + if (!(user.Name.includes("{firstname}") && user.Name.includes("{lastname}"))) + continue; + + let loginDiv = document.querySelector(".oide-login"); + loginDiv.innerHTML = `Benutzername: ${user.Benutzername}<br>Passwort: ${user.Passwort}`; } - await sleep(500); } - } - - window.addEventListener('load', function() { - updateLogin(); - }) + }); </script> --- @@ -70,8 +50,6 @@ Rufe die Seite auf und melde dich an. Die YASA hat dir einen Zugang für die Online-IDE angelegt. ::::{.oide-login} -Benutzername: UNBEKANNT -Passwort: BITTE_FRAG_NACH :::: Bitte ändere dein Passwort per Klick auf die kleine Figur neben deinem Namen im <span style="border: solid 1px #00B2FF">Controls-Fenster</span> und notiere dir deine Login-Informationen! |
