Minor tweaks about non-root handling
This commit is contained in:
parent
1c076049cf
commit
540b9d1470
3 changed files with 10 additions and 5 deletions
|
@ -90,7 +90,6 @@ class Config(pydantic.BaseModel):
|
|||
name: str
|
||||
summary: str
|
||||
https: bool
|
||||
id: str = None
|
||||
icon_url: str
|
||||
secret: str
|
||||
debug: bool = False
|
||||
|
@ -113,6 +112,9 @@ class Config(pydantic.BaseModel):
|
|||
sqlalchemy_database: str | None = None
|
||||
key_path: str | None = None
|
||||
|
||||
# Only set when the app is served on a non-root path
|
||||
id: str | None = None
|
||||
|
||||
|
||||
def load_config() -> Config:
|
||||
try:
|
||||
|
@ -147,6 +149,9 @@ CONFIG = load_config()
|
|||
DOMAIN = CONFIG.domain
|
||||
_SCHEME = "https" if CONFIG.https else "http"
|
||||
ID = f"{_SCHEME}://{DOMAIN}"
|
||||
|
||||
# When running the app on a path, the ID maybe set by the config, but in this
|
||||
# case, a valid webfinger must be served on the root domain
|
||||
if CONFIG.id:
|
||||
ID = CONFIG.id
|
||||
USERNAME = CONFIG.username
|
||||
|
@ -179,7 +184,9 @@ if CONFIG.emoji:
|
|||
EMOJIS = CONFIG.emoji
|
||||
|
||||
# Emoji template for the FE
|
||||
EMOJI_TPL = '<img src="{base_url}/static/twemoji/{filename}.svg" alt="{raw}" class="emoji">'
|
||||
EMOJI_TPL = (
|
||||
'<img src="{base_url}/static/twemoji/{filename}.svg" alt="{raw}" class="emoji">'
|
||||
)
|
||||
|
||||
_load_emojis(ROOT_DIR, BASE_URL)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{% if error %}
|
||||
<p class="primary-color">Invalid password.</p>
|
||||
{% endif %}
|
||||
<form class="form" method="POST">
|
||||
<form class="form" action="{{ BASE_URL }}/admin/login" method="POST">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<input type="hidden" name="redirect" value="{{ redirect }}">
|
||||
<input type="password" placeholder="password" name="password" autofocus>
|
||||
|
|
|
@ -74,8 +74,6 @@ def main() -> None:
|
|||
dat["https"] = False
|
||||
proto = "http"
|
||||
|
||||
dat["id"] = f'{proto}://{dat["domain"]}'
|
||||
|
||||
print("Note that you can put your icon/avatar in the static/ directory")
|
||||
dat["icon_url"] = prompt(
|
||||
"icon URL: ", default=f'{proto}://{dat["domain"]}/static/nopic.png'
|
||||
|
|
Loading…
Reference in a new issue