wyciagniecie css z plikow html

This commit is contained in:
Mateusz779 2023-04-24 10:22:17 +02:00
parent d397dfa11f
commit 913af1fc76
9 changed files with 173 additions and 161 deletions

8
app.py
View File

@ -13,6 +13,7 @@ import machines
app = Flask(__name__) app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = "squash" app.config['UPLOAD_FOLDER'] = "squash"
app.config['STYLE_FOLDER'] = "style"
app.config['MAX_CONTENT_LENGTH'] = 1024 * 1024 * 512 # 512MB app.config['MAX_CONTENT_LENGTH'] = 1024 * 1024 * 512 # 512MB
utils.init_threads() utils.init_threads()
@ -220,5 +221,12 @@ def add_ip():
return jsonify(message="400") return jsonify(message="400")
@app.route("/style/<string:name>")
def get_style(name):
try:
return send_file(os.path.join(app.config['STYLE_FOLDER'], name))
except:
return "", 404
if __name__ == '__main__': if __name__ == '__main__':
app.run(host="0.0.0.0") app.run(host="0.0.0.0")

View File

@ -1,3 +1,2 @@
#!/bin/sh #!/bin/sh
ifconfig $TAP 10.20.0.10 netmask 255.255.255.0 up ifconfig $TAP 10.20.0.10 netmask 255.255.255.0 up

63
style/create.css Normal file
View File

@ -0,0 +1,63 @@
/* styl dla całej strony */
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
/* styl dla sekcji formularza */
form {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
}
/* styl dla tytułu formularza */
form h2 {
text-align: center;
font-weight: bold;
margin-bottom: 20px;
}
/* styl dla etykiet formularza */
form label {
display: block;
font-weight: bold;
margin-bottom: 5px;
}
/* styl dla pól formularza */
form input[type="text"],
form input[type="password"],
form input[type="number"],
form textarea {
width: 100%;
padding: 10px;
border: 2px solid #ccc;
border-radius: 5px;
margin-bottom: 20px;
font-size: 16px;
}
form input[type="submit"] {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px 0;
cursor: pointer;
}
form input[type="submit"] {
background-color: #3e8e41;
}
form textarea {
resize: none;
}

52
style/index.css Normal file
View File

@ -0,0 +1,52 @@
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
h1 {
font-size: 32px;
font-weight: bold;
color: #333;
margin: 20px 0;
}
table {
border-collapse: collapse;
margin: 20px 0;
width: 100%;
}
table th, table td {
padding: 10px;
text-align: left;
vertical-align: middle;
border: 1px solid #ccc;
}
table th {
background-color: #eee;
font-weight: bold;
}
table tr:hover {
background-color: #f0f0f0;
}
button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px 0;
cursor: pointer;
}
button:hover {
background-color: #3e8e41;
}

46
style/login.css Normal file
View File

@ -0,0 +1,46 @@
body {
background-color: #F2F2F2;
font-family: Arial, sans-serif;
}
#login-box {
background-color: #FFFFFF;
border-radius: 10px;
padding: 20px;
width: 400px;
margin: 0 auto;
margin-top: 100px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
font-size: 28px;
margin-top: 0;
}
input[type=text],
input[type=password] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: none;
border-radius: 5px;
background-color: #F2F2F2;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
font-size: 16px;
}
input[type=submit] {
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
padding: 10px;
font-size: 16px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #3e8e41;
}

View File

@ -3,9 +3,7 @@
<head> <head>
<title>{% block title %}{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
{% block style %}{% endblock %} {% block style %}{% endblock %}
</style>
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <nav class="navbar navbar-expand-lg navbar-light bg-light">

View File

@ -1,69 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}Tworzenie obrazu{% endblock %} {% block title %}Tworzenie obrazu{% endblock %}
{% block style %} {% block style %}
/* styl dla całej strony */ <link rel="stylesheet" href="/style/create.css" />
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
/* styl dla sekcji formularza */
form {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
}
/* styl dla tytułu formularza */
form h2 {
text-align: center;
font-weight: bold;
margin-bottom: 20px;
}
/* styl dla etykiet formularza */
form label {
display: block;
font-weight: bold;
margin-bottom: 5px;
}
/* styl dla pól formularza */
form input[type="text"],
form input[type="password"],
form input[type="number"],
form textarea {
width: 100%;
padding: 10px;
border: 2px solid #ccc;
border-radius: 5px;
margin-bottom: 20px;
font-size: 16px;
}
form input[type="submit"] {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px 0;
cursor: pointer;
}
form input[type="submit"] {
background-color: #3e8e41;
}
form textarea {
resize: none;
}
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -1,59 +1,8 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}Panel administracyjny{% endblock %} {% block title %}Panel administracyjny{% endblock %}
{% block style %} {% block style %}
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
h1 {
font-size: 32px;
font-weight: bold;
color: #333;
margin: 20px 0;
}
table {
border-collapse: collapse;
margin: 20px 0;
width: 100%;
}
table th, table td {
padding: 10px;
text-align: left;
vertical-align: middle;
border: 1px solid #ccc;
}
table th {
background-color: #eee;
font-weight: bold;
}
table tr:hover {
background-color: #f0f0f0;
}
button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px 0;
cursor: pointer;
}
button:hover {
background-color: #3e8e41;
}
<link rel="stylesheet" href="/style/index.css" />
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -3,49 +3,8 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Strona logowania</title> <title>Strona logowania</title>
<link rel="stylesheet" href="/style/login.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
body {
background-color: #F2F2F2;
font-family: Arial, sans-serif;
}
#login-box {
background-color: #FFFFFF;
border-radius: 10px;
padding: 20px;
width: 400px;
margin: 0 auto;
margin-top: 100px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
font-size: 28px;
margin-top: 0;
}
input[type=text], input[type=password] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: none;
border-radius: 5px;
background-color: #F2F2F2;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
font-size: 16px;
}
input[type=submit] {
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
padding: 10px;
font-size: 16px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #3e8e41;
}
</style>
</head> </head>
<body> <body>
<div id="login-box"> <div id="login-box">