Add apps/miniprogram/tt as a standalone Douyin app with official usePrivacyCheck + tt.showModal/setClipboardData flow, single-chapter offline reader, and document console privacy setup for clipboard. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
||
"""Validate 小红书门户包:≤10MB;创服平台 zip 文件数 ≤200;全离线无 CDN。"""
|
||
from __future__ import annotations
|
||
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(__file__).resolve().parents[1]
|
||
LIMIT = 10 * 1024 * 1024
|
||
FILE_LIMIT = 200
|
||
|
||
|
||
def main() -> int:
|
||
release = Path(sys.argv[1]) if len(sys.argv) > 1 else ROOT / "release"
|
||
if not release.is_dir():
|
||
print(f"missing {release}")
|
||
return 1
|
||
files = [f for f in release.rglob("*") if f.is_file()]
|
||
size = sum(f.stat().st_size for f in files)
|
||
mb = size / 1024 / 1024
|
||
n = len(files)
|
||
print(f"xhs package size={mb:.2f} MB limit=10.00 MB")
|
||
print(f"xhs file_count={n} limit={FILE_LIMIT}")
|
||
fail = 0
|
||
if size > LIMIT:
|
||
print(f"FAIL package too large: {mb:.2f} MB > 10 MB")
|
||
fail = 1
|
||
if n > FILE_LIMIT:
|
||
print(f"FAIL too many files: {n} > {FILE_LIMIT}")
|
||
fail = 1
|
||
imgs = list((release / "images").glob("*")) if (release / "images").is_dir() else []
|
||
icons = list((release / "icons").glob("*")) if (release / "icons").is_dir() else []
|
||
img_sz = sum(p.stat().st_size for p in imgs)
|
||
print(f"images={len(imgs)} img_mb={img_sz/1024/1024:.2f} icons={len(icons)}")
|
||
if not fail:
|
||
print("OK")
|
||
return fail
|
||
|
||
|
||
if __name__ == "__main__":
|
||
raise SystemExit(main())
|