Initial project source

这个提交包含在:
apple
2026-11-20 15:32:57 +08:00
当前提交 fb47c07f7c
共修改 8405 个文件,包含 806907 行新增和 0 行删除
+76
查看文件
@@ -0,0 +1,76 @@
"""Import the no-HDR reference as a native Vue-mounted scene (no iframe)."""
import base64
import hashlib
from pathlib import Path
import re
import sys
source = Path(sys.argv[1]).read_text()
root = Path(__file__).resolve().parents[2]
output = root / 'aixun-ui/public/login-scene'
module = re.search(r'<script type="module">(.*?)</script>', source, re.S).group(1).strip()
match = re.match(r'import\*as (\w+) from"(data:[^"]+)";', module)
if match:
three = base64.b64decode(match.group(2).split(',', 1)[1]).decode()
core_urls = set(re.findall(r'data:text/javascript;base64,[A-Za-z0-9+/=]+', three))
assert len(core_urls) == 1
core_url = core_urls.pop()
body = module[match.end():]
else:
assert module.startswith('var ') and 'RectAreaLightUniformsLib.init()' in module
body = module
old_title = ''.join('\\u%04X' % ord(char) for char in '数产集团数据中台')
assert old_title in body
body = body.replace(old_title, '倬慧科技数据中台')
body = body.replace('DIGITAL INDUSTRY GROUP DATA PLATFORM', 'ZHUOHUI TECHNOLOGY DATA PLATFORM')
assert re.search(r'\b\w+\.environment=null', body)
# Remove reference-only global CSS and bind DOM access to this Vue component.
focus = 'if(new URLSearchParams(location.search).has("focus")){const u=document.createElement("style");u.textContent=".auth-card,.wash{display:none!important}",document.head.appendChild(u)}'
focus_new = 'if(new URLSearchParams(location.search).has("focus")){let n=document.createElement("style");n.textContent=".auth-card,.wash{display:none!important}",document.head.appendChild(n)}'
assert focus in body or focus_new in body
body = body.replace(focus, '').replace(focus_new, '')
body = body.replace('document.querySelector(', 'root.querySelector(')
body = body.replace('document.body.classList', 'root.classList')
body = body.replace('window.sceneLoadStarted', 'sceneLoadStarted')
body = body.replace('window.sceneLoadFailed()', 'sceneLoadFailed()')
for event in ('error', 'unhandledrejection'):
body = body.replace(',window.removeEventListener("' + event + '",window.sceneLoadFailed)', '')
disposed = 'z3' if match else 'y8'
body = body.replace('requestAnimationFrame(()=>{root.classList', f'requestAnimationFrame(()=>{{if({disposed})return;root.classList')
fallback = 'catch{root.querySelector("#scene-error").hidden=!1}'
assert fallback in body
body = body.replace(fallback, 'catch{sceneLoadFailed();return()=>{}}')
cleanup = re.search(r',addEventListener\("pagehide",\w+=>\{\w+.persisted\|\|\((.*)\)\}\);?\s*$', body, re.S)
assert cleanup
body = body[:cleanup.start()] + ';return()=>{' + cleanup.group(1) + ';};'
preamble = """
export async function mountLoginScene(root) {
const sceneLoadStarted = performance.now();
const sceneLoadFailed = () => {
root.classList.remove('scene-loading');
root.classList.add('scene-load-error');
root.querySelector('#scene-error').hidden = false;
};
"""
imports = f"import * as {match.group(1)} from './three.module.js';\n" if match else ''
scene = imports + preamble + body + '\n}\n'
assert all(token not in scene for token in (
'document.body', 'document.head', 'window.scene', 'addEventListener("pagehide"',
'reset-view', 'rotate-view', 'studio.hdr'))
# Complete validation before replacing any generated assets.
output.mkdir(parents=True, exist_ok=True)
if match:
(output / 'three.core.js').write_bytes(base64.b64decode(core_url.split(',', 1)[1]))
(output / 'three.module.js').write_text(three.replace(core_url, './three.core.js'))
else:
(output / 'three.core.js').unlink(missing_ok=True)
(output / 'three.module.js').unlink(missing_ok=True)
(output / 'scene.js').write_text(scene)
(output / 'THREE-LICENSE.txt').write_bytes(
(root / 'docs/preview/data-factory/vendor/THREE-LICENSE.txt').read_bytes())
# This scene-only reference has no logo; retain the existing application logo.
assert (output / 'group-logo.png').is_file()
(output / 'studio.hdr').unlink(missing_ok=True)
(output / 'index.html').unlink(missing_ok=True)
print('Source SHA256:', hashlib.sha256(source.encode()).hexdigest())
print('Native scene SHA256:', hashlib.sha256(scene.encode()).hexdigest())