You're looking at it

Homepage: https://roundabout-host.com

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 config.py

View raw Download
text/x-script.python • 6.35 kiB
Python script, Unicode text, UTF-8 text executable
        
            
1
import os
2
from dotenv import load_dotenv
3
4
load_dotenv("secrets.env")
5
6
site_name: str = "roundabout-host.com"
7
help_url: str = "https://roundabout-host.com/"
8
9
DB_PASSWORD: str = os.environ.get("DB_PASSWORD")
10
DB_URI: str = f"postgresql://roundabout:{DB_PASSWORD}@localhost/roundabout"
11
REDIS_URI: str = "redis://localhost"
12
MAIL_SERVER: str = "localhost"
13
NOTIFICATION_EMAIL: str = "notifications@roundabout-host.com"
14
CONTACT_EMAIL: str = "root@roundabout-host.com"
15
16
REPOS_PATH: str = "./repos"
17
USERDATA_PATH: str = "./userdata"
18
SITE_PATH: str = "./usersites"
19
DEFAULT_AVATARS_PATH: str = "./default_avatars"
20
BASE_DOMAIN: str = "roundabout-host.com"
21
SERVER_IPS: set = {"127.0.0.1", "localhost", "0.0.0.0"}
22
AUTH_REALM: str = "roundabout"
23
MAX_PAYLOAD_SIZE: int = 4 * 1024**3
24
25
AVATAR_SIZE: tuple = (192, 192)
26
27
HASHING_ROUNDS: int = 11
28
RESERVED_NAMES: tuple = ("git", "settings", "logout", "accounts", "info", "notifications", "about", "newrepo", "favourites", "data-api", "language", "help", "search", "user-search")
29
30
suggest_https: bool = False # this config is intended for a test server
31
port: int = 8080 # currently not shown in the UI, only used for critical communications
32
restrict_cookie_domain: bool = False
33
34
available_locales: list[str] = ["ro_RO", "en_GB"]
35
36
folder_icon: str = "mdi:folder"
37
unknown_icon: str = "mdi:file"
38
file_icons: dict = {
39
"text/plain": "ic:baseline-text-snippet",
40
"text/css": "simple-icons:css3",
41
"text/csv": "mdi:table",
42
"text/html": "simple-icons:html5",
43
"text/calendar": "mdi:calendar",
44
"text/javascript": "simple-icons:javascript",
45
"text/xml": "mdi:xml",
46
"text/markdown": "simple-icons:markdown",
47
48
"application/octet-stream": "mdi:numeric-10-box",
49
"application/x-abiword": "mdi:file-document",
50
"application/x-msword": "mdi:file-document",
51
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "mdi:file-document",
52
"application/vnd.oasis.opendocument.text": "mdi:file-document",
53
"application/rtf": "mdi:file-document",
54
"application/x-dvi": "mdi:file-document",
55
"application/epub+zip": "mdi:book-open-variant",
56
"application/pdf": "mdi:book-open-variant",
57
"application/x-freearc": "mdi:archive",
58
"application/x-bzip": "mdi:archive",
59
"application/x-bzip2": "mdi:archive",
60
"application/gzip": "mdi:archive",
61
"application/x-tar": "mdi:archive",
62
"application/zip": "mdi:archive",
63
"application/x-7z-compressed": "mdi:archive",
64
"application/vnd.rar": "mdi:archive",
65
"application/x-rar-compressed": "mdi:archive",
66
"application/java-archive": "simple-icons:openjdk",
67
"application/vnd.amazon.ebook": "mdi:cellphone-text",
68
"application/x-cdf": "mdi:disc-player",
69
"application/x-csh": "ic:baseline-terminal",
70
"application/x-sh": "ic:baseline-terminal",
71
"application/xml": "mdi:xml",
72
"application/json": "mdi:code-json",
73
"application/ld+json": "mdi:code-json",
74
"application/vnd.apple.installer+xml": "simple-icons:apple",
75
"application/vnd.oasis.opendocument.presentation": "mdi:presentation",
76
"application/vnd.ms-powerpoint": "mdi:presentation",
77
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "mdi:presentation",
78
"application/vnd.oasis.opendocument.spreadsheet": "mdi:table-large",
79
"application/vnd.ms-excel": "mdi:table-large",
80
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "mdi:table-large",
81
"application/x-httpd-php": "mdi:server",
82
"application/xhtml+xml": "simple-icons:html5",
83
"application/vnd.android.package-archive": "bi:android2",
84
"application/x-x509-ca-cert": "mdi:certificate",
85
"application/x-shockwave-flash": "simple-icons:adobe",
86
"application/font-woff": "mdi:format-text",
87
"application/x-font-truetype": "mdi:format-text",
88
"application/x-font-opentype": "mdi:format-text",
89
"application/vnd.ms-fontobject": "mdi:format-text",
90
91
"audio/aac": "mdi:music",
92
"audio/mp3": "mdi:music",
93
"audio/ogg": "mdi:music",
94
"audio/opus": "mdi:music",
95
"audio/wav": "mdi:music",
96
"audio/webm": "mdi:music",
97
"audio/3gpp": "mdi:music",
98
"audio/3gpp2": "mdi:music",
99
"audio/midi": "mdi:piano",
100
"audio/x-midi": "mdi:piano",
101
"audio/flac": "mdi:music",
102
"audio/x-ms-wma": "mdi:music",
103
104
"image/avif": "mdi:image",
105
"image/jpeg": "mdi:image",
106
"image/png": "mdi:image",
107
"image/tiff": "mdi:image",
108
"image/webp": "mdi:image",
109
"image/gif": "mdi:image-multiple",
110
"image/vnd.microsoft.icon": "mdi:bookmark-multiple",
111
"image/x-icon": "simple-icons:windowsxp",
112
"image/bmp": "mdi:brush",
113
"image/svg+xml": "mdi:vector-curve",
114
115
"video/mp4": "mdi:video",
116
"video/mpeg": "mdi:video",
117
"video/ogg": "mdi:video",
118
"video/webm": "mdi:video",
119
"video/3gpp": "mdi:video",
120
"video/3gpp2": "mdi:video",
121
"video/x-flv": "mdi:video",
122
"video/mp2t": "ic:baseline-live-tv",
123
"video/x-msvideo": "mdi:video-vintage",
124
}
125
126
127
def match_icon(name):
128
if name.startswith(("LICENCE", "LICENSE", "COPYING")):
129
return "ic:gavel"
130
if name.startswith("README"):
131
return "mdi:book-information-variant"
132
if name.startswith(".gitignore"):
133
return "simple-icons:git"
134
135
136
www_protocol = f"http{'s' if suggest_https else ''}"
137
url_prefix = f"{www_protocol}://{BASE_DOMAIN}" + (f":{port}" if port not in {80, 443} else "")
138
139
footer = f"""
140
<x-hbox>
141
<a href="/help">Help</a>
142
<a href="mailto:{CONTACT_EMAIL}">Contact Us</a>
143
</x-hbox>
144
<hr>
145
<p>
146
Beta testing. Not for production use.
147
</p>
148
<p>
149
Application &copy; 2023-2025 Roundabout developers. Content belongs to the repository contributors,
150
unless otherwise stated.
151
</p>
152
<p>
153
Made in Romania 🇷🇴
154
</p>
155
<p>
156
<a href="/about">Powered by Roundabout (beta)</a>
157
</p>
158
"""
159
160
mail_footer = f"""
161
<small>
162
For any inquiries, write to <a href="mailto:{CONTACT_EMAIL}"></a><br>. To adjust your email
163
notification preferences, log in to your account in a browser and visit
164
<a href="{www_protocol}://{BASE_DOMAIN}/settings">your user settings</a>.
165
</small>
166
"""
167
168
mail_header = f"""
169
"""
170
171
mail_footer_plain = f"""
172
For any inquiries, write to <{CONTACT_EMAIL}>.
173
To adjust your email notification preferences, log in to your account in a browser and visit your user settings at
174
<{www_protocol}://{BASE_DOMAIN}/settings>.
175
"""
176
177
logo = ""
178
179
policies_url = "https://roundabout.roundabout-host.com/articles/roundabout-policies.html"
180