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 • 4.46 kiB
Python script, ASCII text executable
        
            
1
import os
2
from dotenv import load_dotenv
3
load_dotenv("secrets.env")
4
5
DB_PASSWORD: str = os.environ.get("DB_PASSWORD")
6
DB_URI: str = f"postgresql://root:{DB_PASSWORD}@localhost/roundabout"
7
8
REPOS_PATH: str = "./repos"
9
USERDATA_PATH: str = "./userdata"
10
DEFAULT_AVATARS_PATH: str = "./defaultAvatars"
11
BASE_DOMAIN: str = "localhost"
12
SERVER_IPS: set = {"127.0.0.1", "localhost", "0.0.0.0"}
13
AUTH_REALM: str = "roundabout"
14
15
AVATAR_SIZE: tuple = (192, 192)
16
17
HASHING_ROUNDS: int = 11
18
RESERVED_NAMES: tuple = ("git", "settings", "logout", "accounts", "info", "alerts", "notifications", "about", "newrepo")
19
20
folderIcon: str = "mdi:folder"
21
unknownIcon: str = "mdi:file"
22
fileIcons: dict = {
23
"text/plain": "ic:baseline-text-snippet",
24
"text/css": "simple-icons:css3",
25
"text/csv": "mdi:table",
26
"text/html": "simple-icons:html5",
27
"text/calendar": "mdi:calendar",
28
"text/javascript": "simple-icons:javascript",
29
"text/xml": "mdi:xml",
30
"text/markdown": "simple-icons:markdown",
31
32
"application/octet-stream": "mdi:numeric-10-box",
33
"application/x-abiword": "mdi:file-document",
34
"application/x-msword": "mdi:file-document",
35
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "mdi:file-document",
36
"application/vnd.oasis.opendocument.text": "mdi:file-document",
37
"application/rtf": "mdi:file-document",
38
"application/x-dvi": "mdi:file-document",
39
"application/epub+zip": "mdi:book-open-variant",
40
"application/pdf": "mdi:book-open-variant",
41
"application/x-freearc": "mdi:archive",
42
"application/x-bzip": "mdi:archive",
43
"application/x-bzip2": "mdi:archive",
44
"application/gzip": "mdi:archive",
45
"application/x-tar": "mdi:archive",
46
"application/zip": "mdi:archive",
47
"application/x-7z-compressed": "mdi:archive",
48
"application/vnd.rar": "mdi:archive",
49
"application/x-rar-compressed": "mdi:archive",
50
"application/java-archive": "simple-icons:openjdk",
51
"application/vnd.amazon.ebook": "mdi:cellphone-text",
52
"application/x-cdf": "mdi:disc-player",
53
"application/x-csh": "ic:baseline-terminal",
54
"application/x-sh": "ic:baseline-terminal",
55
"application/xml": "mdi:xml",
56
"application/json": "mdi:code-json",
57
"application/ld+json": "mdi:code-json",
58
"application/vnd.apple.installer+xml": "simple-icons:apple",
59
"application/vnd.oasis.opendocument.presentation": "mdi:presentation",
60
"application/vnd.ms-powerpoint": "mdi:presentation",
61
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "mdi:presentation",
62
"application/vnd.oasis.opendocument.spreadsheet": "mdi:table-large",
63
"application/vnd.ms-excel": "mdi:table-large",
64
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "mdi:table-large",
65
"application/x-httpd-php": "mdi:server",
66
"application/xhtml+xml": "simple-icons:html5",
67
"application/vnd.android.package-archive": "bi:android2",
68
"application/x-x509-ca-cert": "mdi:certificate",
69
"application/x-shockwave-flash": "simple-icons:adobe",
70
"application/font-woff": "mdi:format-text",
71
"application/x-font-truetype": "mdi:format-text",
72
"application/x-font-opentype": "mdi:format-text",
73
"application/vnd.ms-fontobject": "mdi:format-text",
74
75
"audio/aac": "mdi:music",
76
"audio/mp3": "mdi:music",
77
"audio/ogg": "mdi:music",
78
"audio/opus": "mdi:music",
79
"audio/wav": "mdi:music",
80
"audio/webm": "mdi:music",
81
"audio/3gpp": "mdi:music",
82
"audio/3gpp2": "mdi:music",
83
"audio/midi": "mdi:piano",
84
"audio/x-midi": "mdi:piano",
85
"audio/flac": "mdi:music",
86
"audio/x-ms-wma": "mdi:music",
87
88
"image/avif": "mdi:image",
89
"image/jpeg": "mdi:image",
90
"image/png": "mdi:image",
91
"image/tiff": "mdi:image",
92
"image/webp": "mdi:image",
93
"image/gif": "mdi:image-multiple",
94
"image/vnd.microsoft.icon": "mdi:bookmark-multiple",
95
"image/x-icon": "simple-icons:windowsxp",
96
"image/bmp": "mdi:brush",
97
"image/svg+xml": "mdi:vector-curve",
98
99
"video/mp4": "mdi:video",
100
"video/mpeg": "mdi:video",
101
"video/ogg": "mdi:video",
102
"video/webm": "mdi:video",
103
"video/3gpp": "mdi:video",
104
"video/3gpp2": "mdi:video",
105
"video/x-flv": "mdi:video",
106
"video/mp2t": "ic:baseline-live-tv",
107
"video/x-msvideo": "mdi:video-vintage",
108
}
109
110
111
def matchIcon(name):
112
if name.startswith(("LICENCE", "LICENSE", "COPYING")):
113
return "ic:gavel"
114
if name.startswith("README"):
115
return "mdi:book-information-variant"
116
if name.startswith(".gitignore"):
117
return "simple-icons:git"
118