Tweak custom emoji path

This commit is contained in:
Thomas Sileo 2022-07-29 15:12:48 +02:00
parent b84b4f1476
commit 2ae08d16b8
3 changed files with 5 additions and 6 deletions

View file

@ -78,8 +78,6 @@ _RESIZED_CACHE: MutableMapping[tuple[str, int], tuple[bytes, str, Any]] = LFUCac
# Next: # Next:
# - prevent double accept/double follow # - prevent double accept/double follow
# - UI support for updating posts # - UI support for updating posts
# - Article support
# - Fix SQL tx in the codebase
# - indieauth tweaks # - indieauth tweaks
# - API for posting notes # - API for posting notes
# - allow to block servers # - allow to block servers
@ -171,9 +169,9 @@ class CustomMiddleware:
app = FastAPI(docs_url=None, redoc_url=None) app = FastAPI(docs_url=None, redoc_url=None)
app.mount( app.mount(
"/static/custom_emoji", "/custom_emoji",
StaticFiles(directory="data/custom_emoji"), StaticFiles(directory="data/custom_emoji"),
name="static_custom_emoji", name="custom_emoji",
) )
app.mount("/static", StaticFiles(directory="app/static"), name="static") app.mount("/static", StaticFiles(directory="app/static"), name="static")
app.include_router(admin.router, prefix="/admin") app.include_router(admin.router, prefix="/admin")

View file

@ -564,6 +564,7 @@ class Notification(Base):
outbox_fts = Table( outbox_fts = Table(
"outbox_fts", "outbox_fts",
# TODO(tsileo): use Base.metadata
metadata_obj, metadata_obj,
Column("rowid", Integer), Column("rowid", Integer),
Column("outbox_fts", String), Column("outbox_fts", String),

View file

@ -16,7 +16,7 @@ def _load_emojis(root_dir: Path, base_url: str) -> None:
if EMOJIS: if EMOJIS:
return return
for dir_name, path in ( 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"), (root_dir / "data" / "custom_emoji", "custom_emoji"),
): ):
for emoji in dir_name.iterdir(): for emoji in dir_name.iterdir():
@ -31,7 +31,7 @@ def _load_emojis(root_dir: Path, base_url: str) -> None:
"icon": { "icon": {
"mediaType": mt, "mediaType": mt,
"type": "Image", "type": "Image",
"url": f"{base_url}/static/{path}/{emoji.name}", "url": f"{base_url}/{path}/{emoji.name}",
}, },
} }
EMOJIS[emoji.name] = ap_emoji EMOJIS[emoji.name] = ap_emoji