made deployment finally prod ready

This commit is contained in:
2025-10-19 16:36:21 +02:00
parent b163ec9bd9
commit ec719c375f
16 changed files with 1938 additions and 154 deletions

View File

@@ -102,7 +102,7 @@ def index():
if not token:
return redirect(url_for("main.set_token"))
else:
return render_template('index.html', active_banner=get_active_banner(), decks=get_unlocked_decks(token), user_name=token.name, active_course=token.active_course, courses=get_all_courses())
return render_template('index.html', active_banner=get_active_banner(), decks=get_unlocked_decks(token), user_name=token.name, active_course_name=token.active_course.name, courses=get_all_courses())
@main.route('/set_token', methods=['POST', 'GET'])
def set_token():
@@ -291,8 +291,7 @@ def serve_deck(deck, course_folder, path='index.html'):
@main.route('/admin', methods=['GET', 'POST'])
@flask_login.login_required
def admin():
active_course_id = flask_login.current_user.active_course_id
active_course = get_course(active_course_id)
active_course = get_course(flask_login.current_user.active_course_id)
if active_course is None:
raise Exception
deck_form = DeckForm()
@@ -338,7 +337,7 @@ def admin():
print(f"Error in {getattr(password_form, field).label.text}: {error}", flush=True)
return redirect(url_for('main.admin'))
return render_template("admin.html", deck_form=deck_form, password_form=password_form, decks=decks, passwords=get_passwords(active_course), courses=get_all_courses(), active_course_id=active_course_id)
return render_template("admin.html", deck_form=deck_form, password_form=password_form, decks=decks, passwords=get_passwords(active_course), courses=get_all_courses(), active_course_name=active_course.name)
@main.route('/admin/switch_course/<new_course>', methods=['POST'])
@flask_login.login_required

1
app/static/css/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
output.css

3
app/static/css/input.css Normal file
View File

@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

BIN
app/static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -6,31 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Deck Admin</title>
<!-- Tailwind CSS v4.1.4 CDN -->
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script>
<!-- Tailwind Config (Dark Mode + Theme Colors) -->
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
background: '#121418', // dark slate with blue/gray tone
surface: '#1e2127', // a bit lighter for containers/cards
border: '#2a2d34', // visible but subtle borders
primary: '#4f8cff', // soft blue that pops but is not neon
text: '#e4e4e7', // light gray for high contrast
muted: '#a0a0ad', // for subdued text
},
},
}
};
</script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/output.css') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<!-- Flowbite -->
<link href="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.css" rel="stylesheet">
</head>
<body class="bg-background text-text min-h-screen font-sans">
<nav class="bg-white border-gray-200 dark:bg-gray-900">
@@ -42,12 +21,8 @@
<div class="relative group">
<button class="flex items-center text-gray-900 dark:text-white hover:text-blue-700 dark:hover:text-blue-500 font-medium py-2 px-3 rounded-lg bg-transparent">
{% for course in courses %}
{% if course.id == active_course_id %}
{{ course.name }}
{% endif %}
{% endfor %}
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
{{active_course_name}}
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
</svg>
</button>

View File

@@ -4,15 +4,8 @@
<meta charset="UTF-8">
<title>Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Flowbite -->
<script src="https://unpkg.com/flowbite@2.3.0/dist/flowbite.min.js"></script>
<script>
tailwind.config = {
darkMode: 'class',
};
</script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/output.css') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen flex items-center justify-center">

View File

@@ -1,33 +1,14 @@
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Banner</title>
<!-- Tailwind CSS v4.1.4 CDN -->
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/output.css') }}">
<!-- Tailwind Config (Dark Mode + Theme Colors) -->
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
background: '#121418', // dark slate with blue/gray tone
surface: '#1e2127', // a bit lighter for containers/cards
border: '#2a2d34', // visible but subtle borders
primary: '#4f8cff', // soft blue that pops but is not neon
text: '#e4e4e7', // light gray for high contrast
muted: '#a0a0ad', // for subdued text
},
},
}
};
</script>
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<!-- Flowbite -->
<link href="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.css" rel="stylesheet" />
</head>
<body class="bg-background text-text min-h-screen font-sans">

View File

