From 9d082e4264308d4ecd1940b72ae83a849a18b784 Mon Sep 17 00:00:00 2001 From: Joost Agterhoek Date: Thu, 29 May 2025 21:15:30 +0200 Subject: [PATCH] some corrections, restyling, etc. --- flask_soc_site/__init__.py | 3 +- flask_soc_site/src/host_lookup.py | 2 +- flask_soc_site/static/styles/style.css | 67 +++-------- flask_soc_site/templates/lookup.html | 14 +-- requirements.txt | 155 ++++++++++++++++++++----- 5 files changed, 153 insertions(+), 88 deletions(-) diff --git a/flask_soc_site/__init__.py b/flask_soc_site/__init__.py index d62addd..4135ac4 100644 --- a/flask_soc_site/__init__.py +++ b/flask_soc_site/__init__.py @@ -1,4 +1,5 @@ import os +import pickle from flask import Flask, redirect, url_for, render_template, request, flash from .src import host_lookup from dotenv import load_dotenv @@ -38,7 +39,6 @@ def create_app(test_config=None): if request.method == "GET": return render_template("lookup.html") elif request.method == "POST" and any(request.form.get("host")): - print(f'REQUEST.FORM.GET("HOST") IS {request.form.get("host")}') user_input = escape(request.form.get("host").strip()) hosts, errors = host_lookup.process_input(user_input) for host in hosts: @@ -56,6 +56,7 @@ def create_app(test_config=None): errors_present=errors_present, results_present=results_present, ) + else: flash("Nothing entered! Try again?", "error") return render_template("lookup.html") diff --git a/flask_soc_site/src/host_lookup.py b/flask_soc_site/src/host_lookup.py index 03ee1cf..f78f316 100644 --- a/flask_soc_site/src/host_lookup.py +++ b/flask_soc_site/src/host_lookup.py @@ -96,7 +96,7 @@ def determine(host): def online(host): - if host.startswith("http://", "https://"): + if host.startswith(("http://", "https://")): try: requests.get(host) return True diff --git a/flask_soc_site/static/styles/style.css b/flask_soc_site/static/styles/style.css index 61034d2..30b88fa 100644 --- a/flask_soc_site/static/styles/style.css +++ b/flask_soc_site/static/styles/style.css @@ -9,60 +9,34 @@ body { font-family: 'DM Mono', monospace; } -.no_bullets { +/* Already tried: https://dev.to/roccosangellino/how-to-build-a-simple-navbar-with-html-and-css-945 */ +.navbar {} + +.navbar ul { list-style-type: none; - padding: 0; margin: 0; + padding: 0; + overflow: hidden; + background-color: #ffc100; } -a { +.navbar li { + float: left; +} + +.navbar li a { + display: block; + color: black; + text-align: center; + padding: 14px 16px; text-decoration: none; } -.navbar { - - display: flex; - align-items: center; - background-color: #333333; +.navbar li a:hover { + background-color: #eed519; } -.navbar a { - color: #e7e7e7; -} - -.navbar ul { - margin: 0; - padding: 0; - list-style-type: 0; - display: flex; - align-items: center; -} - -.navbar .brand { - display: block; - color: #e7e7e7; - padding: 0 24px; - font-size: 24px; -} - -.navbar ul li a { - color: #e7e7e7; - padding: 24px; - display: block; -} - -.navbar ul a:hover, -.navbar ul a:focus { - background-color: #272727; -} - -.headings { - color: #fdc105; - display: flex; - justify-content: center; -} - .lookup_container { display: flex; justify-content: center; @@ -196,9 +170,7 @@ a { display: grid; justify-content: center; justify-items: center; - /* background-image: url(/static/background/cool-background-trianglify.png);*/ - */ - /* + background-image: url(/static/background/cool-background-trianglify.png);*/ background-color: #ffc100; */ } @@ -350,7 +322,6 @@ a { border-radius: 3px; } - #myTable { /* background-color: #fad253; */ border-collapse: collapse; diff --git a/flask_soc_site/templates/lookup.html b/flask_soc_site/templates/lookup.html index f43bd67..459d1a1 100644 --- a/flask_soc_site/templates/lookup.html +++ b/flask_soc_site/templates/lookup.html @@ -1,16 +1,14 @@ -{% extends "layout.html" %} - +{% extends "layout.html" %} + {% block content %} -{% include "navbar.html" %} - - - {% include "test.html" %} - - {% include "empty_form.html" %} +{% include "results.html" %} + +{% include "temp.html" %} + {% endblock %} diff --git a/requirements.txt b/requirements.txt index f6418c1..424900c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,32 +1,127 @@ -attrs==24.2.0 -blinker==1.8.2 -cattrs==24.1.0 -certifi==2024.7.4 -cffi==1.17.0 -charset-normalizer==3.3.2 -checkdmarc==5.5.0 -click==8.1.7 -cryptography==43.0.0 -dnspython==2.0.0 -expiringdict==1.2.2 -Flask==3.0.3 -idna==3.8 -ipwhois==1.2.0 -itsdangerous==2.2.0 -Jinja2==3.1.4 -MarkupSafe==2.1.5 +aiodns==3.3.0 +aiohappyeyeballs==2.4.4 +aiohttp==3.10.11 +aiosignal==1.3.2 +appdirs==1.4.4 +attrs==25.1.0 +beautifulsoup4==4.13.4 +blosc2==2.7.1 +Bottleneck==1.4.2 +Brotli==1.1.0 +cached-property==2.0.1 +cachetools==5.5.1 +cffi==1.17.1 +chardet==5.2.0 +charset-normalizer==3.4.1 +colorama==0.4.6 +contourpy==1.3.2 +cryptography==44.0.0 +cycler==0.11.0 +dbus-python==1.3.2 +decorator==5.1.1 +defusedxml==0.7.1 +distlib==0.3.9 +distro==1.9.0 +dnf==4.23.0 +dnslib==0.9.21 +dpkt==1.9.8 +et_xmlfile==1.1.0 +filelock==3.15.4 +fonttools==4.56.0 +frozenlist==1.5.0 +fs==2.4.16 +fsspec==2025.3.2 +gcsfs==2024.9.0 +git-filter-repo==2.47.0 +google-api-core==2.11.1 +google-auth==2.38.0 +google-auth-oauthlib==1.2.1 +google-cloud-core==2.3.3 +google-cloud-storage==2.14.0 +google-crc32c==1.7.1 +google-resumable-media==2.7.2 +googleapis-common-protos==1.63.0 +greenlet==3.1.1 +grpcio==1.48.4 +grpcio-status==1.48.4 +h5py==3.12.1 +html5lib==1.1 +idna==3.10 +importlib_metadata==8.6.1 +jdcal==1.4.1 +Jinja2==3.1.6 +kiwisolver==1.4.8 +libcomps==0.1.21 +libdnf==0.74.0 +lxml==5.3.2 +MarkupSafe==3.0.2 +matplotlib==3.10.3 +msgpack==1.1.0 +multidict==6.1.0 +ndindex==1.9.2 +neovim==0.3.1 +numexpr==2.10.2 +numpy==2.2.5 +oauthlib==3.2.2 +odfpy==1.4.1 +olefile==0.47 +openpyxl==3.1.2 +packaging==24.2 +pandas==2.2.3 +pdfminer.six==20240706 +pillow==11.1.0 platformdirs==4.2.2 -publicsuffixlist==1.0.2.20240827 -pycparser==2.22 -pyleri==1.4.3 -python-dateutil==2.9.0.post0 -python-dotenv==1.0.1 -python-whois==0.9.4 +pluggy==1.5.0 +ply==3.11 +pooch==1.8.2 +protobuf==3.19.6 +psycopg2==2.9.9 +py-cpuinfo==9.0.0 +pyarrow==18.0.0 +pyasn1==0.6.1 +pyasn1_modules==0.4.1 +pycairo==1.25.1 +pycares==4.8.0 +pycparser==2.20 +PyGObject==3.50.0 +PyMySQL==1.1.1 +pynvim==0.5.2 +pyparsing==3.1.2 +pypng==0.0.21 +pyproject-api==1.9.0 +PyQt5==5.15.11 +PyQt5_sip==12.16.1 +pyshp==2.3.1 +PySocks==1.7.1 +python-dateutil==2.8.2 +pytz==2025.2 +QtPy==2.4.2 requests==2.32.3 -requests-cache==1.2.1 -six==1.16.0 -timeout-decorator==0.5.0 -url-normalize==1.4.3 -urllib3==2.2.2 -validators==0.33.0 -Werkzeug==3.0.4 +requests-oauthlib==1.3.1 +rpm==4.20.1 +rsa==4.9 +scipy==1.14.1 +setuptools==74.1.3 +six==1.17.0 +soupsieve==2.7 +SQLAlchemy==2.0.40 +systemd-python==235 +tables==3.10.1 +tabulate==0.9.0 +tasklib==2.5.1 +tox==4.25.0 +typing_extensions==4.12.2 +urllib3==2.3.0 +urwid==2.6.16 +virtualenv==20.29.1 +visidata==3.1.1 +vit==2.3.3 +vobject==0.9.8 +wcwidth==0.2.13 +webencodings==0.5.1 +xarray==2025.1.1 +xlrd==2.0.1 +XlsxWriter==3.2.3 +yarl==1.13.1 +zipp==3.21.0 +zstandard==0.23.0