Compare commits

...

2 commits

Author SHA1 Message Date
6cd8baf1c7
Add visitor count 2025-05-14 21:39:24 +02:00
f6d68b3eee
Add 88x31 images 2025-05-14 21:07:10 +02:00
21 changed files with 53 additions and 6 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.env
visitor_count

26
main.py
View file

@ -4,12 +4,20 @@ from dotenv import load_dotenv
from os import getenv
from ssl import get_server_certificate
from flask import Flask, request, render_template, Response, send_from_directory
import os
app = Flask(__name__)
app.config['TEMPLATES_AUTO_RELOAD'] = True
global unifi
VISITOR_COUNT_FILE = "visitor_count"
def main():
if not os.path.exists(VISITOR_COUNT_FILE):
os.mknod(VISITOR_COUNT_FILE)
with open(VISITOR_COUNT_FILE, "w") as f:
f.write("0")
load_dotenv()
HOSTNAME = str(getenv("HOSTNAME"))
@ -22,16 +30,30 @@ def main():
#unifi = UnifiClient(host=HOSTNAME,
# username=USERNAME, password=PASSWORD, cert=cert)
app.run(host="0.0.0.0", port=80)
app.run(host="0.0.0.0", port=8080)
@app.route('/guest/s/default/', methods=["GET"])
def root():
visitor_count = 1337
# Yes there is a race condition here, I don't care
try:
with open(VISITOR_COUNT_FILE, "r+") as f:
visitors = int(f.read().strip())
print("visitors:", visitors)
visitors += 1
f.seek(0)
f.write(str(visitors))
f.truncate()
visitor_count = visitors
except Exception as e:
print(f"error {e}")
ap = escape(request.args.get('ap'))
id = escape(request.args.get('id'))
ssid = escape(request.args.get('ssid'))
url = escape(request.args.get('url'))
page = render_template("index.html", ap=ap, id=id, ssid=ssid, url=url)
page = render_template("index.html", ap=ap, id=id, ssid=ssid, url=url, visitor_count=visitor_count)
response = Response(page, mimetype="text/html")
return response

BIN
static/anybestviewed.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/button25.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
static/cc-by-nc-sa.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
static/danger_dhmo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/desp-anim.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
static/gimp.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
static/gnu-linux.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

BIN
static/html3_s1.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
static/ieisevil (3).gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
static/ipv6.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
static/linux-p.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

BIN
static/masto.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
static/ublock-now.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

BIN
static/valid-html32.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
static/y2k (1).gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -50,15 +50,39 @@
<LI><I>24/7</I> doe-het-zelf helpdesk voor al uw internetvragen</LI>
</UL>
</P>
<HR></HR>
<HR>
<P>
<FORM method="POST" action="/connect">
<CENTER>
<IMG SRC="/afbeeldingen/anybestviewed.gif">
<IMG SRC="/afbeeldingen/best_viewed_with_open_eyes.gif">
<IMG SRC="/afbeeldingen/button25.gif">
<IMG SRC="/afbeeldingen/cc-by-nc-sa.gif">
<IMG SRC="/afbeeldingen/danger_dhmo.gif">
<IMG SRC="/afbeeldingen/desp-anim.gif">
<IMG SRC="/afbeeldingen/gimp.gif">
<IMG SRC="/afbeeldingen/gnu-linux.gif"">
<IMG SRC="/afbeeldingen/html3_s1.gif">
<IMG SRC="/afbeeldingen/ieisevil (3).gif">
<IMG SRC="/afbeeldingen/ipv6.gif">
<IMG SRC="/afbeeldingen/linux-p.gif">
<IMG SRC="/afbeeldingen/masto.gif">
<IMG SRC="/afbeeldingen/tumblr_ou69gmb2xM1wvu485o9_100.gif">
<IMG SRC="/afbeeldingen/ublock-now.png">
<IMG SRC="/afbeeldingen/valid-html32.gif">
<IMG SRC="/afbeeldingen/vim.vialle.love.anim.gif">
<IMG SRC="/afbeeldingen/y2k (1).gif">
</CENTER>
</P>
<HR>
<P>
<CENTER>
<H2>U BENT BEZOEKER <FONT COLOR="red"><BLINK>{{visitor_count}}</BLINK></FONT>!</H2>
</CENTER>
<FORM METHOD="POST" ACTION="/connect">
<INPUT TYPE="hidden" NAME="id" VALUE="{{id}}">
<CENTER><INPUT TYPE="image" VALUE="Verbind nu!" src="/afbeeldingen/verbind.gif"></INPUT></CENTER>
</FORM>
</P>
TODO: 88x31 en visitor count
</TD>
</TR>
</TABLE>
</BODY>