Project

General

Profile

Download (3.09 KB) Statistics
| Branch: | Tag: | Revision:

haketilo / test / haketilo_test / misc_constants.py @ f8dedf60

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

    
50
default_cert_dir = Path.cwd() / 'certs'
51

    
52
default_extension_uuid = 'a1291446-be95-48ad-a4c6-a475e389399b'
53
default_haketilo_id = '{6fe13369-88e9-440f-b837-5012fb3bedec}'
54

    
55
mime_types = {
56
	"7z": "application/x-7z-compressed",	"oga": "audio/ogg",
57
	"abw": "application/x-abiword",		"ogv": "video/ogg",
58
	"arc": "application/x-freearc",		"ogx": "application/ogg",
59
	"bin": "application/octet-stream",	"opus": "audio/opus",
60
	"bz": "application/x-bzip",		"otf": "font/otf",
61
	"bz2": "application/x-bzip2",		"pdf": "application/pdf",
62
	"css": "text/css",			"png": "image/png",
63
	"csv": "text/csv",			"sh": "application/x-sh",
64
	"gif": "image/gif",			"svg": "image/svg+xml",
65
	"gz": "application/gzip",		"tar": "application/x-tar",
66
	"htm": "text/html",			"ts": "video/mp2t",
67
	"html": "text/html",			"ttf": "font/ttf",
68
	"ico": "image/vnd.microsoft.icon",	"txt": "text/plain",
69
	"js": "text/javascript",		"wav": "audio/wav",
70
	"jpeg": "image/jpeg",			"weba": "audio/webm",
71
	"jpg": "image/jpeg",			"webm": "video/webm",
72
	"json": "application/json",		"woff": "font/woff",
73
	"mjs": "text/javascript",		"woff2": "font/woff2",
74
	"mp3": "audio/mpeg",			"xhtml": "application/xhtml+xml",
75
	"mp4": "video/mp4",			"zip": "application/zip",
76
	"mpeg": "video/mpeg",
77
	"odp": "application/vnd.oasis.opendocument.presentation",
78
	"ods": "application/vnd.oasis.opendocument.spreadsheet",
79
	"odt": "application/vnd.oasis.opendocument.text",
80
	"xml": "application/xml" # text/xml if readable from casual users
81
}
(5-5/11)