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