fix(platform): finalize runner registration, certificate verification and dynamic workspace loading
This commit is contained in:
parent
3b27101503
commit
45e11299c6
3 changed files with 30 additions and 10 deletions
|
|
@ -137,9 +137,13 @@
|
||||||
|
|
||||||
if (window.RunnerRegistry) {
|
if (window.RunnerRegistry) {
|
||||||
window.RunnerRegistry.register(HtmlCssAdapter);
|
window.RunnerRegistry.register(HtmlCssAdapter);
|
||||||
|
window.RunnerRegistry.register({ ...HtmlCssAdapter, id: "html" });
|
||||||
} else {
|
} else {
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
if (window.RunnerRegistry) window.RunnerRegistry.register(HtmlCssAdapter);
|
if (window.RunnerRegistry) {
|
||||||
|
window.RunnerRegistry.register(HtmlCssAdapter);
|
||||||
|
window.RunnerRegistry.register({ ...HtmlCssAdapter, id: "html" });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -564,8 +564,8 @@ class PlatformRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
if not cert:
|
if not cert:
|
||||||
return self.send_json({"valid": False, "error": "Zertifikat nicht gefunden"}, 404)
|
return self.send_json({"valid": False, "verified": False, "error": "Zertifikat nicht gefunden"}, 404)
|
||||||
return self.send_json({"valid": True, "certificate": dict(cert)})
|
return self.send_json({"valid": True, "verified": True, "certificate": dict(cert)})
|
||||||
|
|
||||||
elif path == "/api/stats/leaderboard":
|
elif path == "/api/stats/leaderboard":
|
||||||
conn = get_db()
|
conn = get_db()
|
||||||
|
|
|
||||||
|
|
@ -369,14 +369,15 @@
|
||||||
<script src="assets/runners/rust_runner.js"></script>
|
<script src="assets/runners/rust_runner.js"></script>
|
||||||
<script src="assets/runners/csharp_runner.js"></script>
|
<script src="assets/runners/csharp_runner.js"></script>
|
||||||
<script src="assets/runners/cpp_runner.js"></script>
|
<script src="assets/runners/cpp_runner.js"></script>
|
||||||
|
<script src="assets/courses_manifest.js"></script>
|
||||||
<script src="assets/monaco_ide.js"></script>
|
<script src="assets/monaco_ide.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const courseId = urlParams.get("course") || "python";
|
const courseId = urlParams.get("course") || "python";
|
||||||
const trackFolder = urlParams.get("track") || "lehrpfad_1_grundlagen";
|
let trackFolder = urlParams.get("track") || (courseId === "python" ? "lehrpfad_1_grundlagen" : "");
|
||||||
const chapterFolder = urlParams.get("chapter") || "01_erste_schritte_taschenrechner";
|
let chapterFolder = urlParams.get("chapter") || "";
|
||||||
const chapterId = `${trackFolder}/${chapterFolder}`;
|
let chapterId = "";
|
||||||
|
|
||||||
let CHAPTERS_MANIFEST = [];
|
let CHAPTERS_MANIFEST = [];
|
||||||
let currentCourseManifest = null;
|
let currentCourseManifest = null;
|
||||||
|
|
@ -467,17 +468,33 @@
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await loadCourseManifest();
|
await loadCourseManifest();
|
||||||
|
|
||||||
|
// Dynamische Ermittlung des aktuellen Kapitels
|
||||||
|
if (!chapterFolder && CHAPTERS_MANIFEST.length > 0) {
|
||||||
|
chapterFolder = CHAPTERS_MANIFEST[0].folder;
|
||||||
|
} else if (!chapterFolder) {
|
||||||
|
chapterFolder = "01_erste_schritte_taschenrechner";
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentChap = CHAPTERS_MANIFEST.find(c => c.folder === chapterFolder) || CHAPTERS_MANIFEST[0];
|
||||||
|
if (currentChap) {
|
||||||
|
chapterFolder = currentChap.folder;
|
||||||
|
if (currentChap.track && !trackFolder) trackFolder = currentChap.track;
|
||||||
|
}
|
||||||
|
if (!trackFolder) trackFolder = "lehrpfad_1_grundlagen";
|
||||||
|
|
||||||
|
chapterId = (courseId === "python") ? `${trackFolder}/${chapterFolder}` : `${courseId}/${chapterFolder}`;
|
||||||
|
|
||||||
setupNextChapterButton();
|
setupNextChapterButton();
|
||||||
|
|
||||||
const activeLanguage = currentCourseManifest ? (currentCourseManifest.language || "python") : "python";
|
const activeRunnerId = currentCourseManifest ? (currentCourseManifest.runner || currentCourseManifest.language || "python") : "python";
|
||||||
const runner = window.RunnerRegistry ? window.RunnerRegistry.get(activeLanguage) : null;
|
const runner = window.RunnerRegistry ? (window.RunnerRegistry.get(activeRunnerId) || window.RunnerRegistry.get(currentCourseManifest?.language) || null) : null;
|
||||||
|
|
||||||
let basePath = `${trackFolder}/${chapterFolder}`;
|
let basePath = `${trackFolder}/${chapterFolder}`;
|
||||||
if (courseId !== "python") {
|
if (courseId !== "python") {
|
||||||
basePath = `courses/${courseId}/${chapterFolder}`;
|
basePath = `courses/${courseId}/${chapterFolder}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentChap = CHAPTERS_MANIFEST.find(c => c.folder === chapterFolder);
|
|
||||||
let taskFile = (currentChap && currentChap.taskFile) ? currentChap.taskFile : (runner ? `aufgabe${runner.fileExtension}` : "aufgabe.py");
|
let taskFile = (currentChap && currentChap.taskFile) ? currentChap.taskFile : (runner ? `aufgabe${runner.fileExtension}` : "aufgabe.py");
|
||||||
let testFile = (currentChap && currentChap.testFile) ? currentChap.testFile : (runner ? runner.testFileExtension : "test_aufgabe.py");
|
let testFile = (currentChap && currentChap.testFile) ? currentChap.testFile : (runner ? runner.testFileExtension : "test_aufgabe.py");
|
||||||
let loesungFile = (currentChap && currentChap.taskFile && currentChap.taskFile.startsWith("Aufgabe")) ? `Musterloesung${runner ? runner.fileExtension : ".java"}` : (runner ? `musterloesung${runner.fileExtension}` : "musterloesung.py");
|
let loesungFile = (currentChap && currentChap.taskFile && currentChap.taskFile.startsWith("Aufgabe")) ? `Musterloesung${runner ? runner.fileExtension : ".java"}` : (runner ? `musterloesung${runner.fileExtension}` : "musterloesung.py");
|
||||||
|
|
@ -646,7 +663,6 @@
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", loadWorkspaceData);
|
document.addEventListener("DOMContentLoaded", loadWorkspaceData);
|
||||||
</script>
|
</script>
|
||||||
<script src="assets/courses_manifest.js"></script>
|
|
||||||
<script src="assets/course_sidebar.js"></script>
|
<script src="assets/course_sidebar.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue