plain mode

This commit is contained in:
mi
2025-11-07 18:37:45 +10:00
parent a69f64de7a
commit 234d78d862
5 changed files with 56 additions and 9 deletions

12
app.py
View File

@@ -1,6 +1,6 @@
import os
from flask import Flask, render_template, abort, jsonify, request
from comics_data import COMICS, FULL_WIDTH_DEFAULT
from comics_data import COMICS, FULL_WIDTH_DEFAULT, PLAIN_DEFAULT
app = Flask(__name__)
@@ -17,12 +17,22 @@ def is_full_width(comic):
return FULL_WIDTH_DEFAULT
def is_plain(comic):
"""Determine if a comic should be plain mode based on global and per-comic settings"""
# If comic explicitly sets plain, use that value
if 'plain' in comic:
return comic['plain']
# Otherwise use the global default
return PLAIN_DEFAULT
def enrich_comic(comic):
"""Add computed properties to comic data"""
if comic is None:
return None
enriched = comic.copy()
enriched['full_width'] = is_full_width(comic)
enriched['plain'] = is_plain(comic)
return enriched