mihomo-py-web 0.1.2__tar.gz

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.
@@ -0,0 +1,8 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ web-dist/
8
+ build/
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.5
2
+ Name: mihomo-py-web
3
+ Version: 0.1.2
4
+ Summary: Offline zashboard resources for mihomo-py[web]
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+
8
+ # mihomo-py-web
9
+
10
+ Optional static zashboard resources for [mihomo-py](https://pypi.org/project/mihomo-py/).
11
+
12
+ ```bash
13
+ pip install 'mihomo-py[web]'
14
+ ```
15
+
16
+ Ships pinned zashboard v3.29.1 (`dist-no-fonts.zip`), MIT license, upstream dependency
17
+ notices and local integration script. No GitHub/CDN downloads during installation
18
+ or startup. The main client serves the panel at its management port's `/ui/` path.
19
+
20
+ Source and upstream attribution are included in `_vendor/NOTICE.txt` and `manifest.json`.
@@ -0,0 +1,13 @@
1
+ # mihomo-py-web
2
+
3
+ Optional static zashboard resources for [mihomo-py](https://pypi.org/project/mihomo-py/).
4
+
5
+ ```bash
6
+ pip install 'mihomo-py[web]'
7
+ ```
8
+
9
+ Ships pinned zashboard v3.29.1 (`dist-no-fonts.zip`), MIT license, upstream dependency
10
+ notices and local integration script. No GitHub/CDN downloads during installation
11
+ or startup. The main client serves the panel at its management port's `/ui/` path.
12
+
13
+ Source and upstream attribution are included in `_vendor/NOTICE.txt` and `manifest.json`.
@@ -0,0 +1,20 @@
1
+ """Validate pinned dashboard assets without downloading during builds."""
2
+
3
+ import hashlib
4
+ import json
5
+ from pathlib import Path
6
+
7
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
8
+
9
+
10
+ class DashboardHook(BuildHookInterface):
11
+ def initialize(self, version, build_data):
12
+ root = Path(self.root) / "src/mihomo_py_web/_vendor"
13
+ manifest = json.loads((root / "manifest.json").read_text())
14
+ for asset in manifest["assets"]:
15
+ path = root / asset["path"]
16
+ if (
17
+ not path.is_file()
18
+ or hashlib.sha256(path.read_bytes()).hexdigest() != asset["sha256"]
19
+ ):
20
+ raise ValueError(f"Missing or corrupt dashboard asset: {asset['path']}")
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.26,<2"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "mihomo-py-web"
7
+ version = "0.1.2"
8
+ description = "Offline zashboard resources for mihomo-py[web]"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+
12
+ [tool.hatch.build.hooks.custom]
13
+ path = "hatch_build.py"
14
+
15
+ [tool.hatch.build.targets.wheel]
16
+ packages = ["src/mihomo_py_web"]
17
+
18
+ [tool.hatch.build.targets.sdist]
19
+ include = ["src", "pyproject.toml", "hatch_build.py", "README.md"]
@@ -0,0 +1,3 @@
1
+ """Optional, offline zashboard resources for mihomo-py."""
2
+
3
+ __version__ = "0.1.2"
@@ -0,0 +1,9 @@
1
+ zashboard v3.29.1 (dist-no-fonts.zip)
2
+ Copyright: Zephyruso and zashboard contributors
3
+ License: MIT (see licenses/zashboard.txt)
4
+ Source: https://github.com/Zephyruso/zashboard/tree/v3.29.1
5
+ Release: https://github.com/Zephyruso/zashboard/releases/tag/v3.29.1
6
+ Third-party dependency attribution is included in the archive as THIRD_PARTY_NOTICES.md.
7
+ The archive is unchanged. The served index adds a local integration script and CSP;
8
+ the integration source is mihomo_py_web/web_bootstrap.js.
9
+
@@ -0,0 +1,8 @@
1
+ Copyright 2024 Zephyruso
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
@@ -0,0 +1,21 @@
1
+ {
2
+ "dashboard_version": "v3.29.1",
3
+ "assets": [
4
+ {
5
+ "path": "zashboard.zip",
6
+ "url": "https://github.com/Zephyruso/zashboard/releases/download/v3.29.1/dist-no-fonts.zip",
7
+ "download_sha256": "21371cd111b6b3d87774f3ea3ddeacdcb0f6aff8690a16d652daa3ea6e3b0145",
8
+ "gzip": false,
9
+ "sha256": "21371cd111b6b3d87774f3ea3ddeacdcb0f6aff8690a16d652daa3ea6e3b0145",
10
+ "size": 2883237
11
+ },
12
+ {
13
+ "path": "licenses/zashboard.txt",
14
+ "url": "https://raw.githubusercontent.com/Zephyruso/zashboard/v3.29.1/LICENSE",
15
+ "download_sha256": "ffc390eec51f16b58506b1a42c99fe0cd9ffea1e3081aab443100fd8c20182d9",
16
+ "gzip": false,
17
+ "sha256": "ffc390eec51f16b58506b1a42c99fe0cd9ffea1e3081aab443100fd8c20182d9",
18
+ "size": 1058
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,25 @@
1
+ // Integration for the pinned zashboard v3.29.1 storage contract.
2
+ // All package resources and API requests belong to the current mihomo origin.
3
+ for (const key of [
4
+ "config/check-upgrade-core", "config/auto-upgrade", "config/auto-upgrade-core",
5
+ "config/auto-ip-check", "config/auto-connection-check",
6
+ ]) {
7
+ localStorage.setItem(key, "false");
8
+ }
9
+
10
+ const backends = JSON.parse(localStorage.getItem("setup/api-list") || "[]");
11
+ const protocol = location.protocol.slice(0, -1);
12
+ const port = location.port || (protocol === "https" ? "443" : "80");
13
+ let backend = backends.find(item =>
14
+ item.host === location.hostname && item.port === port && item.protocol === protocol
15
+ );
16
+ if (!backend) {
17
+ backend = {
18
+ uuid: "mihomo-py-local", type: "clash", protocol, host: location.hostname,
19
+ port, secondaryPath: "", password: "", label: "mihomo-py",
20
+ disableUpgradeCore: true, disableTunMode: true,
21
+ };
22
+ backends.push(backend);
23
+ localStorage.setItem("setup/api-list", JSON.stringify(backends));
24
+ }
25
+ localStorage.setItem("setup/active-uuid", backend.uuid);