@@ -3,30 +3,8 @@
<head>
<meta charset="utf-8">
<title>Live Confusion Alerts</title>
<!-- Tailwind DEV CDN (for production, use your compiled CSS) -->
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.7.1/socket.io.min.js"></script>
<!-- Tailwind Config (Dark Mode + Theme Colors) -->
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
background: '#121418', // dark slate with blue/gray tone
surface: '#1e2127', // a bit lighter for containers/cards
border: '#2a2d34', // visible but subtle borders
primary: '#4f8cff', // soft blue that pops but is not neon
text: '#e4e4e7', // light gray for high contrast
muted: '#a0a0ad', // for subdued text
},
},
}
};
</script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/output.css') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>
<body class="bg-background min-h-screen">
<nav class="bg-white border-gray-200 dark:bg-gray-900">

View File

@@ -4,38 +4,15 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tutorial Materials</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/output.css') }}">
<!-- Tailwind CSS v4.1.4 CDN -->
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script>
<!-- Tailwind Config (Dark Mode + Theme Colors) -->
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
background: '#121418', // dark slate with blue/gray tone
surface: '#1e2127', // a bit lighter for containers/cards
border: '#2a2d34', // visible but subtle borders
primary: '#4f8cff', // soft blue that pops but is not neon
text: '#e4e4e7', // light gray for high contrast
muted: '#a0a0ad', // for subdued text
},
},
}
};
</script>
<!-- Flowbite -->
<link href="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.css" rel="stylesheet" />
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<!-- in base.html, in <head> or just before </body> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.7.1/socket.io.min.js"></script>
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
</head>
@@ -83,11 +60,7 @@
<div class="flex justify-center">
<div class="relative group">
<button class="flex items-center text-gray-900 dark:text-white hover:text-blue-700 dark:hover:text-blue-500 font-medium py-1 px-3 rounded-lg bg-transparent text-2xl">
{% for course in courses %}
{% if course.id == active_course.id %}
{{ course.name }}
{% endif %}
{% endfor %}
{{active_course_name}}
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
</svg>
@@ -167,19 +140,5 @@
<script src="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js"></script>
<script>
function enableUsernameEdit() {
const input = document.getElementById('usernameInput');
const editBtn = document.getElementById('editBtn');
const saveBtn = document.getElementById('saveBtn');
input.removeAttribute('disabled');
input.classList.add('border-border');
input.focus();
editBtn.classList.add('hidden');
saveBtn.classList.remove('hidden');
}
</script>
</body>
</html>

View File

@@ -4,16 +4,10 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register for Tutortool</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
@apply bg-background text-text font-sans;
background-color: #1a202c;
color: #a0aec0;
}
</style>
<link rel="stylesheet" href="{{ url_for('static', filename='css/output.css') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>
<body class="flex items-center justify-center min-h-screen">
<body class="flex items-center justify-center min-h-screen bg-background">
<div class="bg-gray-800 p-8 rounded-lg shadow-lg max-w-md w-full border border-gray-700">
<div class="text-center mb-6">
<h1 class="text-3xl font-bold text-white mb-2">Create an Account</h1>
@@ -58,7 +52,7 @@
</button>
</form>
<p class="text-center mt-4 text-sm">
<p class="text-center mt-4 text-sm text-text">
Already have an account? <a href="/set_token" class="text-blue-400 hover:underline">Log In</a>
</p>
</div>

View File

@@ -4,16 +4,10 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register for Tutortool</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
@apply bg-background text-text font-sans;
background-color: #1a202c;
color: #a0aec0;
}
</style>
<link rel="stylesheet" href="{{ url_for('static', filename='css/output.css') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>
<body class="flex items-center justify-center min-h-screen">
<body class="flex items-center justify-center min-h-screen bg-background">
<div class="bg-gray-800 p-8 rounded-lg shadow-lg max-w-md w-full border border-gray-700">
<div class="text-center mb-6">
<h1 class="text-3xl font-bold text-white mb-2">Login</h1>
@@ -44,7 +38,7 @@
</button>
</form>
<p class="text-center mt-4 text-sm">
<p class="text-center mt-4 text-sm text-text">
Do not have an Account? <a href="/register" class="text-blue-400 hover:underline">Create one</a>
</p>
</div>