forked from tanner/qotnews
feat: Link compiled CSS bundle for non-JS client
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -40,6 +40,17 @@ def new_id():
|
|||||||
return nid
|
return nid
|
||||||
|
|
||||||
build_folder = './build'
|
build_folder = './build'
|
||||||
|
|
||||||
|
css_file = None
|
||||||
|
try:
|
||||||
|
css_dir = os.path.join(build_folder, 'static', 'css')
|
||||||
|
for f in os.listdir(css_dir):
|
||||||
|
if f.endswith('.css'):
|
||||||
|
css_file = f
|
||||||
|
break
|
||||||
|
except FileNotFoundError:
|
||||||
|
logging.warning('CSS file not found. Run webclient build.')
|
||||||
|
|
||||||
flask_app = Flask(__name__, template_folder=build_folder, static_folder=build_folder, static_url_path='')
|
flask_app = Flask(__name__, template_folder=build_folder, static_folder=build_folder, static_url_path='')
|
||||||
cors = CORS(flask_app)
|
cors = CORS(flask_app)
|
||||||
|
|
||||||
@@ -161,6 +172,7 @@ def index():
|
|||||||
url='news.t0.vc',
|
url='news.t0.vc',
|
||||||
description='Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode',
|
description='Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode',
|
||||||
robots='index',
|
robots='index',
|
||||||
|
css_file=css_file,
|
||||||
)
|
)
|
||||||
|
|
||||||
@flask_app.route('/<sid>', strict_slashes=False)
|
@flask_app.route('/<sid>', strict_slashes=False)
|
||||||
@@ -192,6 +204,7 @@ def static_story(sid):
|
|||||||
robots='noindex',
|
robots='noindex',
|
||||||
story=story,
|
story=story,
|
||||||
show_comments=request.path.endswith('/c'),
|
show_comments=request.path.endswith('/c'),
|
||||||
|
css_file=css_file,
|
||||||
)
|
)
|
||||||
|
|
||||||
http_server = WSGIServer(('', 33842), flask_app)
|
http_server = WSGIServer(('', 33842), flask_app)
|
||||||
|
|||||||
@@ -30,16 +30,15 @@
|
|||||||
-->
|
-->
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
|
|
||||||
|
{% if css_file %}
|
||||||
|
<link href="/static/css/{{ css_file }}" rel="stylesheet">
|
||||||
|
{% endif %}
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
background: #000;
|
background: #eeeeee;
|
||||||
}
|
|
||||||
.nojs {
|
|
||||||
color: white;
|
|
||||||
max-width: 32rem;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user