Allow heading tags (h1-h6) in ContentSanitizer so news editor headings render

This commit is contained in:
2026-06-04 07:52:57 +02:00
parent 0b33a1b074
commit 15870ddb1f
191 changed files with 15453 additions and 1786 deletions

View File

@@ -0,0 +1,43 @@
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from typing import Any
from PIL import Image
from ..image_io import DownloadedImage
class UpscaleEngineUnavailable(RuntimeError):
pass
@dataclass(frozen=True)
class UpscaleResult:
image: Image.Image
metadata: dict[str, Any]
@dataclass(frozen=True)
class EngineHealth:
status: str
engine: str
device: str
models_loaded: bool
details: dict[str, Any] = field(default_factory=dict)
class UpscaleEngine(ABC):
@abstractmethod
def health(self) -> EngineHealth:
raise NotImplementedError
def available(self) -> bool:
health = self.health()
return health.status == "ok" and health.models_loaded
@abstractmethod
def upscale(self, downloaded: DownloadedImage, scale: int, mode: str, output_format: str) -> UpscaleResult:
raise NotImplementedError