ser2netweb 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ser2netweb/__init__.py +20 -0
- ser2netweb/__main__.py +6 -0
- ser2netweb/accounts.py +503 -0
- ser2netweb/cli.py +489 -0
- ser2netweb/clock.py +128 -0
- ser2netweb/config.py +4491 -0
- ser2netweb/console.py +181 -0
- ser2netweb/datalock.py +181 -0
- ser2netweb/engine/__init__.py +0 -0
- ser2netweb/engine/access.py +173 -0
- ser2netweb/engine/bindhint.py +115 -0
- ser2netweb/engine/bridge.py +1928 -0
- ser2netweb/engine/cluster.py +1140 -0
- ser2netweb/engine/modbus.py +530 -0
- ser2netweb/engine/modbus_gateway.py +1465 -0
- ser2netweb/engine/mqtt_pub.py +632 -0
- ser2netweb/engine/netguard.py +805 -0
- ser2netweb/engine/netinfo.py +199 -0
- ser2netweb/engine/portdiag.py +414 -0
- ser2netweb/engine/portlist.py +471 -0
- ser2netweb/engine/protocols/__init__.py +28 -0
- ser2netweb/engine/protocols/base.py +117 -0
- ser2netweb/engine/protocols/raw.py +12 -0
- ser2netweb/engine/protocols/rfc2217.py +586 -0
- ser2netweb/engine/protocols/telnet.py +172 -0
- ser2netweb/engine/serial_compat.py +598 -0
- ser2netweb/engine/serial_io.py +210 -0
- ser2netweb/engine/serial_link.py +414 -0
- ser2netweb/engine/sockopts.py +103 -0
- ser2netweb/engine/sparkplug.py +538 -0
- ser2netweb/engine/sparkplug_node.py +550 -0
- ser2netweb/engine/supervisor.py +533 -0
- ser2netweb/engine/tls.py +232 -0
- ser2netweb/envvars.py +57 -0
- ser2netweb/explain.py +117 -0
- ser2netweb/healthcheck.py +78 -0
- ser2netweb/i18n.py +110 -0
- ser2netweb/importer.py +550 -0
- ser2netweb/layout.py +118 -0
- ser2netweb/licences.py +86 -0
- ser2netweb/locale/tr.json +1569 -0
- ser2netweb/logsetup.py +253 -0
- ser2netweb/logtext.py +23 -0
- ser2netweb/notify.py +761 -0
- ser2netweb/optional.py +76 -0
- ser2netweb/reload.py +295 -0
- ser2netweb/runtime.py +762 -0
- ser2netweb/sdnotify.py +85 -0
- ser2netweb/ser2net_import.py +2001 -0
- ser2netweb/signins.py +98 -0
- ser2netweb/standalone.py +154 -0
- ser2netweb/state.py +1457 -0
- ser2netweb/storage.py +130 -0
- ser2netweb/textfold.py +51 -0
- ser2netweb/tlsreload.py +37 -0
- ser2netweb/watchdog.py +201 -0
- ser2netweb/web/__init__.py +0 -0
- ser2netweb/web/api.py +793 -0
- ser2netweb/web/auth.py +699 -0
- ser2netweb/web/certinfo.py +144 -0
- ser2netweb/web/httpguard.py +413 -0
- ser2netweb/web/ldap_auth.py +556 -0
- ser2netweb/web/oidc_auth.py +330 -0
- ser2netweb/web/proxy.py +398 -0
- ser2netweb/web/routes/__init__.py +78 -0
- ser2netweb/web/routes/cluster.py +669 -0
- ser2netweb/web/routes/common.py +359 -0
- ser2netweb/web/routes/console.py +451 -0
- ser2netweb/web/routes/forms.py +853 -0
- ser2netweb/web/routes/login.py +573 -0
- ser2netweb/web/routes/mappings.py +470 -0
- ser2netweb/web/routes/ops.py +374 -0
- ser2netweb/web/routes/settings.py +2135 -0
- ser2netweb/web/routes/system.py +308 -0
- ser2netweb/web/routes/totp.py +282 -0
- ser2netweb/web/selfsigned.py +129 -0
- ser2netweb/web/server.py +483 -0
- ser2netweb/web/static/app.css +327 -0
- ser2netweb/web/static/app.js +1102 -0
- ser2netweb/web/static/htmx.min.js +1 -0
- ser2netweb/web/static/points.js +218 -0
- ser2netweb/web/static/theme.js +7 -0
- ser2netweb/web/static/xterm-addon-fit.js +2 -0
- ser2netweb/web/static/xterm.css +218 -0
- ser2netweb/web/static/xterm.js +2 -0
- ser2netweb/web/templates/_cluster_body.html +109 -0
- ser2netweb/web/templates/_console.html +21 -0
- ser2netweb/web/templates/_footer.html +13 -0
- ser2netweb/web/templates/_login_notice.html +8 -0
- ser2netweb/web/templates/_macros.html +21 -0
- ser2netweb/web/templates/_mapping_form.html +477 -0
- ser2netweb/web/templates/_mapping_log.html +28 -0
- ser2netweb/web/templates/_mapping_traces.html +44 -0
- ser2netweb/web/templates/_mappings_body.html +149 -0
- ser2netweb/web/templates/_modbus_read.html +18 -0
- ser2netweb/web/templates/_ports_table.html +37 -0
- ser2netweb/web/templates/_serial_port_select.html +48 -0
- ser2netweb/web/templates/_shell.html +41 -0
- ser2netweb/web/templates/audit.html +55 -0
- ser2netweb/web/templates/base.html +77 -0
- ser2netweb/web/templates/dashboard.html +72 -0
- ser2netweb/web/templates/licenses.html +18 -0
- ser2netweb/web/templates/login.html +32 -0
- ser2netweb/web/templates/login_totp.html +23 -0
- ser2netweb/web/templates/settings.html +830 -0
- ser2netweb/web/templates/setup.html +43 -0
- ser2netweb/web/templates/totp.html +41 -0
- ser2netweb/web/totp.py +94 -0
- ser2netweb/winservice.py +1793 -0
- ser2netweb-3.0.0.dist-info/METADATA +120 -0
- ser2netweb-3.0.0.dist-info/RECORD +121 -0
- ser2netweb-3.0.0.dist-info/WHEEL +5 -0
- ser2netweb-3.0.0.dist-info/entry_points.txt +2 -0
- ser2netweb-3.0.0.dist-info/licenses/COMMERCIAL_LICENSE.md +94 -0
- ser2netweb-3.0.0.dist-info/licenses/LICENSE +662 -0
- ser2netweb-3.0.0.dist-info/licenses/NOTICE +20 -0
- ser2netweb-3.0.0.dist-info/licenses/THIRD-PARTY-NOTICES.md +105 -0
- ser2netweb-3.0.0.dist-info/licenses/tools/licenses/npm/htmx.org.txt +13 -0
- ser2netweb-3.0.0.dist-info/licenses/tools/licenses/npm/xterm-addon-fit.txt +19 -0
- ser2netweb-3.0.0.dist-info/licenses/tools/licenses/npm/xterm.txt +21 -0
- ser2netweb-3.0.0.dist-info/top_level.txt +1 -0
ser2netweb/licences.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""What the web UI says about ser2netweb's licences (the footer and the /licenses page).
|
|
2
|
+
|
|
3
|
+
ser2netweb is AGPL-3.0-only or under a commercial licence (NOTICE). AGPL-3.0 section 13 asks
|
|
4
|
+
a modified version that users reach over a network to offer them its source: the footer
|
|
5
|
+
of every page links source_url(), which SER2NETWEB_SOURCE_URL changes for such a copy (an
|
|
6
|
+
internal mirror of an air-gapped site, a fork). texts() are the licence texts this copy
|
|
7
|
+
carries — LICENSE, NOTICE, COMMERCIAL_LICENSE.md and the third-party notices from a
|
|
8
|
+
source tree, the Docker image or a pip install (its .dist-info has them), the generated
|
|
9
|
+
THIRD-PARTY-LICENSES.txt in a standalone executable — which the /licenses page shows to signed-in users (they name the versions of
|
|
10
|
+
the bundled components, so they are not shown before a sign-in).
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import glob
|
|
15
|
+
import os
|
|
16
|
+
import re
|
|
17
|
+
import sys
|
|
18
|
+
|
|
19
|
+
from . import SOURCE_URL, envvars, layout
|
|
20
|
+
|
|
21
|
+
SOURCE_URL_ENV = "SER2NETWEB_SOURCE_URL" # (or SER2NET_SOURCE_URL, its 2.9.x name)
|
|
22
|
+
# an http(s) address without spaces, quotes or angle brackets (it goes into an href)
|
|
23
|
+
_URL = re.compile(r"https?://[^\s\"'<>`]{1,2000}", re.I)
|
|
24
|
+
# the folder that holds ser2netweb/ (a source tree, the Docker image's /app; a standalone
|
|
25
|
+
# executable's unpack folder)
|
|
26
|
+
_ROOT = getattr(sys, "_MEIPASS", None) or os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _root() -> str:
|
|
30
|
+
"""Where this copy's licence texts are: _ROOT, or for a pip install (whose _ROOT is
|
|
31
|
+
the site-packages folder) the licence files of its .dist-info, kept there with the
|
|
32
|
+
paths they have in the source tree (tools/licenses/npm/*.txt too)."""
|
|
33
|
+
if not getattr(sys, "_MEIPASS", None) and layout.kind() == layout.PIP:
|
|
34
|
+
return layout.licence_dir() or _ROOT
|
|
35
|
+
return _ROOT
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def source_url(env=None) -> str:
|
|
39
|
+
"""The address of this copy's source code: SER2NETWEB_SOURCE_URL when it is an http://
|
|
40
|
+
or https:// address, else ser2netweb's own."""
|
|
41
|
+
value = envvars.text(SOURCE_URL_ENV, env)
|
|
42
|
+
return value if _URL.fullmatch(value) else SOURCE_URL
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def source_url_note(env=None) -> str:
|
|
46
|
+
"""The start-up warning for a SER2NETWEB_SOURCE_URL that is not used, else ""."""
|
|
47
|
+
value = envvars.text(SOURCE_URL_ENV, env)
|
|
48
|
+
if value and not _URL.fullmatch(value):
|
|
49
|
+
return (f"WARNING: {envvars.source(SOURCE_URL_ENV, env)} is not an http:// or https:// "
|
|
50
|
+
f"address; the web "
|
|
51
|
+
f"UI links {SOURCE_URL} as the source code")
|
|
52
|
+
return ""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _read(path: str) -> str | None:
|
|
56
|
+
try:
|
|
57
|
+
with open(path, encoding="utf-8", errors="replace") as fh:
|
|
58
|
+
return fh.read()
|
|
59
|
+
except OSError:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def texts(root: str | None = None) -> list[tuple[str, str, str]]:
|
|
64
|
+
"""(anchor, title, text) of each licence text this copy of ser2netweb carries."""
|
|
65
|
+
root = _root() if root is None else root
|
|
66
|
+
out = []
|
|
67
|
+
for anchor, title, name in (
|
|
68
|
+
("license", "ser2netweb — GNU Affero General Public License v3.0 (LICENSE)", "LICENSE"),
|
|
69
|
+
("notice", "NOTICE", "NOTICE"),
|
|
70
|
+
("commercial", "Commercial licence (COMMERCIAL_LICENSE.md)", "COMMERCIAL_LICENSE.md"),
|
|
71
|
+
("third-party", "Third-party components (THIRD-PARTY-NOTICES.md)",
|
|
72
|
+
"THIRD-PARTY-NOTICES.md"),
|
|
73
|
+
("bundled", "Licences of every bundled component (THIRD-PARTY-LICENSES.txt)",
|
|
74
|
+
"THIRD-PARTY-LICENSES.txt")):
|
|
75
|
+
text = _read(os.path.join(root, name))
|
|
76
|
+
if text is not None:
|
|
77
|
+
out.append((anchor, title, text))
|
|
78
|
+
# the browser libraries the pages load (htmx, xterm.js): their texts, which the
|
|
79
|
+
# generated THIRD-PARTY-LICENSES.txt of an executable has already
|
|
80
|
+
if not any(anchor == "bundled" for anchor, _t, _x in out):
|
|
81
|
+
for path in sorted(glob.glob(os.path.join(root, "tools", "licenses", "npm", "*.txt"))):
|
|
82
|
+
text = _read(path)
|
|
83
|
+
if text is not None:
|
|
84
|
+
name = os.path.splitext(os.path.basename(path))[0]
|
|
85
|
+
out.append((f"npm-{name}", f"{name} (in the web UI's static files)", text))
|
|
86
|
+
return out
|