first commit

This commit is contained in:
ocueye2 2024-08-29 21:36:14 +00:00
commit 85b44202f4
8 changed files with 229 additions and 0 deletions

10
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"configurations": [
{
"type": "chrome",
"name": "http://127.0.0.1:3000/test.html",
"request": "launch",
"url": "http://127.0.0.1:3000/test.html"
}
]
}

29
dash.py Normal file
View File

@ -0,0 +1,29 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
import sys
import os
def load(path):
file_path = os.path.join(os.path.dirname(sys.argv[0]), path)
with open(file_path, 'rb') as f: # Open the file in binary mode
return f.read() # Return the file content as bytes
# Define the request handler
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
# Handle GET requests
def do_GET(self):
if self.path == '/':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(load("render/render.html"))
# Set up and start the HTTP server
def run(server_class=HTTPServer, handler_class=SimpleHTTPRequestHandler, port=1111):
server_address = ('', port)
httpd = server_class(server_address, handler_class)
print(f"Starting HTTP server on port {port}")
httpd.serve_forever()
if __name__ == "__main__":
run()

82
render/render.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
casos
http://192.168.1.130
main docker gui
background-image: url("https://www.hostelworld.com/blog/wp-content/uploads/2018/12/denali-1313x875.jpg")

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
proxmox
http://192.168.1.1:8006
main vm server
background-image: url("https://www.hostelworld.com/blog/wp-content/uploads/2018/12/denali-1313x875.jpg")

45
start.py Normal file
View File

@ -0,0 +1,45 @@
import sys
import os
def load(path):
f = open(path)
return f.read()
def prepare(config):
config = config.splitlines()
out = f"""
<div class="item">
<a href="{config[1]}" style='{config[3]}'>
<h2>{config[0]}</h2>
<p>{config[2]}</p>
</a>
</div>
"""
return(out)
groups = os.listdir(f"{os.path.dirname(sys.argv[0])}/services")
html = ""
for i in groups:
items = os.listdir(f"{os.path.dirname(sys.argv[0])}/services/{i}")
html = html + f"""
<h1>{i}</h1>
<div class="group">
"""
for a in items:
temp = load(f"{os.path.dirname(sys.argv[0])}/services/{i}/{a}")
html = html + prepare(temp)
html = html + "</div>"
css = open(f"{os.path.dirname(sys.argv[0])}/template/temp.css")
html = f"""
<style>
{css.read()}
</style>
{html}
"""
f = open(f"{os.path.dirname(sys.argv[0])}/render/render.html","w")
f.write(html)
exec(load(f"{os.path.dirname(sys.argv[0])}/dash.py"))

51
template/temp.css Normal file
View File

@ -0,0 +1,51 @@
.group {
display: grid;
grid-template-rows: 1fr;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
grid-gap: .5vw;
}
body {
color: rgb(67, 95, 102);
}
h1 {
background-color: rgb(37, 56, 55);
color: #CCCCCC;
}
a {
font: bold 11px Arial;
text-decoration: none;
background-color: #EEEEEE;
color: #333333;
padding: 10px 20px;
border-radius: 20px;
transition: all 0.3s ease;
transform: scale(1);
display: inline-block;
transform-origin: center;
background-size: contain;
background-repeat: initial;
}
a:hover {
transform: scale(1.5);
background-color: #CCCCCC;
}
h2 {
background-color: rgba(58, 61, 61, 0.548);
color: #EEEEEE;
border-radius: 10px;
padding: 5px;
}
p {
color: #EEEEEE;
background-color: rgba(82, 82, 82, 0.555);
border-radius: 10px;
padding: 5px;
}