comparison libervia/web/server/constants.py @ 1518:eb00d593801d

refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 16:49:28 +0200
parents libervia/server/constants.py@b8ed9726525b
children 7941444c1671
comparison
equal deleted inserted replaced
1517:b8ed9726525b 1518:eb00d593801d
1 #!/usr/bin/env python3
2
3 # Libervia: a SàT frontend
4 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
15
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 from ..common import constants
20
21
22 class Const(constants.Const):
23
24 APP_NAME = "Libervia Web"
25 APP_COMPONENT = "web"
26 APP_NAME_ALT = APP_NAME
27 APP_NAME_FILE = "libervia_web"
28 CONFIG_SECTION = APP_COMPONENT.lower()
29 # the Libervia profile that is used for public operations (when nobody is connected)
30 SERVICE_PROFILE = "libervia"
31
32 SESSION_TIMEOUT = 7200 # Session's timeout, after that the user will be disconnected
33 HTML_DIR = "html/"
34 THEMES_DIR = "themes/"
35 THEMES_URL = "themes"
36 MEDIA_DIR = "media/"
37 CARDS_DIR = "games/cards/tarot"
38 PAGES_DIR = "pages"
39 TASKS_DIR = "tasks"
40 LIBERVIA_CACHE = "libervia"
41 SITE_NAME_DEFAULT = "default"
42 # generated files will be accessible there
43 BUILD_DIR = "__b"
44 BUILD_DIR_DYN = "dyn"
45 # directory where build files are served to the client
46 PRODUCTION_BUILD_DIR = "sites"
47 # directory used for files needed temporarily (e.g. for compiling other files)
48 DEV_BUILD_DIR = "dev_build"
49
50 TPL_RESOURCE = '_t'
51
52 ERRNUM_BRIDGE_ERRBACK = 0 # FIXME
53 ERRNUM_LIBERVIA = 0 # FIXME
54
55 # Security limit for Libervia (get/set params)
56 SECURITY_LIMIT = 5
57
58 # Security limit for Libervia server_side
59 SERVER_SECURITY_LIMIT = constants.Const.NO_SECURITY_LIMIT
60
61 # keys for cache values we can get from browser
62 ALLOWED_ENTITY_DATA = {"avatar", "nick"}
63
64 STATIC_RSM_MAX_LIMIT = 100
65 STATIC_RSM_MAX_DEFAULT = 10
66 STATIC_RSM_MAX_COMMENTS_DEFAULT = 10
67
68 ## Libervia pages ##
69 PAGES_META_FILE = "page_meta.py"
70 PAGES_BROWSER_DIR = "_browser"
71 PAGES_BROWSER_META_FILE = "browser_meta.json"
72 PAGES_ACCESS_NONE = (
73 "none"
74 ) #  no access to this page (using its path will return a 404 error)
75 PAGES_ACCESS_PUBLIC = "public"
76 PAGES_ACCESS_PROFILE = (
77 "profile"
78 ) # a session with an existing profile must be started
79 PAGES_ACCESS_ADMIN = "admin" #  only profiles set in admins_list can access the page
80 PAGES_ACCESS_ALL = (
81 PAGES_ACCESS_NONE,
82 PAGES_ACCESS_PUBLIC,
83 PAGES_ACCESS_PROFILE,
84 PAGES_ACCESS_ADMIN,
85 )
86 # names of the page to use for menu
87 DEFAULT_MENU = [
88 "login",
89 "chat",
90 "blog",
91 "forums",
92 "photos",
93 "files",
94 "calendar",
95 "events",
96 "lists",
97 "merge-requests",
98 "calls"
99 # XXX: app is not available anymore since removal of pyjamas code with Python 3
100 # port. It should come back at a later point with an alternative (Brython
101 # probably).
102 ]
103
104 ## Session flags ##
105 FLAG_CONFIRM = "CONFIRM"
106
107 ## Data post ##
108 POST_NO_CONFIRM = "POST_NO_CONFIRM"
109
110 ## HTTP methods ##
111 HTTP_METHOD_GET = b"GET"
112 HTTP_METHOD_POST = b"POST"
113
114 ## HTTP codes ##
115 HTTP_SEE_OTHER = 303
116 HTTP_NOT_MODIFIED = 304
117 HTTP_BAD_REQUEST = 400
118 HTTP_UNAUTHORIZED = 401
119 HTTP_FORBIDDEN = 403
120 HTTP_NOT_FOUND = 404
121 HTTP_INTERNAL_ERROR = 500
122 HTTP_PROXY_ERROR = 502
123 HTTP_SERVICE_UNAVAILABLE = 503
124
125 ## HTTP HEADERS ##
126 H_FORWARDED = "Forwarded"
127 H_X_FORWARDED_FOR = "X-Forwarded-For"
128 H_X_FORWARDED_HOST = "X-Forwarded-Host"
129 H_X_FORWARDED_PROTO = "X-Forwarded-Proto"
130
131
132 ## Cache ##
133 CACHE_PUBSUB = 0
134
135 ## Date/Time ##
136 HTTP_DAYS = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
137 HTTP_MONTH = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
138 "Nov", "Dec")