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