Skip to content

Commit 87018c1

Browse files
committed
allow for changing the response root url
1 parent 35e1829 commit 87018c1

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

config.template.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[SERVER]
22
host = "localhost"
3+
root_url = "" # optional key, used for changing the root url in automation if domain is not https://mystb.in
34
port = 8181
4-
session_secret = "" # Run: import secrets; print(secrets.token_urlsafe(64))
5+
session_secret = "" # Run: import secrets; print(secrets.token_urlsafe(64))
56
maintenance = false
67

78
[DATABASE]

src/core/database.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
LOGGER = logging.getLogger(__name__)
4646
SCHEMA_FILE = pathlib.Path("schema.sql")
47+
ROOT_URL = CONFIG["SERVER"].get("root_url", "https://mystb.in")
4748

4849

4950
class Database:
@@ -119,7 +120,7 @@ async def _post_gist_of_tokens(self) -> None:
119120

120121
for paste_id, tokens in current_tokens.items():
121122
filename = str(datetime.datetime.now(datetime.UTC)) + "-tokens.txt"
122-
json_payload["files"][filename] = {"content": f"https://mystb.in/{paste_id}:\n{tokens}"}
123+
json_payload["files"][filename] = {"content": f"{ROOT_URL}/{paste_id}:\n{tokens}"}
123124

124125
success = False
125126

src/types_/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
class Server(TypedDict):
2727
host: str
28+
root_url: NotRequired[str]
2829
port: int
2930
domain: str
3031
session_secret: str

0 commit comments

Comments
 (0)