Allow actor id to be specified in config

This is useful if the actor won't be at the root of the domain.
main
Kevin Wallace 2022-11-04 00:34:04 -07:00 committed by Thomas Sileo
parent 0badf0bc1f
commit 2843155501
3 changed files with 6 additions and 0 deletions

View File

@ -90,6 +90,7 @@ class Config(pydantic.BaseModel):
name: str name: str
summary: str summary: str
https: bool https: bool
id: str = None
icon_url: str icon_url: str
secret: str secret: str
debug: bool = False debug: bool = False
@ -146,6 +147,8 @@ CONFIG = load_config()
DOMAIN = CONFIG.domain DOMAIN = CONFIG.domain
_SCHEME = "https" if CONFIG.https else "http" _SCHEME = "https" if CONFIG.https else "http"
ID = f"{_SCHEME}://{DOMAIN}" ID = f"{_SCHEME}://{DOMAIN}"
if CONFIG.id:
ID = CONFIG.id
USERNAME = CONFIG.username USERNAME = CONFIG.username
MANUALLY_APPROVES_FOLLOWERS = CONFIG.manually_approves_followers MANUALLY_APPROVES_FOLLOWERS = CONFIG.manually_approves_followers
HIDES_FOLLOWERS = CONFIG.hides_followers HIDES_FOLLOWERS = CONFIG.hides_followers

View File

@ -5,6 +5,7 @@ admin_password = "$2b$12$OwCyZM33uXQUVrChgER.h.qgFJ4fBp6tdFwArR3Lm1LV8NgMvIxVa"
name = "test" name = "test"
summary = "<p>Hello</p>" summary = "<p>Hello</p>"
https = false https = false
id = "http://localhost:8000"
icon_url = "https://localhost:8000/static/nopic.png" icon_url = "https://localhost:8000/static/nopic.png"
secret = "1dd4079e0474d1a519052b8fe3cb5fa6" secret = "1dd4079e0474d1a519052b8fe3cb5fa6"
debug = true debug = true

View File

@ -74,6 +74,8 @@ def main() -> None:
dat["https"] = False dat["https"] = False
proto = "http" proto = "http"
dat["id"] = f'{proto}://{dat["domain"]}'
print("Note that you can put your icon/avatar in the static/ directory") print("Note that you can put your icon/avatar in the static/ directory")
dat["icon_url"] = prompt( dat["icon_url"] = prompt(
"icon URL: ", default=f'{proto}://{dat["domain"]}/static/nopic.png' "icon URL: ", default=f'{proto}://{dat["domain"]}/static/nopic.png'