feat: support async threads; add static/reset.css

This commit is contained in:
Ayo Ayco 2024-05-20 16:16:57 +02:00
parent b8915b6dbb
commit e9ceb61476
3 changed files with 91 additions and 11 deletions

View file

@ -6,3 +6,5 @@ flask-caching
# threads
requests
markdown
aiohttp
flask[async]

78
static/reset.css Normal file
View file

@ -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;
}

22
web.py
View file

@ -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')