feat: return 404 when ID not in featured threads
This commit is contained in:
parent
6914f7e479
commit
9e14af9614
1 changed files with 6 additions and 2 deletions
|
@ -19,8 +19,11 @@ def home():
|
||||||
|
|
||||||
@threads.route('/<path:id>')
|
@threads.route('/<path:id>')
|
||||||
def thread(id):
|
def thread(id):
|
||||||
|
if id in thread_ids:
|
||||||
status = fetch_thread(id)
|
status = fetch_thread(id)
|
||||||
return render_template('threads.html', threads=[status], title=title, attribution=attribution)
|
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:
|
||||||
|
|
Loading…
Reference in a new issue