Build delivery over HTTPS and flatten source/web.

Keep/restore https://%@ in type0x01/core and rewrite daily module URLs to https, and move campaign assets from source/web/<hash>/ up to source/web/ so templates match the channel artifact layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hashbro
2026-08-09 16:07:55 +08:00
parent 9153a4f557
commit 8b079d37e4
87 changed files with 108 additions and 86 deletions
+31 -20
View File
@@ -9,37 +9,47 @@ if str(TOOLS) not in sys.path:
sys.path.insert(0, str(TOOLS))
from _scheme_patch import (
HTTPS,
HTTP_SLOT,
HTTP_VISIBLE,
LEGACY_SLASH,
NEW_VISIBLE,
OLD,
patch_deployment_scheme_to_http,
ensure_deployment_scheme_https,
)
class SchemePatchTests(unittest.TestCase):
def test_slot_sizes(self) -> None:
self.assertEqual(len(OLD), 10)
self.assertEqual(len(HTTPS), 10)
self.assertEqual(len(LEGACY_SLASH), 10)
self.assertEqual(len(NEW_VISIBLE), 9)
self.assertEqual(len(HTTP_SLOT), 10)
self.assertEqual(len(HTTP_VISIBLE), 9)
def test_patches_core_fat_dylib(self) -> None:
def test_leaves_core_https_alone(self) -> None:
src = FRONTEND / "source" / "sync_dylibs" / "tmp.dylib"
data = src.read_bytes()
self.assertEqual(data.count(OLD), 2)
out = patch_deployment_scheme_to_http(data, expect_hits=2, label="core")
self.assertEqual(out.count(OLD), 0)
self.assertEqual(out.count(LEGACY_SLASH), 0)
self.assertEqual(out.count(NEW_VISIBLE + b"\x00"), 2)
self.assertEqual(data.count(HTTPS), 2)
out = ensure_deployment_scheme_https(data, expect_hits=2, label="core")
self.assertEqual(out, data)
self.assertEqual(out.count(HTTPS), 2)
def test_migrates_legacy_trailing_slash(self) -> None:
def test_restores_http_slot_on_core(self) -> None:
src = FRONTEND / "source" / "sync_dylibs" / "tmp.dylib"
legacy = src.read_bytes().replace(OLD, LEGACY_SLASH)
self.assertEqual(legacy.count(LEGACY_SLASH), 2)
out = patch_deployment_scheme_to_http(legacy, expect_hits=2, label="core")
http_patched = src.read_bytes().replace(HTTPS, HTTP_SLOT)
self.assertEqual(http_patched.count(HTTP_SLOT), 2)
out = ensure_deployment_scheme_https(http_patched, expect_hits=2, label="core")
self.assertEqual(out.count(HTTPS), 2)
self.assertEqual(out.count(HTTP_SLOT), 0)
self.assertEqual(out.count(LEGACY_SLASH), 0)
self.assertEqual(out.count(NEW_VISIBLE + b"\x00"), 2)
def test_patches_type0x01_thin(self) -> None:
def test_restores_legacy_trailing_slash(self) -> None:
src = FRONTEND / "source" / "sync_dylibs" / "tmp.dylib"
legacy = src.read_bytes().replace(HTTPS, LEGACY_SLASH)
self.assertEqual(legacy.count(LEGACY_SLASH), 2)
out = ensure_deployment_scheme_https(legacy, expect_hits=2, label="core")
self.assertEqual(out.count(LEGACY_SLASH), 0)
self.assertEqual(out.count(HTTPS), 2)
def test_leaves_type0x01_https_alone(self) -> None:
src = (
FRONTEND
/ "source"
@@ -47,9 +57,10 @@ class SchemePatchTests(unittest.TestCase):
/ "65704c0722165a7bdedad3f3f61258b2f95470f6_type0x01.dylib"
)
data = src.read_bytes()
out = patch_deployment_scheme_to_http(data, expect_hits=1, label="t0")
self.assertEqual(out.count(OLD), 0)
self.assertEqual(out.count(NEW_VISIBLE + b"\x00"), 1)
self.assertEqual(data.count(HTTPS), 1)
out = ensure_deployment_scheme_https(data, expect_hits=1, label="t0")
self.assertEqual(out, data)
self.assertEqual(out.count(HTTPS), 1)
if __name__ == "__main__":