Compare commits
14 Commits
build/migr
...
f3f521efe2
| Author | SHA1 | Date | |
|---|---|---|---|
|
f3f521efe2
|
|||
|
feb7a71816
|
|||
|
e15f02be05
|
|||
|
5031799072
|
|||
|
26fac14802
|
|||
|
75694f9200
|
|||
|
522c14793a
|
|||
|
9a074f17d8
|
|||
|
6ec1af2cf7
|
|||
|
ff911bc8bc
|
|||
|
446e5fbc04
|
|||
|
04c46f1e98
|
|||
|
2786f39b9b
|
|||
|
ad479fe0d7
|
22
.vscode/launch.json
vendored
Normal file
22
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Launch Flask",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "flask",
|
||||||
|
"env": {
|
||||||
|
"FLASK_APP": "judas_server/web/web_server.py",
|
||||||
|
},
|
||||||
|
"args": [
|
||||||
|
"run",
|
||||||
|
],
|
||||||
|
"console": "internalConsole",
|
||||||
|
"justMyCode": true,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -4,6 +4,27 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #b48ead;
|
||||||
|
font-family: monospace, sans-serif !important;
|
||||||
|
color: #eceff4;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
font-family: inherit;
|
||||||
|
color: #eceff4;
|
||||||
|
background-color: #434c5e;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -14,7 +35,32 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
padding: 2rem;
|
padding: 1rem;
|
||||||
background-color: #eceff4;
|
background-color: #3b4252;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
header a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #eceff4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
background-color: #8fbcbb;
|
||||||
color: #2e3440;
|
color: #2e3440;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
background-color: #81a1c1;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<header>
|
<header>
|
||||||
<h1><a href="{{ url_for('panel') }}">judas panel</a></h1>
|
<h1><a href="{{ url_for('index') }}">judas</a></h1>
|
||||||
<p>Welcome, {{ username }}! <a href="{{ url_for('logout') }}">Logout</a></p>
|
<p><a class="button" href="{{ url_for('logout') }}">Logout</a></p>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<h2>Details for PC ID: {{ pc.id }}</h2>
|
<h2>Details for PC ID: {{ pc.id }}</h2>
|
||||||
|
|||||||
@@ -9,13 +9,41 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<header>
|
<header>
|
||||||
<h1>judas</h1>
|
<h1><a href="{{ url_for('index') }}">judas</a></h1>
|
||||||
{% if logged %}
|
{% if logged %}
|
||||||
<p>Welcome, {{ username }}! <a href="{{ url_for('logout') }}">Logout</a></p>
|
<p>Welcome, {{ username }}! <a href="{{ url_for('logout') }}">Logout</a></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p><a href="{{ url_for('login') }}">Login</a></p>
|
<p><a class="button" href="{{ url_for('login') }}">Login</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</header>
|
</header>
|
||||||
|
<main class="center">
|
||||||
|
<p>Welcome to</p>
|
||||||
|
<h2 id="typing-text" style="font-size: 3rem;">judas</h2>
|
||||||
|
<p>a remote PC fleet management system</p>
|
||||||
|
<br>
|
||||||
|
<p style="color: #bf616a;"><strong>Notice:</strong> Please use this system responsibly and in accordance with all applicable laws and organizational policies.</p>
|
||||||
|
<p>Please log in to manage your remote PCs.</p>
|
||||||
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
var i = 0;
|
||||||
|
var txt = document.getElementById("typing-text").innerHTML;
|
||||||
|
var minSpeed = 50;
|
||||||
|
var maxSpeed = 200;
|
||||||
|
|
||||||
|
document.getElementById("typing-text").innerHTML = "";
|
||||||
|
|
||||||
|
function typeWriter() {
|
||||||
|
if (i < txt.length) {
|
||||||
|
document.getElementById("typing-text").innerHTML += txt.charAt(i);
|
||||||
|
i++;
|
||||||
|
|
||||||
|
var randomDelay = Math.floor(Math.random() * (maxSpeed - minSpeed + 1)) + minSpeed;
|
||||||
|
setTimeout(typeWriter, randomDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typeWriter();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
24
judas_server/web/templates/login.html
Normal file
24
judas_server/web/templates/login.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>judas - login page</title>
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="wrapper">
|
||||||
|
<header>
|
||||||
|
<h1><a href="{{ url_for('index') }}">judas</a></h1>
|
||||||
|
</header>
|
||||||
|
<main class="center">
|
||||||
|
<form method="post">
|
||||||
|
<label for="password">Password:</label>
|
||||||
|
<input type="password" id="password" name="password" required>
|
||||||
|
<br><br>
|
||||||
|
<input type="submit" value="Login" class="button">
|
||||||
|
</form>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<header>
|
<header>
|
||||||
<h1><a href="{{ url_for('panel') }}">judas panel</a></h1>
|
<h1><a href="{{ url_for('index') }}">judas</a></h1>
|
||||||
<p>Welcome, {{ username }}! <a href="{{ url_for('logout') }}">Logout</a></p>
|
<p><a class="button" href="{{ url_for('logout') }}">Logout</a></p>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<table border="1">
|
<table border="1">
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<header>
|
<header>
|
||||||
<h1><a href="{{ url_for('panel') }}">judas panel</a></h1>
|
<h1><a href="{{ url_for('index') }}">judas</a></h1>
|
||||||
<p>Welcome, {{ username }}! <a href="{{ url_for('logout') }}">Logout</a></p>
|
<p><a class="button" href="{{ url_for('logout') }}">Logout</a></p>
|
||||||
</header>
|
</header>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -52,12 +52,10 @@ def load_user(user_id: str) -> User | None:
|
|||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index() -> str:
|
def index() -> flask.Response | str:
|
||||||
"""Renders the index page with a link to the login page."""
|
"""Renders the index page with a link to the login page."""
|
||||||
if flask_login.current_user.is_authenticated:
|
if flask_login.current_user.is_authenticated:
|
||||||
return flask.render_template(
|
return flask.redirect(flask.url_for("panel"))
|
||||||
"index.html", logged=True, username=flask_login.current_user.id
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
return flask.render_template(
|
return flask.render_template(
|
||||||
"index.html", logged=False, login_url=flask.url_for("login")
|
"index.html", logged=False, login_url=flask.url_for("login")
|
||||||
@@ -75,12 +73,7 @@ def login() -> str:
|
|||||||
return flask.redirect(flask.url_for("panel"))
|
return flask.redirect(flask.url_for("panel"))
|
||||||
else:
|
else:
|
||||||
return "Invalid password", 401
|
return "Invalid password", 401
|
||||||
return """
|
return flask.render_template("login.html")
|
||||||
<form method="post">
|
|
||||||
Password: <input type="password" name="password">
|
|
||||||
<input type="submit" value="Login">
|
|
||||||
</form>
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/logout")
|
@app.route("/logout")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ readme = "README.md"
|
|||||||
license = {text = "GPL-3.0"}
|
license = {text = "GPL-3.0"}
|
||||||
|
|
||||||
[tool.pdm.scripts]
|
[tool.pdm.scripts]
|
||||||
start = "flask --app judas_server/web/web_server.py run"
|
web = "flask --app judas_server/web/web_server.py run"
|
||||||
|
|
||||||
[tool.pdm]
|
[tool.pdm]
|
||||||
distribution = false
|
distribution = false
|
||||||
|
|||||||
Reference in New Issue
Block a user