feat: return 404 when ID not in featured threads

This commit is contained in:
Ayo Ayco 2024-04-25 15:59:17 +02:00
parent 6914f7e479
commit 9e14af9614

View file

@ -19,8 +19,11 @@ def home():
@threads.route('/<path:id>') @threads.route('/<path:id>')
def thread(id): def thread(id):
status = fetch_thread(id) if id in thread_ids:
return render_template('threads.html', threads=[status], title=title, attribution=attribution) status = fetch_thread(id)
return render_template('threads.html', threads=[status], title=title, attribution=attribution)
else:
return '<h1>Not Found</h1><p>¯\_(ツ)_/¯</p><a href="/">go home</a>', 404
@threads.route('/api') @threads.route('/api')
def api(): def api():
@ -30,6 +33,7 @@ def api():
def api_thread(id): def api_thread(id):
return fetch_thread(id) return fetch_thread(id)
def fetch_statuses(): def fetch_statuses():
statuses = [] statuses = []
for id in thread_ids: for id in thread_ids: