server/embed: return html on index error
This commit is contained in:
parent
7a0a65bee4
commit
a88e73804c
2 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
import szurubooru.api.comment_api
|
||||
import szurubooru.api.embed_api
|
||||
import szurubooru.api.info_api
|
||||
import szurubooru.api.oembed_api
|
||||
import szurubooru.api.password_reset_api
|
||||
import szurubooru.api.pool_api
|
||||
import szurubooru.api.pool_category_api
|
||||
|
|
|
@ -78,7 +78,11 @@ def get_post(
|
|||
@rest.routes.get("/index(?P<path>/.+)")
|
||||
def post_index(ctx: rest.Context, params: Dict[str, str]) -> rest.Response:
|
||||
path = _index_path(params)
|
||||
oembed = get_post(ctx, {}, path)
|
||||
try:
|
||||
oembed = get_post(ctx, {}, path)
|
||||
except posts.PostNotFoundError:
|
||||
return {"return_type": "custom", "content": index_html}
|
||||
|
||||
url = config.config["site_url"] + path
|
||||
new_html = index_html.replace("</head>", f'''
|
||||
<meta property="og:site_name" content="{config.config["name"]}">
|
Loading…
Reference in a new issue