1
|
# 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 of this code
|
28
|
# in a proprietary program, I am not going to enforce this in court.
|
29
|
|
30
|
import re
|
31
|
from pathlib import Path
|
32
|
|
33
|
here = Path(__file__).resolve().parent
|
34
|
proj_root = here.parent.parent
|
35
|
awk_script_name = 'compute_scripts.awk'
|
36
|
|
37
|
unit_test_defines = ['-D', 'MOZILLA', '-D', 'MV2', '-D', 'TEST',
|
38
|
'-D', 'UNIT_TEST', '-D', 'DEBUG']
|
39
|
|
40
|
conf_line_regex = re.compile(r'^([^=]+) = (.*)$')
|
41
|
conf_settings = {}
|
42
|
with open(Path.cwd() / 'record.conf', 'rt') as conf:
|
43
|
for line in conf.readlines():
|
44
|
match = conf_line_regex.match(line)
|
45
|
if match:
|
46
|
conf_settings[match.group(1).strip()] = match.group(2)
|
47
|
|
48
|
default_proxy_host = '127.0.0.1'
|
49
|
default_proxy_port = 1337
|
50
|
|
51
|
default_cert_dir = proj_root / 'test' / 'certs'
|
52
|
|
53
|
default_extension_uuid = 'a1291446-be95-48ad-a4c6-a475e389399b'
|
54
|
default_haketilo_id = '{6fe13369-88e9-440f-b837-5012fb3bedec}'
|
55
|
|
56
|
mime_types = {
|
57
|
"7z": "application/x-7z-compressed", "oga": "audio/ogg",
|
58
|
"abw": "application/x-abiword", "ogv": "video/ogg",
|
59
|
"arc": "application/x-freearc", "ogx": "application/ogg",
|
60
|
"bin": "application/octet-stream", "opus": "audio/opus",
|
61
|
"bz": "application/x-bzip", "otf": "font/otf",
|
62
|
"bz2": "application/x-bzip2", "pdf": "application/pdf",
|
63
|
"css": "text/css", "png": "image/png",
|
64
|
"csv": "text/csv", "sh": "application/x-sh",
|
65
|
"gif": "image/gif", "svg": "image/svg+xml",
|
66
|
"gz": "application/gzip", "tar": "application/x-tar",
|
67
|
"htm": "text/html", "ts": "video/mp2t",
|
68
|
"html": "text/html", "ttf": "font/ttf",
|
69
|
"ico": "image/vnd.microsoft.icon", "txt": "text/plain",
|
70
|
"js": "text/javascript", "wav": "audio/wav",
|
71
|
"jpeg": "image/jpeg", "weba": "audio/webm",
|
72
|
"jpg": "image/jpeg", "webm": "video/webm",
|
73
|
"json": "application/json", "woff": "font/woff",
|
74
|
"mjs": "text/javascript", "woff2": "font/woff2",
|
75
|
"mp3": "audio/mpeg", "xhtml": "application/xhtml+xml",
|
76
|
"mp4": "video/mp4", "zip": "application/zip",
|
77
|
"mpeg": "video/mpeg",
|
78
|
"odp": "application/vnd.oasis.opendocument.presentation",
|
79
|
"ods": "application/vnd.oasis.opendocument.spreadsheet",
|
80
|
"odt": "application/vnd.oasis.opendocument.text",
|
81
|
"xml": "application/xml" # text/xml if readable from casual users
|
82
|
}
|