enforce thumbnail config serverside

This commit is contained in:
ed 2024-02-18 15:36:59 +00:00
parent 7f1c992601
commit 58ae38c613
2 changed files with 29 additions and 11 deletions

View file

@ -78,16 +78,34 @@ class ThumbCli(object):
if rem.startswith(".hist/th/") and rem.split(".")[-1] in ["webp", "jpg", "png"]: if rem.startswith(".hist/th/") and rem.split(".")[-1] in ["webp", "jpg", "png"]:
return os.path.join(ptop, rem) return os.path.join(ptop, rem)
if fmt == "j" and self.args.th_no_jpg: if fmt[:1] in "jw":
fmt = "w" sfmt = fmt[:1]
if fmt == "w": if sfmt == "j" and self.args.th_no_jpg:
sfmt = "w"
if sfmt == "w":
if ( if (
self.args.th_no_webp self.args.th_no_webp
or (is_img and not self.can_webp) or (is_img and not self.can_webp)
or (self.args.th_ff_jpg and (not is_img or preferred == "ff")) or (self.args.th_ff_jpg and (not is_img or preferred == "ff"))
): ):
fmt = "j" sfmt = "j"
vf_crop = dbv.flags["crop"]
vf_th3x = dbv.flags["th3x"]
if "f" in vf_crop:
sfmt += "f" if "n" in vf_crop else ""
else:
sfmt += "f" if "f" in fmt else ""
if "f" in vf_th3x:
sfmt += "3" if "y" in vf_th3x else ""
else:
sfmt += "3" if "3" in fmt else ""
fmt = sfmt
histpath = self.asrv.vfs.histtab.get(ptop) histpath = self.asrv.vfs.histtab.get(ptop)
if not histpath: if not histpath:

View file

@ -4944,7 +4944,7 @@ var thegrid = (function () {
if (!dcrop.startsWith('f')) if (!dcrop.startsWith('f'))
return r.setdirty(); return r.setdirty();
r.crop = dcrop.startsWith('y'); r.crop = dcrop.endsWith('y');
bcfg_upd_ui('gridcrop', r.crop); bcfg_upd_ui('gridcrop', r.crop);
if (r.crop != en) if (r.crop != en)
toast.warn(10, L.ul_btnlk); toast.warn(10, L.ul_btnlk);
@ -4954,7 +4954,7 @@ var thegrid = (function () {
if (!dth3x.startsWith('f')) if (!dth3x.startsWith('f'))
return r.setdirty(); return r.setdirty();
r.x3 = dth3x.startsWith('y'); r.x3 = dth3x.endsWith('y');
bcfg_upd_ui('grid3x', r.x3); bcfg_upd_ui('grid3x', r.x3);
if (r.x3 != en) if (r.x3 != en)
toast.warn(10, L.ul_btnlk); toast.warn(10, L.ul_btnlk);