From 2ae08d16b817f201ca577498b1339c41f2c11e74 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Fri, 29 Jul 2022 15:12:48 +0200 Subject: [PATCH] Tweak custom emoji path --- app/main.py | 6 ++---- app/models.py | 1 + app/utils/emoji.py | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/main.py b/app/main.py index e11a786..f8b21c3 100644 --- a/app/main.py +++ b/app/main.py @@ -78,8 +78,6 @@ _RESIZED_CACHE: MutableMapping[tuple[str, int], tuple[bytes, str, Any]] = LFUCac # Next: # - prevent double accept/double follow # - UI support for updating posts -# - Article support -# - Fix SQL tx in the codebase # - indieauth tweaks # - API for posting notes # - allow to block servers @@ -171,9 +169,9 @@ class CustomMiddleware: app = FastAPI(docs_url=None, redoc_url=None) app.mount( - "/static/custom_emoji", + "/custom_emoji", StaticFiles(directory="data/custom_emoji"), - name="static_custom_emoji", + name="custom_emoji", ) app.mount("/static", StaticFiles(directory="app/static"), name="static") app.include_router(admin.router, prefix="/admin") diff --git a/app/models.py b/app/models.py index e44b110..152d5b8 100644 --- a/app/models.py +++ b/app/models.py @@ -564,6 +564,7 @@ class Notification(Base): outbox_fts = Table( "outbox_fts", + # TODO(tsileo): use Base.metadata metadata_obj, Column("rowid", Integer), Column("outbox_fts", String), diff --git a/app/utils/emoji.py b/app/utils/emoji.py index 1d428e0..0fcf6bc 100644 --- a/app/utils/emoji.py +++ b/app/utils/emoji.py @@ -16,7 +16,7 @@ def _load_emojis(root_dir: Path, base_url: str) -> None: if EMOJIS: return for dir_name, path in ( - (root_dir / "app" / "static" / "emoji", "emoji"), + (root_dir / "app" / "static" / "emoji", "static/emoji"), (root_dir / "data" / "custom_emoji", "custom_emoji"), ): for emoji in dir_name.iterdir(): @@ -31,7 +31,7 @@ def _load_emojis(root_dir: Path, base_url: str) -> None: "icon": { "mediaType": mt, "type": "Image", - "url": f"{base_url}/static/{path}/{emoji.name}", + "url": f"{base_url}/{path}/{emoji.name}", }, } EMOJIS[emoji.name] = ap_emoji