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
|
||||
|
||||
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='')
|
||||
cors = CORS(flask_app)
|
||||
|
||||
@@ -161,6 +172,7 @@ def index():
|
||||
url='news.t0.vc',
|
||||
description='Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode',
|
||||
robots='index',
|
||||
css_file=css_file,
|
||||
)
|
||||
|
||||
@flask_app.route('/<sid>', strict_slashes=False)
|
||||
@@ -192,6 +204,7 @@ def static_story(sid):
|
||||
robots='noindex',
|
||||
story=story,
|
||||
show_comments=request.path.endswith('/c'),
|
||||
css_file=css_file,
|
||||
)
|
||||
|
||||
http_server = WSGIServer(('', 33842), flask_app)
|
||||
|
||||
Reference in New Issue
Block a user