From e9ceb61476434304618a2c88f0ccfa61fb84e986 Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Mon, 20 May 2024 16:16:57 +0200 Subject: [PATCH] feat: support async threads; add static/reset.css --- requirements.txt | 2 ++ static/reset.css | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ web.py | 22 +++++++------- 3 files changed, 91 insertions(+), 11 deletions(-) create mode 100644 static/reset.css diff --git a/requirements.txt b/requirements.txt index a2d2551..ad0936f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,5 @@ flask-caching # threads requests markdown +aiohttp +flask[async] diff --git a/static/reset.css b/static/reset.css new file mode 100644 index 0000000..0129c21 --- /dev/null +++ b/static/reset.css @@ -0,0 +1,78 @@ +/** +THANKS TO JOSH COMEAU FOR HIS CUSTOM CSS RESET +👉 https://www.joshwcomeau.com/css/custom-css-reset/ +**/ + +/* + 1. Use a more-intuitive box-sizing model. +*/ +*, +*::before, +*::after { + box-sizing: border-box; +} +/* + 2. Remove default margin + */ +* { + margin: 0; +} +/* + 3. Allow percentage-based heights in the application + */ +html, +body { + height: 100%; +} +/* + Typographic tweaks! + 4. Add accessible line-height + 5. Improve text rendering + */ +body { + line-height: 1.5; + -webkit-font-smoothing: antialiased; +} +/* + 6. Improve media defaults + */ +img, +picture, +video, +canvas, +svg, +iframe { + display: block; + max-width: 100%; + margin: 0 auto; +} +/* + 7. Remove built-in form typography styles + */ +input, +button, +textarea, +select { + font: inherit; +} +/* + 8. Avoid text overflows + */ +p, +h1, +h2, +h3, +h4, +h5, +h6 { + overflow-wrap: break-word; +} +/* + 9. Create a root stacking context + */ +#root, +#__next { + isolation: isolate; +} + + diff --git a/web.py b/web.py index 2cada13..32e41da 100755 --- a/web.py +++ b/web.py @@ -5,17 +5,6 @@ import json app = Flask(__name__) app.config.from_file("config.json", load=json.load) -# /threads -try: - from threads.threads import threads - app.register_blueprint(threads, url_prefix='/threads') - print(' * Threads blueprint registered') - from threads.cache import cache as thread_cache - print(' * Threads cache type: ' + app.config["CACHE_TYPE"]) - thread_cache.init_app(app) -except ImportError: - print(' ! Threads blueprint not found') - # perf monitoring & error tracking sentry_config = app.config["SENTRY"] print(' * Monitoring DSN: ' + sentry_config["dsn"]) @@ -26,6 +15,17 @@ sentry_sdk.init( enable_tracing=sentry_config["enable_tracing"], ) +# threads +try: + from threads.threads import threads + app.register_blueprint(threads, url_prefix='/threads') + print(' * Threads blueprint registered') + from threads.cache import cache as thread_cache + print(' * Threads cache type: ' + app.config["CACHE_TYPE"]) + thread_cache.init_app(app) +except ImportError: + print(' ! Threads blueprint not found') + @app.route('/') def home(): return send_from_directory('dist', 'index.html')