| 1 |
5b2a7a61
|
Wojtek Kosior
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
| 2 |
|
|
|
| 3 |
|
|
"""
|
| 4 |
|
|
Miscellaneous data that were found useful
|
| 5 |
|
|
"""
|
| 6 |
|
|
|
| 7 |
|
|
# This file is part of Haketilo.
|
| 8 |
|
|
#
|
| 9 |
|
|
# Copyright (C) 2021 jahoti <jahoti@tilde.team>
|
| 10 |
|
|
# Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org>
|
| 11 |
|
|
#
|
| 12 |
|
|
# This program is free software: you can redistribute it and/or modify
|
| 13 |
|
|
# it under the terms of the GNU Affero General Public License as
|
| 14 |
|
|
# published by the Free Software Foundation, either version 3 of the
|
| 15 |
|
|
# License, or (at your option) any later version.
|
| 16 |
|
|
#
|
| 17 |
|
|
# This program is distributed in the hope that it will be useful,
|
| 18 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
|
|
# GNU Affero General Public License for more details.
|
| 21 |
|
|
#
|
| 22 |
|
|
# You should have received a copy of the GNU Affero General Public License
|
| 23 |
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 24 |
|
|
#
|
| 25 |
|
|
#
|
| 26 |
|
|
# I, Wojtek Kosior, thereby promise not to sue for violation of this
|
| 27 |
|
|
# file's license. Although I request that you do not make use this code
|
| 28 |
|
|
# in a proprietary program, I am not going to enforce this in court.
|
| 29 |
|
|
|
| 30 |
|
|
from pathlib import Path
|
| 31 |
|
|
|
| 32 |
|
|
here = Path(__file__).resolve().parent
|
| 33 |
|
|
|
| 34 |
|
|
default_firefox_binary = '/usr/lib/icecat/icecat'
|
| 35 |
|
|
# The browser might be loading some globally-installed add-ons by default. They
|
| 36 |
|
|
# could interfere with the tests, so we'll disable all of them.
|
| 37 |
|
|
default_clean_profile_dir = here / 'default_profile' / 'icecat_empty'
|
| 38 |
|
|
|
| 39 |
|
|
default_proxy_host = '127.0.0.1'
|
| 40 |
|
|
default_proxy_port = 1337
|
| 41 |
|
|
|
| 42 |
|
|
default_cert_dir = here / 'certs'
|
| 43 |
|
|
|
| 44 |
3fcff338
|
jahoti
|
# Use user-specified values instead where available
|
| 45 |
|
|
try:
|
| 46 |
201fcfad
|
jahoti
|
with open('testing.conf') as f:
|
| 47 |
3fcff338
|
jahoti
|
option = f.readline()
|
| 48 |
|
|
while ' ' in option:
|
| 49 |
|
|
key, value = option[:-1].split(' ', maxsplit=1)
|
| 50 |
|
|
if key == 'BINARY':
|
| 51 |
|
|
default_firefox_binary = value
|
| 52 |
|
|
|
| 53 |
|
|
elif key == 'TEST_PROFILE':
|
| 54 |
7d1f777a
|
jahoti
|
default_clean_profile_dir = Path(value)
|
| 55 |
3fcff338
|
jahoti
|
|
| 56 |
|
|
elif key == 'TEST_PORT':
|
| 57 |
7d1f777a
|
jahoti
|
default_proxy_port = int(value)
|
| 58 |
3fcff338
|
jahoti
|
|
| 59 |
201fcfad
|
jahoti
|
elif key == 'CERT_DIR':
|
| 60 |
|
|
default_cert_dir = Path(value)
|
| 61 |
|
|
|
| 62 |
3fcff338
|
jahoti
|
else:
|
| 63 |
|
|
raise KeyError(key)
|
| 64 |
|
|
|
| 65 |
|
|
option = f.readline()
|
| 66 |
|
|
except FileNotFoundError:
|
| 67 |
|
|
# There may be no defaults overridden; that's OK!
|
| 68 |
|
|
pass
|
| 69 |
|
|
|
| 70 |
5b2a7a61
|
Wojtek Kosior
|
mime_types = {
|
| 71 |
|
|
"7z": "application/x-7z-compressed", "oga": "audio/ogg",
|
| 72 |
|
|
"abw": "application/x-abiword", "ogv": "video/ogg",
|
| 73 |
|
|
"arc": "application/x-freearc", "ogx": "application/ogg",
|
| 74 |
|
|
"bin": "application/octet-stream", "opus": "audio/opus",
|
| 75 |
|
|
"bz": "application/x-bzip", "otf": "font/otf",
|
| 76 |
|
|
"bz2": "application/x-bzip2", "pdf": "application/pdf",
|
| 77 |
|
|
"css": "text/css", "png": "image/png",
|
| 78 |
|
|
"csv": "text/csv", "sh": "application/x-sh",
|
| 79 |
|
|
"gif": "image/gif", "svg": "image/svg+xml",
|
| 80 |
|
|
"gz": "application/gzip", "tar": "application/x-tar",
|
| 81 |
|
|
"htm": "text/html", "ts": "video/mp2t",
|
| 82 |
|
|
"html": "text/html", "ttf": "font/ttf",
|
| 83 |
|
|
"ico": "image/vnd.microsoft.icon", "txt": "text/plain",
|
| 84 |
|
|
"js": "text/javascript", "wav": "audio/wav",
|
| 85 |
|
|
"jpeg": "image/jpeg", "weba": "audio/webm",
|
| 86 |
|
|
"jpg": "image/jpeg", "webm": "video/webm",
|
| 87 |
|
|
"json": "application/json", "woff": "font/woff",
|
| 88 |
|
|
"mjs": "text/javascript", "woff2": "font/woff2",
|
| 89 |
|
|
"mp3": "audio/mpeg", "xhtml": "application/xhtml+xml",
|
| 90 |
|
|
"mp4": "video/mp4", "zip": "application/zip",
|
| 91 |
|
|
"mpeg": "video/mpeg",
|
| 92 |
|
|
"odp": "application/vnd.oasis.opendocument.presentation",
|
| 93 |
|
|
"ods": "application/vnd.oasis.opendocument.spreadsheet",
|
| 94 |
|
|
"odt": "application/vnd.oasis.opendocument.text",
|
| 95 |
|
|
"xml": "application/xml" # text/xml if readable from casual users
|
| 96 |
|
|
}
|