Custom footer support
This commit is contained in:
parent
953a6c3b91
commit
d43bf54609
4 changed files with 23 additions and 5 deletions
|
@ -12,6 +12,7 @@ from fastapi import HTTPException
|
|||
from fastapi import Request
|
||||
from itsdangerous import URLSafeTimedSerializer
|
||||
from loguru import logger
|
||||
from markdown import markdown
|
||||
|
||||
from app.utils.emoji import _load_emojis
|
||||
from app.utils.version import get_version_commit
|
||||
|
@ -72,6 +73,7 @@ class Config(pydantic.BaseModel):
|
|||
metadata: list[_ProfileMetadata] | None = None
|
||||
code_highlighting_theme = "friendly_grayscale"
|
||||
blocked_servers: list[_BlockedServer] = []
|
||||
custom_footer: str | None = None
|
||||
|
||||
inbox_retention_days: int = 15
|
||||
|
||||
|
@ -122,6 +124,13 @@ if CONFIG.privacy_replace:
|
|||
BLOCKED_SERVERS = {blocked_server.hostname for blocked_server in CONFIG.blocked_servers}
|
||||
|
||||
INBOX_RETENTION_DAYS = CONFIG.inbox_retention_days
|
||||
CUSTOM_FOOTER = (
|
||||
markdown(
|
||||
CONFIG.custom_footer.replace("{version}", VERSION), extensions=["mdx_linkify"]
|
||||
)
|
||||
if CONFIG.custom_footer
|
||||
else None
|
||||
)
|
||||
|
||||
BASE_URL = ID
|
||||
DEBUG = CONFIG.debug
|
||||
|
|
|
@ -198,6 +198,9 @@ footer {
|
|||
max-width: 1000px;
|
||||
margin: 20px auto;
|
||||
color: $muted-color;
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.actor-box {
|
||||
display: flex;
|
||||
|
|
|
@ -27,6 +27,7 @@ from app.ap_object import Attachment
|
|||
from app.ap_object import Object
|
||||
from app.config import BASE_URL
|
||||
from app.config import CSS_HASH
|
||||
from app.config import CUSTOM_FOOTER
|
||||
from app.config import DEBUG
|
||||
from app.config import VERSION
|
||||
from app.config import generate_csrf_token
|
||||
|
@ -132,6 +133,7 @@ async def render_template(
|
|||
select(func.count(models.Following.id))
|
||||
),
|
||||
"actor_types": ap.ACTOR_TYPES,
|
||||
"custom_footer": CUSTOM_FOOTER,
|
||||
**template_args,
|
||||
},
|
||||
status_code=status_code,
|
||||
|
|
|
@ -47,7 +47,11 @@
|
|||
|
||||
<footer class="footer">
|
||||
<div class="box">
|
||||
{% if custom_footer %}
|
||||
{{ custom_footer | safe }}
|
||||
{% else %}
|
||||
Powered by <a href="https://docs.microblog.pub">microblog.pub</a> <small class="microblogpub-version"><code>{{ microblogpub_version }}</code></small> and the <a href="https://activitypub.rocks/">ActivityPub</a> protocol. <a href="{{ url_for("login") }}">Admin</a>.
|
||||
{% endif %}
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue