diff options
| author | Fuwn <[email protected]> | 2023-07-25 13:54:57 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-07-25 13:54:57 -0700 |
| commit | 27d7ad238c18d679dba026f62cec84108efeca02 (patch) | |
| tree | 3244873a273ed30b4b67e33a7afd6b35d5780e3c /src/due/routes | |
| parent | fix(index): timing sources (diff) | |
| download | old.due.moe-27d7ad238c18d679dba026f62cec84108efeca02.tar.xz old.due.moe-27d7ad238c18d679dba026f62cec84108efeca02.zip | |
feat(index): make manga hideable
Diffstat (limited to 'src/due/routes')
| -rw-r--r-- | src/due/routes/index.py | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/src/due/routes/index.py b/src/due/routes/index.py index b58aec0..545c640 100644 --- a/src/due/routes/index.py +++ b/src/due/routes/index.py @@ -11,6 +11,10 @@ bp = Blueprint("index", __name__) @bp.route("/") def home(): response = make_response("") + disable_manga = False + + if request.args.get("hide_manga") is not None: + disable_manga = True if request.args.get("hide_message") is not None: if request.cookies.get("hide_message") is None: @@ -41,19 +45,32 @@ def home(): (anime_html, anime_length) = anime_to_html(releasing_outdated_anime) anime_time = time.time() - start start = time.time() - (current_manga, _) = create_collection(anilist, "MANGA") - releasing_manga = [ - media for media in current_manga if media["media"]["status"] == "RELEASING" - ] - releasing_outdated_manga = [ - media - for media in releasing_manga - if media["media"]["type"] == "MANGA" - and int(media["media"]["mediaListEntry"]["progress"]) - >= 1 # Useful when testing - ] - (manga_html, manga_length) = manga_to_html(releasing_outdated_manga) - manga_time = time.time() - start + manga_body = "" + + if not disable_manga: + (current_manga, _) = create_collection(anilist, "MANGA") + releasing_manga = [ + media + for media in current_manga + if media["media"]["status"] == "RELEASING" + ] + releasing_outdated_manga = [ + media + for media in releasing_manga + if media["media"]["type"] == "MANGA" + and int(media["media"]["mediaListEntry"]["progress"]) + >= 1 # Useful when testing + ] + (manga_html, manga_length) = manga_to_html(releasing_outdated_manga) + manga_time = time.time() - start + manga_body = f""" + <p></p> + + <details closed> + <summary>Manga [{manga_length}] <small style="opacity: 50%">{round(manga_time, 2)}s</small> <a href="/?hide_manga">Hide temporarily</a></summary> + {manga_html} + </details> + """ response.set_data( page( @@ -61,17 +78,11 @@ def home(): <br>""", f"""<details open> - <summary>Anime [{anime_length}] <small style="opacity: 50%">{round(anime_time, 2)}ms</small></summary> + <summary>Anime [{anime_length}] <small style="opacity: 50%">{round(anime_time, 2)}s</small></summary> {anime_html} </details> - <p></p> - - <details closed> - <summary>Manga [{manga_length}] <small style="opacity: 50%">{round(manga_time, 2)}ms</small></summary> - {manga_html} - </details> - """, + {manga_body}""", ) ) else: |