97 lines
3.0 KiB
HTML
97 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<link rel="icon" type="image/png" sizes="96x96" href="{{ url_for('static', filename='favicon-96x96.png') }}">
|
|
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='favicon.svg') }}">
|
|
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='apple-touch-icon.png') }}">
|
|
<meta name="apple-mobile-web-app-title" content="Timtabla">
|
|
<link rel="manifest" href="{{ url_for('static', filename='site.webmanifest') }}">
|
|
<meta charset="UTF-8">
|
|
<title>Timtabla</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 0;
|
|
height: 100vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
background: linear-gradient(135deg, #03551B, #0b3c5d);
|
|
}
|
|
|
|
.login-box {
|
|
background:white;
|
|
padding:30px;
|
|
border-radius:8px;
|
|
box-shadow:0 0 10px rgba(0,0,0,0.1);
|
|
width:300px;
|
|
}
|
|
input {
|
|
width:100%;
|
|
padding:8px;
|
|
margin:8px 0;
|
|
}
|
|
button {
|
|
width:100%;
|
|
padding:10px;
|
|
background:#0066cc;
|
|
color:white;
|
|
border:none;
|
|
cursor:pointer;
|
|
}
|
|
button:hover {
|
|
background:#004999;
|
|
}
|
|
.error {
|
|
color:red;
|
|
margin-top:10px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-box">
|
|
<h2>Login to Download</h2>
|
|
<input type="text" id="username" placeholder="Username" required>
|
|
<input type="password" id="password" placeholder="Password" required>
|
|
<button onclick="loginAndDownload()">Login & Download</button>
|
|
<div class="error" id="errorMsg"></div>
|
|
</div>
|
|
<script>
|
|
async function loginAndDownload() {
|
|
const username = document.getElementById("username").value;
|
|
const password = document.getElementById("password").value;
|
|
const errorMsg = document.getElementById("errorMsg");
|
|
errorMsg.textContent = "";
|
|
|
|
try {
|
|
const response = await fetch("/login-and-download", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ username, password })
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error("Invalid login or server error");
|
|
}
|
|
|
|
const blob = await response.blob();
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
|
const a = document.createElement("a");
|
|
a.href = url;
|
|
a.download = "timetable.ics";
|
|
document.body.appendChild(a);
|
|
a.click();
|
|
a.remove();
|
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
} catch (err) {
|
|
errorMsg.textContent = err.message;
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|