Repos / pytaku / e5cf1d6432
commit e5cf1d64322cb78643a78e04a645bf21aefe8c2a
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Tue Aug 11 20:45:22 2020 +0700
opengraph for chapter view too
diff --git a/pyproject.toml b/pyproject.toml
index dca39b9..075389a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pytaku"
-version = "0.2.17"
+version = "0.2.18"
description = ""
authors = ["Bùi Thành Nhân <hi@imnhan.com>"]
license = "AGPL-3.0-only"
diff --git a/src/pytaku/main.py b/src/pytaku/main.py
index d55cba4..8c38967 100644
--- a/src/pytaku/main.py
+++ b/src/pytaku/main.py
@@ -208,12 +208,17 @@ def chapter_view(site, title_id, chapter_id):
# YIIIIKES
title = load_title(site, title_id)
+ title["cover"] = title_cover(site, title_id, title["cover_ext"])
+ if site == "mangadex":
+ title["cover"] = url_for(
+ "proxy_view", b64_url=_encode_proxy_url(title["cover"])
+ )
prev_chapter, next_chapter = get_prev_next_chapters(title, chapter)
chapter["prev_chapter"] = prev_chapter
chapter["next_chapter"] = next_chapter
chapter["site"] = site
- return render_template("chapter.html", **chapter)
+ return render_template("chapter.html", title=title, **chapter)
@app.route("/search")
@@ -240,7 +245,7 @@ def proxy_view(b64_url):
return "Nope", 400
md_resp = requests.get(url)
resp = make_response(md_resp.content, md_resp.status_code)
- resp.headers.extend(**md_resp.headers)
+ resp.headers["Content-Type"] = md_resp.headers["Content-Type"]
return resp
diff --git a/src/pytaku/templates/chapter.html b/src/pytaku/templates/chapter.html
index 5ad18fa..1b6e0eb 100644
--- a/src/pytaku/templates/chapter.html
+++ b/src/pytaku/templates/chapter.html
@@ -6,6 +6,9 @@
{% endblock %}
{% block head %}
+<meta property="og:title" content="{{ title['name'] }} {{ self.title() }} - Pytaku" />
+<meta property="og:image" content="{{ title['cover'] }}" />
+<meta property="og:description" content="{{ title['descriptions'] | join('\n') }}" />
{% if next_chapter %}
<link rel="prefetch" href="{{ url_for('chapter_view', site=site, title_id=title_id, chapter_id=next_chapter['id'])}}">