dsh-client-ui-skin-tianlight 2.1.2 → 2.1.4
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.
- package/README.md +12 -1
- package/assets/bg-4k.mp4 +0 -0
- package/build-info.json +3 -3
- package/lib/client.js +236 -41
- package/lib/index.js +4 -3
- package/lib/weather-proxy.js +126 -63
- package/package.json +2 -2
- package/skin.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,17 @@
|
|
|
6
6
|
>
|
|
7
7
|
> npm 包名 `dsh-client-ui-skin-tianlight`(v2.0.2 起;旧链接安装包名 `@dsh-external/dsh-client-ui-skin-tianlight`)· 布线行 `ui-skin-tianlight` · body 属性 `data-dsh-tianlight`
|
|
8
8
|
|
|
9
|
+
## v2.1.3 · 长片不再过早降级
|
|
10
|
+
|
|
11
|
+
v2.1.2 解决了误触跳过;如果你的结尾是**简洁标志淡出**,那不是跳过,而是长片的性能兜底被过早触发:0.4× 档只要 30 帧平均超过 33ms 就切简洁版,启动阶段/窗口合成的一次抖动就会命中。
|
|
12
|
+
|
|
13
|
+
这一版把兜底阈值收紧到 **0.4× 平均 >80ms 且已经播放超过 4 秒** 才切简洁版:
|
|
14
|
+
|
|
15
|
+
- 0.75 → 0.5 → 0.4 的降档仍然保留;
|
|
16
|
+
- 0.4× 下 33–80ms 不会再切走,长片会完整播完,只是帧率低一些;
|
|
17
|
+
- 只有真正低于约 12fps(>80ms)才回简洁标志;
|
|
18
|
+
- 18.5 秒时间线、跳过提示、Esc 都不变。
|
|
19
|
+
|
|
9
20
|
## v2.1.2 · 跳过不再误触
|
|
10
21
|
|
|
11
22
|
长片本身是 18.5 秒,但「点击任意处跳过」会把**聚焦窗口的那一下点击**也当成跳过:很多机器上打开 DSH 后点一下窗口,长片就立刻跳到 16.65s 的落定,看起来像“只播了几秒就到结尾”。
|
|
@@ -772,7 +783,7 @@ node tools/release.mjs --dry-run --version 2.0.1-rc.2 --note "…"
|
|
|
772
783
|
- **第三方**:v0.6.0 内嵌 dsh-we-wallpaper host half(MIT,v0.4.0 @ `61ccaa2`)、wcap(Unlicense)、
|
|
773
784
|
RePKG(MIT,DXT 解码实现依据)、WebWallGL(MIT);组件、版本、归属与许可全文见
|
|
774
785
|
[docs/THIRD-PARTY.md](docs/THIRD-PARTY.md)
|
|
775
|
-
- **仓库完整版附带默认演示素材**:`assets/bg-4k.mp4`、`assets/cat.png`(约
|
|
786
|
+
- **仓库完整版附带默认演示素材**:`assets/bg-4k.mp4`、`assets/cat.png`(约 17MB);`assets/uploads/`、`state/`、`assets/derived/`(旧版用户数据位置)与其它自加素材不提交;v2.0.1 起用户数据在 DSH profile 目录,根本不在仓库里。替换或再分发前请确认你有使用权,缺失时以渐变兜底
|
|
776
787
|
- 桌宠形象与视频版权归各自权利方;如果只想要轻量代码仓库,删除这两个文件即可
|
|
777
788
|
|
|
778
789
|
## 已知取舍
|
package/assets/bg-4k.mp4
CHANGED
|
Binary file
|
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"product": "dsh-client-ui-skin-tianlight",
|
|
4
|
-
"version": "2.1.
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-11-
|
|
4
|
+
"version": "2.1.4",
|
|
5
|
+
"commit": "350e16af0d2b13bb144ea056f2397b41a310316f",
|
|
6
|
+
"builtAt": "2026-11-15T13:09:15+08:00",
|
|
7
7
|
"source": "pack"
|
|
8
8
|
}
|
package/lib/client.js
CHANGED
|
@@ -29,6 +29,13 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
*/
|
|
30
30
|
const HOST_API = "2";
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Shipped skin version. The long film prints it in the landing title, so it
|
|
34
|
+
* must equal `package.json` `version`; tools/test.mjs fails the chain when the
|
|
35
|
+
* two drift (the 2.1.0-2.1.3 builds printed a stale "2.0.4").
|
|
36
|
+
*/
|
|
37
|
+
const TL_BUILD_VERSION = "2.1.4";
|
|
38
|
+
|
|
32
39
|
/**
|
|
33
40
|
* Host identity last reported by `_engines`: `build` is the host's
|
|
34
41
|
* diagnostic build number, `api` the route-contract version it speaks. The
|
|
@@ -10613,13 +10620,25 @@ body[data-dsh-tianlight] [data-tl-hub] [data-tl-hub-splash-card] {
|
|
|
10613
10620
|
const hidden = document.hidden === true;
|
|
10614
10621
|
const visible = hidden === false && (document.visibilityState === undefined || document.visibilityState === "visible");
|
|
10615
10622
|
const lowPower = hasLowPower();
|
|
10623
|
+
// The opaque opening film hides the wallpaper and holds its decoder; any
|
|
10624
|
+
// frame-rate/dropped-frame sample taken behind it describes the film's GPU
|
|
10625
|
+
// budget, not the wallpaper's. Sampling there downgraded a healthy 4K video
|
|
10626
|
+
// to a still frame for five minutes (seen on a software renderer). Both
|
|
10627
|
+
// splashes carry [data-tl-splash]; the orphan is purged on the next apply.
|
|
10628
|
+
let splashOverlay = false;
|
|
10629
|
+
try {
|
|
10630
|
+
splashOverlay = document.body !== null && document.querySelector("[data-tl-splash]") !== null;
|
|
10631
|
+
} catch {
|
|
10632
|
+
splashOverlay = false;
|
|
10633
|
+
}
|
|
10616
10634
|
return {
|
|
10617
|
-
eligible: focused && visible && lowPower === false && userPaused === false,
|
|
10635
|
+
eligible: focused && visible && lowPower === false && userPaused === false && splashOverlay === false,
|
|
10618
10636
|
focused,
|
|
10619
10637
|
visible,
|
|
10620
10638
|
hidden,
|
|
10621
10639
|
lowPower,
|
|
10622
10640
|
userPaused,
|
|
10641
|
+
splashOverlay,
|
|
10623
10642
|
};
|
|
10624
10643
|
}
|
|
10625
10644
|
function adaptiveTick() {
|
|
@@ -10640,6 +10659,7 @@ body[data-dsh-tianlight] [data-tl-hub] [data-tl-hub-splash-card] {
|
|
|
10640
10659
|
(gate.visible ? "v" : "-") +
|
|
10641
10660
|
(gate.lowPower ? "l" : "-") +
|
|
10642
10661
|
(gate.userPaused ? "u" : "-") +
|
|
10662
|
+
(gate.splashOverlay ? "s" : "-") +
|
|
10643
10663
|
(gate.eligible ? "1" : "0");
|
|
10644
10664
|
if (gateKey !== adaptiveGateKey) {
|
|
10645
10665
|
adaptiveGateKey = gateKey;
|
|
@@ -26637,7 +26657,7 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
26637
26657
|
* 1.7s simple mark; the caller owns style/daily/session decisions.
|
|
26638
26658
|
*/
|
|
26639
26659
|
const SPLASH_FILM_CSS = "#film {\n --ink: #EAF2FF;\n --cyan: #7FE2FF;\n --gold: #FFD696;\n --sans: \"Segoe UI Variable Text\", \"Segoe UI\", \"Microsoft YaHei UI\", \"Microsoft YaHei\", \"PingFang SC\", system-ui, sans-serif;\n --serif: \"Source Han Serif SC Heavy\", \"Noto Serif SC\", \"STZhongsong\", \"SimSun\", serif;\n position: fixed; inset: 0; overflow: hidden; background: #000;\n color: var(--ink);\n font-family: var(--sans);\n -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;\n text-rendering: geometricPrecision;\n user-select: none; -webkit-user-select: none;\n}\n#film * { box-sizing: border-box; }\n#film button { font: inherit; }\n#film .controls { display: none !important; }\n#film .debug-label { display: none !important; }\n#film .title-copy { transform-origin: 0 0; }\n#film { position: fixed; inset: 0; overflow: hidden; background: #000; }\n#film .canvas { position: absolute; inset: 0; z-index: 10; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 300ms linear; }\n#film .canvas.on { opacity: 1; }\n#film .subtitle { position: absolute; left: 8.5%; bottom: 30%; z-index: 22;\n font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.4;\n letter-spacing: .12em; color: rgba(255,255,255,.72);\n text-shadow: 0 1px 22px rgba(0,0,0,.45); opacity: 0;\n will-change: opacity; pointer-events: none; }\n#film .letterbox { position: absolute; inset: 0; z-index: 40; pointer-events: none; }\n#film .letterbox .bar { position: absolute; left: 0; right: 0; height: 0; background: #000; will-change: transform; }\n#film .letterbox .bar.top { top: 0; }\n#film .letterbox .bar.bottom { bottom: 0; }\n#film .letterbox .bar::after { content: \"\"; position: absolute; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }\n#film .letterbox .bar.top::after { bottom: 0; }\n#film .letterbox .bar.bottom::after { top: 0; }\n#film .controls { position: absolute; right: 26px; bottom: 24px; z-index: 60;\n display: flex; align-items: center; gap: 8px; padding: 7px;\n border-radius: 999px; border: 1px solid rgba(255,255,255,.13);\n background: rgba(5,8,15,.38);\n -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15);\n box-shadow: 0 10px 35px rgba(0,0,0,.2); opacity: .45; transition: opacity 220ms ease; }\n#film .controls:hover, #film .controls:focus-within { opacity: 1; }\n#film .controls .controls button:hover, #film .controls button:focus-visible { background: rgba(255,255,255,.1); color: #fff; outline: none; }\n#film .skip-hint { position: absolute; right: 30px; bottom: 74px; z-index: 59;\n font-size: 11px; letter-spacing: .10em; color: rgba(255,255,255,.62);\n text-shadow: 0 1px 10px rgba(0,0,0,.3); opacity: 0; pointer-events: none; will-change: opacity; }\n#film .skip-veil { position: absolute; inset: 0; z-index: 45; background: #03050B; opacity: 0; pointer-events: none; }\n#film .debug-label { position: absolute; left: 26px; top: 22px; z-index: 61; display: none; padding: 6px 9px; border-radius: 6px; background: rgba(0,0,0,.5); color: rgba(255,255,255,.7); font: 10px/1.4 ui-monospace, monospace; pointer-events: none; }\n#film .debug .debug-label { display: block; }\n#film .simple-veil { position: absolute; inset: 0; z-index: 50; display: none; background: #03050B; pointer-events: none; }\n#film[data-state=\"simple\"] .simple-veil { display: block; }\n#film .simple-mark { position: absolute; left: 50%; top: 50%; z-index: 51; transform: translate(-50%, -50%); font-family: var(--serif); font-size: clamp(64px,7vw,112px); letter-spacing: .20em; padding-left: .20em; color: #fff; opacity: 0; }\n#film .simple-sub { margin-top: 24px; font-family: var(--sans); font-size: 11px; letter-spacing: .45em; text-align: center; color: rgba(255,255,255,.55); }\n#film .title-copy { position: absolute; inset: 0; z-index: 25; pointer-events: none; opacity: 0; will-change: opacity; }\n#film .tc-brand { position: absolute; left: 50%; top: 660px; transform: translateX(-50%);\n font-family: var(--sans); font-weight: 800; font-size: 40px; line-height: 40px;\n letter-spacing: 14px; padding-left: 14px; color: #f5fdff; white-space: nowrap; }\n#film .tc-credit { position: absolute; left: 50%; top: 712px; transform: translateX(-50%);\n font-family: var(--serif); font-weight: 400; font-size: 27px; line-height: 28px;\n letter-spacing: 3.2px; color: #faf0dc; white-space: nowrap; }\n#film .tc-l0 { position: absolute; left: 50%; top: 18px; transform: translateX(-50%);\n font-family: \"Cascadia Mono\", Consolas, monospace; font-size: 12px; line-height: 16px;\n letter-spacing: 1.8px; color: rgba(209,247,255,.82); white-space: nowrap; }\n#film .tc-l1, #film .tc-l2 { position: absolute; top: 492px; transform: translateX(-50%);\n font-family: \"Cascadia Mono\", Consolas, monospace; font-size: 12px; line-height: 16px;\n letter-spacing: 1.8px; color: rgba(209,247,255,.82); white-space: nowrap; }\n#film .tc-l1 { left: 376px; }\n#film .tc-l2 { left: 1544px; }\n#film .skip-hint { pointer-events: auto; cursor: pointer; padding: 6px 10px; border-radius: 999px; background: rgba(5,8,15,.35); border: 1px solid rgba(255,255,255,.12); }\n#film .skip-hint:hover { color: #fff; background: rgba(255,255,255,.10); }\n";
|
|
26640
|
-
const SPLASH_FILM_DOM = "<canvas class=\"canvas\" id=\"glCanvas\" aria-hidden=\"true\"></canvas>\n\n <div class=\"subtitle\" id=\"sub1\" aria-hidden=\"true\">夜再长,</div>\n <div class=\"subtitle\" id=\"sub2\" aria-hidden=\"true\">天总会亮。</div>\n\n <div class=\"letterbox\" id=\"letterbox\" aria-hidden=\"true\">\n <div class=\"bar top\" id=\"barTop\"></div>\n <div class=\"bar bottom\" id=\"barBottom\"></div>\n </div>\n\n <div class=\"skip-hint\" id=\"skipHint\" role=\"button\" tabindex=\"0\">点击这里跳过</div>\n <div class=\"skip-veil\" id=\"skipVeil\"></div>\n <div class=\"controls\" aria-label=\"预览控制\">\n <button type=\"button\" id=\"replayBtn\">重播</button>\n <button type=\"button\" id=\"soundBtn\">声音:关</button>\n <button type=\"button\" id=\"skipBtn\">跳过</button>\n </div>\n <div class=\"debug-label\" id=\"debugLabel\">t = 0 ms</div>\n\n <div class=\"simple-veil\" id=\"simpleVeil\"></div>\n <div class=\"simple-mark\" id=\"simpleMark\">\n <div>天光</div>\n <div class=\"simple-sub\">TIANLIGHT</div>\n </div>\n <div class=\"title-copy\" id=\"titleCopy\" aria-hidden=\"true\">\n <div class=\"tc-brand\">TIANLIGHT</div>\n <div class=\"tc-credit\">给 DeepSeek Harness 的一片天</div>\n <div class=\"tc-l0\"
|
|
26660
|
+
const SPLASH_FILM_DOM = "<canvas class=\"canvas\" id=\"glCanvas\" aria-hidden=\"true\"></canvas>\n\n <div class=\"subtitle\" id=\"sub1\" aria-hidden=\"true\">夜再长,</div>\n <div class=\"subtitle\" id=\"sub2\" aria-hidden=\"true\">天总会亮。</div>\n\n <div class=\"letterbox\" id=\"letterbox\" aria-hidden=\"true\">\n <div class=\"bar top\" id=\"barTop\"></div>\n <div class=\"bar bottom\" id=\"barBottom\"></div>\n </div>\n\n <div class=\"skip-hint\" id=\"skipHint\" role=\"button\" tabindex=\"0\">点击这里跳过</div>\n <div class=\"skip-veil\" id=\"skipVeil\"></div>\n <div class=\"controls\" aria-label=\"预览控制\">\n <button type=\"button\" id=\"replayBtn\">重播</button>\n <button type=\"button\" id=\"soundBtn\">声音:关</button>\n <button type=\"button\" id=\"skipBtn\">跳过</button>\n </div>\n <div class=\"debug-label\" id=\"debugLabel\">t = 0 ms</div>\n\n <div class=\"simple-veil\" id=\"simpleVeil\"></div>\n <div class=\"simple-mark\" id=\"simpleMark\">\n <div>天光</div>\n <div class=\"simple-sub\">TIANLIGHT</div>\n </div>\n <div class=\"title-copy\" id=\"titleCopy\" aria-hidden=\"true\">\n <div class=\"tc-brand\">TIANLIGHT</div>\n <div class=\"tc-credit\">给 DeepSeek Harness 的一片天</div>\n <div class=\"tc-l0\"></div>\n <div class=\"tc-l1\">06:12</div>\n <div class=\"tc-l2\">E 92°</div>\n </div>";
|
|
26641
26661
|
const SPLASH_FILM_SHADERS = {"scene-frag":{"type":"fragment","src":"#version 300 es\nprecision highp float;\nout vec4 fragColor;\n\nuniform vec2 uRes;\nuniform float uTime;\nuniform float uYaw;\nuniform float uPitch;\nuniform float uFov;\nuniform vec3 uSkyTop;\nuniform vec3 uSkyMid;\nuniform vec3 uSkyHor;\nuniform vec3 uSunDir;\nuniform vec3 uSunColor;\nuniform float uDawn;\nuniform float uStarFade;\nuniform float uMilky;\nuniform float uPrologue;\nuniform vec3 uHeroDir;\nuniform vec3 uHeroRight;\nuniform vec3 uHeroUp;\nuniform float uCometA;\nuniform vec2 uCometHead;\nuniform vec2 uCometDir;\nuniform float uCometLen;\nuniform float uMeteorA;\nuniform vec2 uMeteorHead;\nuniform vec2 uMeteorDir;\nuniform float uMeteorLen;\nuniform float uMeteor2A;\nuniform vec2 uMeteor2Head;\nuniform vec2 uMeteor2Dir;\nuniform float uMeteor2Len;\nuniform float uMeteor3A;\nuniform vec2 uMeteor3Head;\nuniform vec2 uMeteor3Dir;\nuniform float uMeteor3Len;\nuniform float uAurora;\nuniform float uAuroraPhase;\nuniform float uStarDebug;\nuniform float uStarBreath;\nuniform float uTitleGlow;\nuniform float uBeam;\nuniform vec2 uGap0;\nuniform vec2 uGap1;\nuniform vec2 uGap2;\nuniform vec2 uGap3;\nuniform vec2 uGap4;\nuniform vec2 uGap5;\nuniform vec2 uGap6;\nuniform vec2 uGap7;\nuniform sampler2D uNoise;\nuniform sampler2D uHorizonTex;\nuniform float uHorizonScale;\nuniform vec3 uRimColor;\nuniform float uRimStrength;\n\n#define PI 3.141592653589793\n#define MW_NORMAL normalize(vec3(0.38, 0.42, -0.82))\nconst vec3 A_CYAN = vec3(0.212, 0.753, 1.0);\nconst vec3 A_BLUE = vec3(0.050, 0.275, 0.745);\nconst vec3 A_VIOLET = vec3(0.144, 0.102, 0.611);\n\nfloat sat(float v) { return clamp(v, 0.0, 1.0); }\n\nfloat hash21(vec2 p) {\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n}\n\nvec3 starLayer(vec3 rd, vec2 lp, vec2 shift, float density, float seed, float size, float power, float flare) {\n vec2 q = (lp + shift) * density + seed;\n vec2 id = floor(q);\n float h = hash21(id + seed * 1.7);\n float h2 = hash21(id + seed * 2.9 + 8.2);\n vec2 off = (vec2(h, h2) - 0.5) * 0.62;\n vec2 starLP = (id + 0.5 + off - seed) / density - shift;\n float lon = (starLP.x - 0.5) * 2.0 * PI;\n float lat = (starLP.y - 0.5) * PI;\n vec3 sd = vec3(cos(lon) * cos(lat), sin(lat), sin(lon) * cos(lat));\n float mu = dot(rd, sd);\n vec3 perp = rd - sd * mu;\n float d = length(perp);\n float rad = size * (0.30 + 0.70 * h2) * (1.0 + uStarDebug * 8.0);\n float visible = mix(step(0.55, h2) * step(0.03, h), 1.0, uStarDebug);\n float tw = 0.90 + 0.10 * sin(uTime * (0.25 + 0.25 * h) + h2 * 6.283 + id.x * 0.27);\n float core = 1.0 - smoothstep(0.0, rad, d);\n float halo = exp(-d / (rad * 1.8 + 0.0001)) * 0.10;\n float spark = 0.0;\n if (flare > 0.0) {\n vec3 t1 = normalize(cross(sd, vec3(0.0, 1.0, 0.0)) + vec3(0.0001, 0.0, 0.0));\n vec3 t2 = cross(sd, t1);\n float dx = abs(dot(rd - sd, t1));\n float dy = abs(dot(rd - sd, t2));\n spark = (exp(-dx * 1200.0) * exp(-dy * 80.0) + exp(-dy * 1200.0) * exp(-dx * 80.0)) * flare;\n }\n vec3 tint = mix(vec3(0.70, 0.83, 1.0), vec3(1.0, 0.93, 0.78), smoothstep(0.72, 1.0, h));\n float variation = 0.12 + 0.88 * pow(h, 2.4);\n return tint * (core * 1.9 + halo + spark * visible * 0.30) * visible * power * tw * variation;\n}\n\nfloat celestialLon(vec3 rd) { return atan(rd.z, rd.x) / (2.0 * PI) + 0.5; }\nfloat celestialLat(vec3 rd) { return asin(clamp(rd.y, -1.0, 1.0)) / PI + 0.5; }\n\nvec3 heroStar(vec3 rd) {\n float dx = dot(rd, uHeroRight);\n float dy = dot(rd, uHeroUp);\n float d = length(vec2(dx, dy));\n float core = 1.0 - smoothstep(0.0015, 0.007, d);\n float halo = exp(-d * 46.0) * 0.22 + exp(-d * 12.0) * 0.045;\n float fx = exp(-abs(dx) * 95.0) * exp(-abs(dy) * 18.0);\n float fy = exp(-abs(dy) * 95.0) * exp(-abs(dx) * 18.0);\n float tw = 0.91 + 0.09 * sin(uTime * 0.55);\n return vec3(0.90, 0.96, 1.0) * (core * 2.3 + halo + (fx + fy) * 0.20) * tw;\n}\n\nvec3 milkyWay(vec3 rd) {\n float band = exp(-pow(dot(rd, MW_NORMAL) / 0.21, 2.0));\n vec2 lp = vec2(celestialLon(rd), celestialLat(rd));\n float n = texture(uNoise, lp * vec2(3.2, 2.4) + 0.31).r;\n float n2 = texture(uNoise, lp * vec2(8.0, 6.0) + 2.7).g;\n float dust = smoothstep(0.45, 0.72, n2);\n vec3 deep = vec3(0.012, 0.018, 0.052);\n vec3 blue = vec3(0.060, 0.095, 0.235);\n vec3 violet = vec3(0.17, 0.13, 0.28);\n vec3 c = mix(deep, blue, smoothstep(0.26, 0.72, n));\n c = mix(c, violet, smoothstep(0.45, 0.88, n) * 0.55);\n c *= band * (0.55 + 0.65 * n) * (1.0 - 0.45 * dust);\n c += violet * band * 0.045;\n return c * 1.20;\n}\n\nvec3 comet(vec2 p) {\n vec2 q = p - uCometHead;\n vec2 dir = normalize(uCometDir);\n vec2 perp = vec2(-dir.y, dir.x);\n float along = dot(q, dir);\n float side = dot(q, perp);\n float t = clamp(along / max(0.0001, uCometLen), 0.0, 1.0);\n float window = smoothstep(-0.006, 0.010, along) * (1.0 - smoothstep(0.94, 1.08, t));\n float fade = pow(max(0.0, 1.0 - t), 2.1);\n float curve = 0.032 * t * t;\n float w1 = 0.0022 + 0.017 * t;\n float a = exp(-pow((side - 0.008 * t - curve) / w1, 2.0)) * fade;\n float b = exp(-pow((side + 0.020 * t + curve * 0.35) / (w1 * 1.35), 2.0)) * pow(max(0.0, 1.0 - t), 2.8);\n float n1 = texture(uNoise, vec2(along * 9.0, side * 5.0 + 0.3)).r;\n float n2 = texture(uNoise, vec2(along * 3.2, side * 2.2 + 1.7)).g;\n float fil = 0.62 + 0.62 * smoothstep(0.14, 0.86, n1) * (0.72 + 0.28 * n2);\n float sparkle = smoothstep(0.90, 1.0, texture(uNoise, vec2(along * 120.0, side * 70.0)).b) * (1.0 - t);\n vec3 c = A_CYAN * a * 0.88 + vec3(1.0, 0.80, 0.48) * b * 0.95;\n c *= fil * window;\n c += vec3(0.92, 0.98, 1.0) * sparkle * window * 0.22;\n float head = exp(-length(q) * 320.0) * 6.5 + exp(-length(q) * 85.0) * 0.30;\n c += vec3(0.86, 0.96, 1.0) * head;\n float hx = exp(-abs(q.x) * 210.0) * exp(-abs(q.y) * 26.0);\n float hy = exp(-abs(q.y) * 210.0) * exp(-abs(q.x) * 26.0);\n c += vec3(0.72, 0.92, 1.0) * (hx + hy) * 0.22;\n return c * uCometA;\n}\n\nvec3 meteorCore(vec2 p, float A, vec2 headPos, vec2 dirIn, float len) {\n vec2 q = p - headPos;\n vec2 dir = normalize(dirIn);\n vec2 perp = vec2(-dir.y, dir.x);\n float along = dot(q, dir);\n float side = dot(q, perp);\n float t = clamp(along / max(0.0001, len), 0.0, 1.0);\n float window = smoothstep(-0.002, 0.004, along) * (1.0 - smoothstep(0.90, 1.06, t));\n float trail = exp(-abs(side) / (0.0016 + 0.0034 * t)) * pow(1.0 - t, 2.2) * window;\n float head = exp(-length(q) * 420.0) * 5.0 + exp(-length(q) * 120.0) * 0.35;\n return vec3(0.86, 0.96, 1.0) * (trail * 0.75 + head) * A;\n}\nvec3 meteor(vec2 p) { return meteorCore(p, uMeteorA, uMeteorHead, uMeteorDir, uMeteorLen); }\nvec3 meteor2(vec2 p) { return meteorCore(p, uMeteor2A, uMeteor2Head, uMeteor2Dir, uMeteor2Len); }\nvec3 meteor3(vec2 p) { return meteorCore(p, uMeteor3A, uMeteor3Head, uMeteor3Dir, uMeteor3Len); }\n\nfloat angDiff(float a, float b) {\n float d = abs(a - b);\n return min(d, 2.0 * PI - d);\n}\n\nvec3 aurora(float az, float el) {\n vec3 col = vec3(0.0);\n for (int i = 0; i < 3; i++) {\n float fi = float(i);\n float baseCenter = -0.27 + fi * 0.27;\n float center = baseCenter + 0.055 * sin(el * 3.2 + fi * 2.1 + uAuroraPhase * 0.12)\n + 0.025 * sin(az * 2.0 + fi * 1.3 + uAuroraPhase * 0.05);\n float width = 0.070 + fi * 0.006;\n float topN = texture(uNoise, vec2(az * 1.25 + fi * 0.31 + uAuroraPhase * 0.010, 0.21 + fi * 0.17)).g;\n float foldN = texture(uNoise, vec2(az * 1.15 + fi * 0.40 + uAuroraPhase * 0.018, el * 0.32 + fi * 0.20)).r;\n float top = 0.42 + fi * 0.020 + topN * 0.065;\n float bot = 0.002 + 0.010 * (0.5 + 0.5 * sin(az * 4.5 + fi * 1.8 - uAuroraPhase * 0.05));\n float vert = (1.0 - smoothstep(top - 0.11, top, el)) * smoothstep(bot - 0.004, bot + 0.004, el);\n if (vert <= 0.001) continue;\n float folds = 0.42 + 0.58 * smoothstep(0.18, 0.82, foldN);\n float fine = 0.86 + 0.14 * sin(az * 23.0 + foldN * 7.0 + uAuroraPhase * 0.10 + fi * 1.7);\n float base = exp(-max(el - bot, 0.0) / 0.040);\n float glow = pow(max(0.0, 1.0 - el / max(top, 0.05)), 1.55);\n float core = exp(-pow((az - center) / width, 2.0));\n float halo = exp(-pow((az - center) / (width * 2.35), 2.0)) * 0.20;\n float center2 = center + 0.022 * sin(el * 7.0 + fi * 1.9 + uAuroraPhase * 0.27);\n float slice = exp(-pow((az - center2) / (width * 1.55), 2.0)) * 0.42;\n float curtain = (core + halo + slice) * vert * glow * folds * fine;\n curtain = max(curtain, core * vert * glow * 0.78);\n vec3 c = mix(A_CYAN, A_BLUE, smoothstep(0.0, top * 0.45, el));\n c = mix(c, A_VIOLET, smoothstep(top * 0.45, top * 1.05, el));\n c = mix(c, mix(A_CYAN, vec3(0.82, 0.98, 1.0), 0.40), base * 0.62);\n float middleBoost = (i == 1) ? 2.30 : 1.0;\n col += c * curtain * (0.98 - fi * 0.045) * middleBoost;\n col += mix(A_CYAN, vec3(0.82, 0.98, 1.0), 0.35) * (core + halo * 0.4) * base * 0.10;\n if (i == 1) {\n float travel = exp(-pow((az - (-0.44 + 0.88 * fract(uAuroraPhase * 0.075))) / 0.024, 2.0));\n col += A_CYAN * travel * (core + halo) * vert * 0.36;\n }\n }\n col += mix(A_CYAN, A_BLUE, 0.40) * exp(-el / 0.050) * 0.026;\n return col * 1.05;\n}\n\nvoid main() {\n vec2 p = (gl_FragCoord.xy - 0.5 * uRes) / uRes.y;\n float tanF = tan(radians(uFov) * 0.5);\n vec3 f = vec3(sin(uYaw) * cos(uPitch), sin(uPitch), cos(uYaw) * cos(uPitch));\n vec3 r = vec3(cos(uYaw), 0.0, -sin(uYaw));\n vec3 up = normalize(vec3(\n f.y * r.z - f.z * r.y,\n f.z * r.x - f.x * r.z,\n f.x * r.y - f.y * r.x\n ));\n vec3 rd = normalize(f + r * (p.x * 2.0 * tanF) + up * (p.y * 2.0 * tanF));\n\n float el = rd.y;\n float az = atan(rd.x, rd.z);\n float hNorm = texture(uHorizonTex, vec2(fract(az / (2.0 * PI) + 0.5), 0.5)).r;\n float h = hNorm * uHorizonScale;\n float sunAz = atan(uSunDir.x, uSunDir.z);\n float dAz = angDiff(az, sunAz);\n float dawn = clamp(uDawn, 0.0, 1.0);\n\n vec3 sky = mix(uSkyHor, uSkyMid, smoothstep(-0.025, 0.20, el));\n sky = mix(sky, uSkyTop, smoothstep(0.10, 0.66, el));\n\n // The bright band behind the cloud line: strongest where the sun is hiding.\n float goldBand = exp(-pow((el - h - 0.0040) / 0.013, 2.0)) * (0.35 + 1.25 * exp(-pow(dAz / 0.45, 2.0)));\n sky += uSunColor * goldBand * dawn * 0.86;\n sky += vec3(1.0, 0.34, 0.055) * goldBand * dawn * 0.22;\n sky += vec3(0.75, 0.24, 0.32) * exp(-pow((el - h - 0.055) / 0.085, 2.0)) * dawn * 0.13 * (0.45 + 0.8 * exp(-pow(dAz / 0.6, 2.0)));\n float broadGlow = exp(-max(el - h, 0.0) / 0.11) * (0.35 + 0.75 * exp(-pow(dAz / 0.60, 2.0)));\n sky += uSunColor * broadGlow * dawn * 0.030;\n float night = 1.0 - clamp(dawn, 0.0, 1.0);\n sky += vec3(0.005, 0.011, 0.024) * exp(-max(el, 0.0) / 0.32) * night;\n sky += vec3(0.0012, 0.0028, 0.0075) * night;\n\n float mu = max(dot(rd, uSunDir), 0.0);\n float above = smoothstep(-0.020, 0.012, uSunDir.y);\n float ang = acos(clamp(mu, -1.0, 1.0));\n sky += uSunColor * (exp(-ang * 220.0) * 0.55 + exp(-ang * 55.0) * 0.14\n + exp(-ang * 12.0) * 0.07) * above * dawn;\n sky += uSunColor * exp(-ang * 2.6) * 0.090 * above * dawn;\n sky += uSunColor * exp(-ang * 0.80) * 0.022 * above * dawn;\n float disk = 1.0 - smoothstep(0.0145, 0.0180, ang);\n float limb = 0.72 + 0.28 * (1.0 - smoothstep(0.0, 0.0180, ang));\n float diskAmp = mix(6.0, 0.55, uTitleGlow);\n float ringAmp = mix(1.4, 0.10, uTitleGlow);\n sky += mix(uSunColor, vec3(1.0, 0.95, 0.82), 0.55) * disk * limb * diskAmp * above * dawn;\n sky += uSunColor * exp(-abs(ang - 0.0140) * 320.0) * ringAmp * above * dawn;\n sky += uSunColor * exp(-ang * 24.0) * 0.30 * uTitleGlow * above * dawn;\n\n if (uStarFade > 0.001) {\n vec2 lp = vec2(celestialLon(rd), celestialLat(rd));\n vec3 stars = vec3(0.0);\n stars += starLayer(rd, lp, vec2(0.07, -0.02), 330.0, 2.0, 0.0013, 0.55, 0.0);\n stars += starLayer(rd, lp, vec2(-0.03, 0.04), 130.0, 5.3, 0.00085, 0.78, 0.0);\n stars += starLayer(rd, lp, vec2(0.02, 0.01), 24.0, 9.1, 0.00055, 1.15, 0.28);\n stars += starLayer(rd, lp, vec2(-0.11, 0.06), 430.0, 13.7, 0.00028, 0.30, 0.0);\n sky += stars * uStarFade;\n }\n sky += milkyWay(rd) * uMilky;\n if (uCometA > 0.001) sky += comet(p);\n if (uMeteorA > 0.001) sky += meteor(p);\n if (uMeteor2A > 0.001) sky += meteor2(p);\n if (uMeteor3A > 0.001) sky += meteor3(p);\n\n if (uAurora > 0.001) {\n sky += aurora(az, el) * uAurora;\n }\n\n // a fan of shafts: every wedge starts at a low point of the cloud line and\n // radiates away from the sun, widening as it climbs.\n if (uBeam > 0.001 && el > h) {\n vec2 gaps[8] = vec2[8](uGap0, uGap1, uGap2, uGap3, uGap4, uGap5, uGap6, uGap7);\n float here = el - h;\n float beams = 0.0;\n for (int i = 0; i < 8; i++) {\n if (gaps[i].y <= 0.001) continue;\n float wN = fract(sin(float(i) * 17.13) * 43758.5);\n float ga = gaps[i].x;\n float gs = gaps[i].y;\n float center = ga + (ga - sunAz) * here * 0.82;\n float wobble = 0.009 * sin(here * 12.0 + float(i) * 1.7 + uTime * 0.15);\n float spread = 0.006 + 0.100 * here + 0.008 * wN;\n float d = angDiff(az, center + wobble);\n float body = exp(-pow(d / spread, 2.0)) * exp(-here / 0.32) * gs;\n float wide = exp(-pow(d / (spread * 2.6), 2.0)) * exp(-here / 0.38) * gs;\n float core = exp(-pow(d / (spread * 0.24), 2.0)) * exp(-here / 0.42) * gs;\n float baseGlow = exp(-here / 0.070) * gs;\n float grain = texture(uNoise, vec2(az * 6.0 + ga * 4.0, here * 4.0 - uTime * 0.08)).r;\n float grain2 = texture(uNoise, vec2(az * 17.0 + ga * 7.0, here * 9.0 + uTime * 0.03)).g;\n body *= 0.58 + 0.52 * grain;\n float soft = 0.72 + 0.28 * grain2;\n float nearSun = exp(-abs(ga - sunAz) / 0.60);\n beams += (body * 0.80 + wide * 0.26 + core * 1.30 + baseGlow * 0.12) * soft * (0.45 + 0.80 * nearSun);\n }\n beams += exp(-here / 0.050) * 0.08;\n vec3 beamCol = mix(uSunColor, vec3(1.0, 0.62, 0.24), 0.46);\n sky += beamCol * beams * uBeam * 0.17;\n }\n\n // distant cloud-sea silhouette: a single rolling line, no near cloud detail\n float edge = 1.0 - smoothstep(-0.0012, 0.0012, el - h);\n vec3 silTop = mix(vec3(0.010, 0.013, 0.032), vec3(0.045, 0.034, 0.082), dawn);\n vec3 silBot = mix(vec3(0.002, 0.003, 0.008), vec3(0.016, 0.013, 0.038), dawn);\n vec3 sil = mix(silBot, silTop, smoothstep(-0.07, h, el));\n sil += vec3(0.010, 0.012, 0.030) * (0.55 + 0.45 * texture(uNoise, vec2(az * 0.63 + 0.2, 0.18)).r);\n sky = mix(sky, sil, edge);\n\n float rimD = el - h;\n float rim = exp(-max(rimD, 0.0) * 620.0) * smoothstep(-0.0018, 0.0018, rimD);\n float rimWide = exp(-max(rimD, 0.0) * 130.0) * smoothstep(-0.0022, 0.0022, rimD);\n sky += uRimColor * (rim * 1.25 + rimWide * 0.42) * uRimStrength * (1.0 - edge);\n sky += uSunColor * exp(-max(rimD, 0.0) / 0.050) * 0.048 * dawn * (1.0 - edge);\n\n // Prologue: black at t=0, one star breathing, then the sky starts to exist.\n float skyGate = smoothstep(1.30, 2.55, uTime);\n sky *= skyGate;\n sky += heroStar(rd) * uPrologue;\n sky *= 1.0 + 0.045 * sin(uTime * 2.1) * uStarBreath;\n\n fragColor = vec4(max(sky, vec3(0.0)), edge);\n}"},"god-frag":{"type":"fragment","src":"#version 300 es\nprecision highp float;\nout vec4 fragColor;\nuniform sampler2D uScene;\nuniform vec2 uRes;\nuniform vec2 uSunUV;\nuniform vec3 uSunColor;\nuniform float uStrength;\nvoid main() {\n vec2 uv = gl_FragCoord.xy / uRes;\n vec2 delta = (uv - uSunUV) / 48.0;\n vec2 p = uSunUV;\n float blockedLen = 0.0;\n bool escaped = false;\n for (int i = 0; i < 48; i++) {\n p += delta;\n float occ = texture(uScene, clamp(p, vec2(0.001), vec2(0.999))).a;\n if (!escaped) {\n if (occ > 0.5) blockedLen += 1.0;\n else escaped = true;\n } else if (occ > 0.5) {\n blockedLen += 1.0;\n }\n }\n float lit = exp(-blockedLen * 0.42);\n float dist = length(uv - uSunUV);\n float falloff = exp(-dist * 1.9) * smoothstep(0.0, 0.035, dist + 0.001);\n vec3 c = uSunColor * lit * falloff * uStrength;\n fragColor = vec4(c, 1.0);\n}"},"bright-frag":{"type":"fragment","src":"#version 300 es\nprecision highp float;\nout vec4 fragColor;\nuniform sampler2D uScene;\nuniform vec2 uRes;\nuniform float uThreshold;\nvoid main() {\n vec2 uv = gl_FragCoord.xy / uRes;\n vec3 c = texture(uScene, uv).rgb;\n float l = max(c.r, max(c.g, c.b));\n float b = smoothstep(uThreshold, uThreshold + 0.9, l);\n fragColor = vec4(c * b, 1.0);\n}"},"blur-frag":{"type":"fragment","src":"#version 300 es\nprecision highp float;\nout vec4 fragColor;\nuniform sampler2D uTex;\nuniform vec2 uRes;\nuniform vec2 uDir;\nvoid main() {\n vec2 uv = gl_FragCoord.xy / uRes;\n float w0 = 0.227027, w1 = 0.1945946, w2 = 0.1216216, w3 = 0.054054, w4 = 0.016216;\n vec2 o = uDir / uRes;\n vec3 c = texture(uTex, uv).rgb * w0;\n c += texture(uTex, uv + o * 1.0).rgb * w1;\n c += texture(uTex, uv - o * 1.0).rgb * w1;\n c += texture(uTex, uv + o * 2.0).rgb * w2;\n c += texture(uTex, uv - o * 2.0).rgb * w2;\n c += texture(uTex, uv + o * 3.0).rgb * w3;\n c += texture(uTex, uv - o * 3.0).rgb * w3;\n c += texture(uTex, uv + o * 4.0).rgb * w4;\n c += texture(uTex, uv - o * 4.0).rgb * w4;\n fragColor = vec4(c, 1.0);\n}"},"composite-frag":{"type":"fragment","src":"#version 300 es\nprecision highp float;\nout vec4 fragColor;\nuniform sampler2D uScene;\nuniform sampler2D uBloom;\nuniform sampler2D uRays;\nuniform sampler2D uUi;\nuniform vec2 uRes;\nuniform float uTime;\nuniform vec2 uSunUV;\nuniform vec3 uSunColor;\nuniform float uFlare;\nuniform float uRayStrength;\nuniform float uBloomStrength;\nuniform float uExposure;\nuniform float uDark;\nuniform float uUiMix;\nuniform float uRaw;\nuniform vec4 uUiRect;\n\nfloat hash21(vec2 p) {\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n}\nvec3 aces(vec3 x) {\n return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);\n}\nvec3 toSRGB(vec3 x) {\n return mix(x * 12.92, 1.055 * pow(max(x, vec3(0.0)), vec3(1.0 / 2.4)) - 0.055, step(0.0031308, x));\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / uRes;\n if (uRaw > 0.5) { fragColor = vec4(texture(uScene, uv).rgb, 1.0); return; }\n vec2 d = uv - 0.5;\n\n float ca = 0.0011 * (0.18 + dot(d, d) * 1.8);\n vec3 color;\n color.r = texture(uScene, uv + d * ca).r;\n color.g = texture(uScene, uv).g;\n color.b = texture(uScene, uv - d * ca).b;\n\n if (uRayStrength > 0.001) {\n vec3 rays = texture(uRays, uv).rgb;\n color += rays * (1.0 - texture(uScene, uv).a);\n }\n\n color += texture(uBloom, uv).rgb * uBloomStrength * 1.35;\n\n if (uFlare > 0.001) {\n vec2 sp = uv - uSunUV;\n float ax = abs(sp.x), ay = abs(sp.y);\n float edgeFade = 1.0 - smoothstep(0.38, 0.52, ax);\n float hEnv = exp(-pow(ax / 0.30, 2.0)) * edgeFade;\n float core = exp(-ay * 210.0) * 1.10 + exp(-ay * 72.0) * 0.34;\n float glow = exp(-ay * 24.0) * 0.10 + exp(-ay * 10.0) * 0.035;\n float line = (core + glow) * hEnv;\n vec3 warm = vec3(1.0, 0.84, 0.56);\n vec3 cool = vec3(0.34, 0.86, 1.0);\n vec3 flareCol = mix(warm, cool, smoothstep(0.015, 0.28, ax));\n color += flareCol * line * uFlare * 0.62;\n vec2 axis = vec2(0.5) - uSunUV;\n color += vec3(0.22, 0.62, 0.94) * exp(-length(uv - (uSunUV + axis * 0.34)) * 64.0) * 0.060 * uFlare;\n color += vec3(0.86, 0.68, 0.46) * exp(-length(uv - (uSunUV + axis * 0.66)) * 48.0) * 0.045 * uFlare;\n color += vec3(0.42, 0.64, 0.86) * exp(-length(uv - (uSunUV + axis * 1.02)) * 38.0) * 0.038 * uFlare;\n }\n\n // soft radial dimming behind the wordmark; the glyphs themselves stay opaque\n float dx = (uv.x - 0.500) / 0.345;\n float dy = (uv.y - 0.537) / 0.225;\n float dk = exp(-(dx * dx + dy * dy) * 1.55);\n color *= 1.0 - 0.35 * uDark * dk;\n\n color = max(color, vec3(0.0)) * uExposure;\n color = aces(color);\n float gradeLuma = dot(color, vec3(0.2126, 0.7152, 0.0722));\n color = mix(vec3(gradeLuma), color, 1.15);\n color = clamp(color, 0.0, 1.0);\n color = mix(color, color * color * (3.0 - 2.0 * color), 0.11);\n color = mix(vec3(dot(color, vec3(0.2126, 0.7152, 0.0722))), color, 1.04);\n\n float vig = 1.0 - smoothstep(0.32, 1.18, length(d * vec2(1.02, 1.10)));\n color *= mix(0.70, 1.0, vig);\n color = toSRGB(color);\n\n float postLuma = dot(color, vec3(0.2126, 0.7152, 0.0722));\n color *= mix(vec3(0.965, 0.985, 1.020), vec3(1.035, 1.000, 0.965), smoothstep(0.30, 0.86, postLuma));\n float grain = hash21(gl_FragCoord.xy * 0.86 + vec2(uTime * 173.1, uTime * 91.7)) - 0.5;\n color += grain * (0.012 + 0.008 * smoothstep(0.2, 0.9, dot(color, vec3(0.333))));\n\n if (uUiMix > 0.0001) {\n vec2 uiUV = (uv - uUiRect.xy) / uUiRect.zw;\n vec3 ui = texture(uUi, clamp(uiUV, vec2(0.0), vec2(1.0))).rgb;\n color = mix(color, ui, smoothstep(0.0, 1.0, uUiMix));\n }\n\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}"},"overlay-vert":{"type":"vertex","src":"#version 300 es\nprecision highp float;\nlayout(location = 0) in vec2 aCorner;\nlayout(location = 1) in vec2 aCenter;\nlayout(location = 2) in vec2 aSize;\nlayout(location = 3) in float aRot;\nlayout(location = 4) in vec4 aUV;\nlayout(location = 5) in vec4 aColor;\nlayout(location = 6) in float aMode;\nlayout(location = 7) in float aAlpha;\nlayout(location = 8) in vec4 aParams;\n\nuniform vec2 uDesign;\nout vec2 vCorner;\nout vec2 vUV;\nout vec2 vSize;\nout vec4 vColor;\nout float vMode;\nout float vAlpha;\nout vec4 vParams;\n\nvoid main() {\n vec2 local = (aCorner - 0.5) * aSize;\n float c = cos(aRot);\n float s = sin(aRot);\n vec2 rot = vec2(local.x * c - local.y * s, local.x * s + local.y * c);\n vec2 screen = aCenter + rot;\n vec2 ndc = vec2(screen.x / uDesign.x * 2.0 - 1.0, 1.0 - screen.y / uDesign.y * 2.0);\n gl_Position = vec4(ndc, 0.0, 1.0);\n vCorner = aCorner;\n vUV = mix(aUV.xy, aUV.zw, aCorner);\n vSize = aSize;\n vColor = aColor;\n vMode = aMode;\n vAlpha = aAlpha;\n vParams = aParams;\n}"},"overlay-frag":{"type":"fragment","src":"#version 300 es\nprecision highp float;\nin vec2 vCorner;\nin vec2 vUV;\nin vec2 vSize;\nin vec4 vColor;\nin float vMode;\nin float vAlpha;\nin vec4 vParams;\nout vec4 fragColor;\n\nuniform sampler2D uMask;\nuniform sampler2D uAtlas;\nuniform sampler2D uScene;\nuniform vec2 uRes;\nuniform float uTime;\nuniform float uSheen;\nuniform float uLanding;\nuniform float uTitleBody;\n\nfloat sdRoundBox(vec2 p, vec2 b, float r) {\n vec2 q = abs(p) - b + r;\n return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;\n}\nfloat hash21(vec2 p) {\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / uRes;\n if (vMode < 0.5) {\n // glass wordmark tile (and, in the landing, a growing glass pane)\n vec2 p = (vCorner - 0.5) * vSize;\n float radius = vParams.x;\n float sd = sdRoundBox(p, vSize * 0.5 - 1.0, radius);\n float shape = 1.0 - smoothstep(-0.85, 0.85, sd);\n if (shape <= 0.001) discard;\n\n vec3 scene = texture(uScene, uv).rgb;\n vec3 refl = pow(1.0 - exp(-max(scene, vec3(0.0)) * 1.15), vec3(0.4545));\n float mask = 0.0;\n if (vParams.z > 0.001) mask = texture(uMask, clamp(vUV, vec2(0.0), vec2(1.0))).r * vParams.z;\n\n float gx = texture(uMask, clamp(vUV + vec2(1.5 / 1920.0, 0.0), vec2(0.0), vec2(1.0))).r\n - texture(uMask, clamp(vUV - vec2(1.5 / 1920.0, 0.0), vec2(0.0), vec2(1.0))).r;\n float gy = texture(uMask, clamp(vUV + vec2(0.0, 1.5 / 1080.0), vec2(0.0), vec2(1.0))).r\n - texture(uMask, clamp(vUV - vec2(0.0, 1.5 / 1080.0), vec2(0.0), vec2(1.0))).r;\n float edgeMask = smoothstep(0.035, 0.20, length(vec2(gx, gy)));\n\n float edgePx = 1.0 - smoothstep(0.0, 2.0, abs(sd));\n float sheen = exp(-pow((uv.x * 0.82 + (1.0 - uv.y) * 0.36 - uSheen) / 0.055, 2.0));\n\n float border = 1.0 - smoothstep(0.15, 0.65, vParams.z);\n vec3 blur = (texture(uScene, clamp(uv + vec2(2.0 / 1920.0, 0.0), vec2(0.0), vec2(1.0))).rgb\n + texture(uScene, clamp(uv - vec2(2.0 / 1920.0, 0.0), vec2(0.0), vec2(1.0))).rgb\n + texture(uScene, clamp(uv + vec2(0.0, 2.0 / 1080.0), vec2(0.0), vec2(1.0))).rgb\n + texture(uScene, clamp(uv - vec2(0.0, 2.0 / 1080.0), vec2(0.0), vec2(1.0))).rgb) * 0.25;\n vec3 skyTint = mix(vec3(0.30, 0.18, 0.50), vec3(1.0, 0.70, 0.36), 1.0 - uv.y);\n vec3 glass = mix(skyTint, mix(refl, blur, 0.45), 0.38);\n float edgeGrad = 0.55 + 0.45 * (1.0 - smoothstep(0.55, 0.95, uv.y));\n glass += vec3(0.82, 0.96, 1.0) * edgePx * border * edgeGrad * (0.58 + vParams.w * 2.2);\n glass += vec3(0.95, 0.99, 1.0) * sheen * 0.28;\n glass *= vColor.rgb;\n\n vec3 titleCol = mix(vec3(1.0, 0.99, 0.97), vec3(1.0, 0.80, 0.50), 1.0 - smoothstep(0.46, 0.62, uv.y));\n titleCol = mix(titleCol, refl * vec3(0.92, 0.98, 1.0), 0.42);\n titleCol += vec3(1.0) * edgeMask * mask * 0.48;\n titleCol += vec3(1.0) * sheen * mask * 0.45;\n float mr = texture(uMask, clamp(vUV + vec2(1.2 / 1920.0, 0.0), vec2(0.0), vec2(1.0))).r;\n float mb = texture(uMask, clamp(vUV - vec2(1.2 / 1920.0, 0.0), vec2(0.0), vec2(1.0))).r;\n titleCol.r += max(0.0, mr - mask) * 0.35;\n titleCol.b += max(0.0, mb - mask) * 0.28;\n\n vec3 col = mix(glass, titleCol, mask);\n float glassA = vColor.a * shape * border * (0.22 + edgePx * edgeGrad * 0.24 + vParams.w * 0.30) * vAlpha;\n float glyphA = mask * shape * vAlpha;\n float alpha = max(glassA, glyphA);\n if (alpha <= 0.001) discard;\n fragColor = vec4(clamp(col, 0.0, 1.0), clamp(alpha, 0.0, 1.0));\n } else if (vMode < 1.5) {\n // ring segment: a thin instanced quad, 1.5 px wide\n vec2 e = min(vCorner, 1.0 - vCorner) * vSize;\n float edge = smoothstep(0.0, 0.9, min(e.x, e.y));\n float a = vColor.a * vAlpha * edge;\n if (a <= 0.001) discard;\n fragColor = vec4(vColor.rgb, a);\n } else if (vMode < 2.5) {\n // tick\n vec2 e = min(vCorner, 1.0 - vCorner) * vSize;\n float edge = smoothstep(0.0, 0.8, min(e.x, e.y));\n float a = vColor.a * vAlpha * edge;\n if (a <= 0.001) discard;\n fragColor = vec4(vColor.rgb, a);\n } else if (vMode < 3.5) {\n // atlas text line\n vec4 t = texture(uAtlas, clamp(vUV, vec2(0.0), vec2(1.0)));\n float a = t.a * vColor.a * vAlpha;\n if (a <= 0.001) discard;\n fragColor = vec4(vColor.rgb, a);\n } else if (vMode < 4.5) {\n // panel outline during the match cut\n vec2 p = (vCorner - 0.5) * vSize;\n vec2 b = vSize * 0.5 - 1.0;\n vec2 q = abs(p) - b;\n float d = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0);\n float line = 1.0 - smoothstep(0.0, 1.4, abs(d));\n float a = line * vColor.a * vAlpha;\n if (a <= 0.001) discard;\n fragColor = vec4(vColor.rgb, a);\n } else if (vMode < 5.5) {\n // soft round mote / landing spark\n vec2 p = (vCorner - 0.5) * vSize;\n float r = length(p) / max(0.5, vSize.x * 0.5);\n float a = exp(-r * r * 5.0) * vColor.a * vAlpha;\n if (a <= 0.001) discard;\n fragColor = vec4(vColor.rgb, a);\n } else {\n // full-screen opaque wordmark body, drawn after the tiles to seal seams\n vec2 muv = vec2(uv.x, 1.0 - uv.y);\n float m0 = texture(uMask, muv).r;\n float m1 = texture(uMask, muv + vec2(1.5 / 1920.0, 0.0)).r;\n float m2 = texture(uMask, muv - vec2(1.5 / 1920.0, 0.0)).r;\n float m3 = texture(uMask, muv + vec2(0.0, 1.5 / 1080.0)).r;\n float m4 = texture(uMask, muv - vec2(0.0, 1.5 / 1080.0)).r;\n float mask = max(max(max(m0, m1), max(m2, m3)), m4);\n if (mask <= 0.004) discard;\n float gx = m1 - m2;\n float gy = m3 - m4;\n float edgeMask = smoothstep(0.035, 0.20, length(vec2(gx, gy)));\n float sheen = exp(-pow((uv.x * 0.82 + (1.0 - uv.y) * 0.36 - uSheen) / 0.055, 2.0));\n vec3 titleCol = mix(vec3(1.0, 0.99, 0.97), vec3(1.0, 0.80, 0.50), 1.0 - smoothstep(0.46, 0.62, uv.y));\n titleCol += vec3(1.0) * edgeMask * 0.14;\n titleCol += vec3(1.0) * sheen * 0.20;\n fragColor = vec4(clamp(titleCol * vColor.rgb, 0.0, 1.0), mask * vAlpha);\n }\n}"}};
|
|
26642
26662
|
|
|
26643
26663
|
function createSplashFilmRuntime(options) {
|
|
@@ -26973,7 +26993,7 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
26973
26993
|
}
|
|
26974
26994
|
add('brand', 'TIANLIGHT', '800 40px "Segoe UI", "Microsoft YaHei UI", sans-serif', 14, 26, 72)
|
|
26975
26995
|
add('credit', '给 DeepSeek Harness 的一片天', '400 27px "Source Han Serif SC Heavy", "Noto Serif SC", "SimSun", serif', 3.2, 26, 152)
|
|
26976
|
-
add('l0', 'TIANLIGHT
|
|
26996
|
+
add('l0', 'TIANLIGHT ' + TL_BUILD_VERSION, '400 12px "Cascadia Mono", Consolas, monospace', 1.8, 26, 220)
|
|
26977
26997
|
add('l1', '06:12', '400 12px "Cascadia Mono", Consolas, monospace', 1.8, 26, 252)
|
|
26978
26998
|
add('l2', 'E 92°', '400 12px "Cascadia Mono", Consolas, monospace', 1.8, 26, 284)
|
|
26979
26999
|
atlas = { canvas: c, entries }
|
|
@@ -27790,7 +27810,12 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
27790
27810
|
if (!AC) return false
|
|
27791
27811
|
audioCtx = new AC()
|
|
27792
27812
|
}
|
|
27793
|
-
|
|
27813
|
+
// resume() rejects with InvalidStateError when the film is disposed (and
|
|
27814
|
+
// closes the context) before the promise settles; that is an expected
|
|
27815
|
+
// teardown race, not an unhandled rejection in the user's console.
|
|
27816
|
+
if (audioCtx.state === 'suspended') {
|
|
27817
|
+
try { void audioCtx.resume().catch(() => {}) } catch (e) {}
|
|
27818
|
+
}
|
|
27794
27819
|
if (soundMaster) { try { soundMaster.disconnect() } catch (e) {} }
|
|
27795
27820
|
const master = audioCtx.createGain()
|
|
27796
27821
|
master.gain.value = 0.55
|
|
@@ -27872,7 +27897,7 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
27872
27897
|
}
|
|
27873
27898
|
|
|
27874
27899
|
function enterSimple(reason) {
|
|
27875
|
-
if (simple) return
|
|
27900
|
+
if (simple || destroyed) return
|
|
27876
27901
|
simple = true
|
|
27877
27902
|
playing = false
|
|
27878
27903
|
if (rAF) cancelAnimationFrame(rAF)
|
|
@@ -27884,36 +27909,48 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
27884
27909
|
const c = film.querySelector('.controls')
|
|
27885
27910
|
if (c) c.style.display = 'none'
|
|
27886
27911
|
simpleVeil.style.opacity = '1'
|
|
27887
|
-
|
|
27888
|
-
|
|
27889
|
-
|
|
27912
|
+
try {
|
|
27913
|
+
simpleMark.animate([{ opacity: 0 }, { opacity: 1, offset: .25 }, { opacity: 1, offset: .7 }, { opacity: 0 }], { duration: 1200, easing: 'cubic-bezier(.22,1,.36,1)', fill: 'both' }).finished.then(() => {
|
|
27914
|
+
simpleVeil.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 500, easing: 'cubic-bezier(.4,0,1,1)', fill: 'forwards' })
|
|
27915
|
+
}).catch(() => {})
|
|
27916
|
+
} catch (e) {
|
|
27917
|
+
// no WAAPI: the wrapper's 1.8s fallback still removes the film
|
|
27918
|
+
}
|
|
27890
27919
|
}
|
|
27891
27920
|
|
|
27892
27921
|
|
|
27893
27922
|
function loop(now) {
|
|
27894
27923
|
if (!playing) return
|
|
27895
|
-
|
|
27896
|
-
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
|
|
27900
|
-
|
|
27901
|
-
|
|
27902
|
-
|
|
27903
|
-
|
|
27904
|
-
|
|
27905
|
-
if (!captureMode && !bench) {
|
|
27906
|
-
measured.push(dt); measuredFrames += 1
|
|
27907
|
-
if (measuredFrames === 30) {
|
|
27908
|
-
const avg = measured.reduce((a, b) => a + b, 0) / measured.length
|
|
27909
|
-
if (!downgraded && renderScale > 0.5 && avg > 20) { renderScale = 0.5; downgraded = true; measured = []; measuredFrames = 0; resize() }
|
|
27910
|
-
else if (renderScale > 0.45 && avg > 16.7) { renderScale = 0.4; downgraded = true; measured = []; measuredFrames = 0; resize() }
|
|
27911
|
-
else if (renderScale <= 0.45 && avg > 33) { enterSimple('performance'); return }
|
|
27912
|
-
else { measured = []; measuredFrames = 0 }
|
|
27924
|
+
try {
|
|
27925
|
+
const t = skipStart ? Math.min(DURATION, 16650 + (now - skipStart) * 2.4) : Math.min(DURATION, now - startAt)
|
|
27926
|
+
currentT = t
|
|
27927
|
+
const dt = lastFrame ? now - lastFrame : 16.7
|
|
27928
|
+
lastFrame = now
|
|
27929
|
+
renderFrame(t, false)
|
|
27930
|
+
updateDOM(t)
|
|
27931
|
+
if (bench && benchData && !benchData.done) {
|
|
27932
|
+
const ch = benchData.chapters[chapterAt(t)]
|
|
27933
|
+
if (ch) { ch.frames += 1; ch.total += dt; ch.render += frame.renderMs; ch.max = Math.max(ch.max, dt) }
|
|
27913
27934
|
}
|
|
27935
|
+
if (!captureMode && !bench) {
|
|
27936
|
+
measured.push(dt); measuredFrames += 1
|
|
27937
|
+
if (measuredFrames === 30) {
|
|
27938
|
+
const avg = measured.reduce((a, b) => a + b, 0) / measured.length
|
|
27939
|
+
if (!downgraded && renderScale > 0.5 && avg > 20) { renderScale = 0.5; downgraded = true; measured = []; measuredFrames = 0; resize() }
|
|
27940
|
+
else if (renderScale > 0.45 && avg > 16.7) { renderScale = 0.4; downgraded = true; measured = []; measuredFrames = 0; resize() }
|
|
27941
|
+
else if (renderScale <= 0.45 && avg > 80 && t > 4000) { enterSimple('performance'); return }
|
|
27942
|
+
else { measured = []; measuredFrames = 0 }
|
|
27943
|
+
}
|
|
27944
|
+
}
|
|
27945
|
+
if (t >= DURATION) { if (bench && benchData) benchData.done = true; finish(); return }
|
|
27946
|
+
rAF = requestAnimationFrame(loop)
|
|
27947
|
+
} catch (error) {
|
|
27948
|
+
// A frame error must not silently stop the only rAF chain: without a
|
|
27949
|
+
// next frame the opaque overlay would sit there until the 23.5s stop.
|
|
27950
|
+
try { film.dataset.error = String(error && error.stack || error) } catch (e) {}
|
|
27951
|
+
try { console.error('[film-v3] frame failed', error) } catch (e) {}
|
|
27952
|
+
enterSimple('render-error')
|
|
27914
27953
|
}
|
|
27915
|
-
if (t >= DURATION) { if (bench && benchData) benchData.done = true; finish(); return }
|
|
27916
|
-
rAF = requestAnimationFrame(loop)
|
|
27917
27954
|
}
|
|
27918
27955
|
|
|
27919
27956
|
function startPlayback() {
|
|
@@ -27976,6 +28013,17 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
27976
28013
|
bootTiming.assets2 = performance.now() - t0
|
|
27977
28014
|
canvas.style.opacity = '0'
|
|
27978
28015
|
if (!initGL()) { enterSimple('no-webgl2'); return }
|
|
28016
|
+
// A lost context cannot be rendered again in this overlay. Fall back to
|
|
28017
|
+
// the 1.7s simple mark instead of showing a black canvas until 23.5s.
|
|
28018
|
+
const onContextLost = () => {
|
|
28019
|
+
if (destroyed || simple) return
|
|
28020
|
+
try { film.dataset.reason = 'context-lost' } catch (e) {}
|
|
28021
|
+
enterSimple('context-lost')
|
|
28022
|
+
}
|
|
28023
|
+
canvas.addEventListener('webglcontextlost', onContextLost, false)
|
|
28024
|
+
cleanups.push(() => {
|
|
28025
|
+
try { canvas.removeEventListener('webglcontextlost', onContextLost, false) } catch (e) {}
|
|
28026
|
+
})
|
|
27979
28027
|
bootTiming.gl = performance.now() - t0
|
|
27980
28028
|
film.dataset.stage = 'warm'
|
|
27981
28029
|
canvas.classList.add('on')
|
|
@@ -28038,7 +28086,16 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
28038
28086
|
const onKeyDown = (e) => { if (e.key === 'Escape') { e.preventDefault(); finish() } }
|
|
28039
28087
|
document.addEventListener('keydown', onKeyDown, { capture: true })
|
|
28040
28088
|
cleanups.push(() => document.removeEventListener('keydown', onKeyDown, { capture: true }))
|
|
28041
|
-
const onResize = () => {
|
|
28089
|
+
const onResize = () => {
|
|
28090
|
+
if (gl && !destroyed) {
|
|
28091
|
+
try {
|
|
28092
|
+
resize()
|
|
28093
|
+
if (fixedTime !== null) renderSplash(currentT)
|
|
28094
|
+
} catch (e) {
|
|
28095
|
+
enterSimple('resize-error')
|
|
28096
|
+
}
|
|
28097
|
+
}
|
|
28098
|
+
}
|
|
28042
28099
|
addEventListener('resize', onResize)
|
|
28043
28100
|
cleanups.push(() => removeEventListener('resize', onResize))
|
|
28044
28101
|
textures.uiImage = (() => { const c = document.createElement('canvas'); c.width = 1; c.height = 1; return c })()
|
|
@@ -28104,6 +28161,12 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
28104
28161
|
host.setAttribute("data-state", "loading");
|
|
28105
28162
|
host.setAttribute("aria-hidden", "true");
|
|
28106
28163
|
host.innerHTML = SPLASH_FILM_DOM;
|
|
28164
|
+
try {
|
|
28165
|
+
const buildLabel = host.querySelector(".tc-l0");
|
|
28166
|
+
if (buildLabel !== null) buildLabel.textContent = "TIANLIGHT " + TL_BUILD_VERSION;
|
|
28167
|
+
} catch {
|
|
28168
|
+
// a stripped DOM cannot print the build label; the film still runs
|
|
28169
|
+
}
|
|
28107
28170
|
const style = document.createElement("style");
|
|
28108
28171
|
style.setAttribute("data-tl-splash-film-style", "");
|
|
28109
28172
|
style.textContent = SPLASH_FILM_CSS;
|
|
@@ -28118,18 +28181,130 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
28118
28181
|
}
|
|
28119
28182
|
const skipHint = host.querySelector("#skipHint");
|
|
28120
28183
|
if (skipHint && typeof opts.skipText === "string" && opts.skipText !== "") skipHint.textContent = opts.skipText;
|
|
28121
|
-
// The film is opaque:
|
|
28122
|
-
//
|
|
28123
|
-
|
|
28124
|
-
|
|
28125
|
-
|
|
28126
|
-
|
|
28127
|
-
|
|
28128
|
-
|
|
28184
|
+
// The film is opaque: hide the wallpaper and hold its video paused so the
|
|
28185
|
+
// 4K decoder does not compete with the shader. The wallpaper module installs
|
|
28186
|
+
// *after* the splash (scene and video do not exist yet at this point), and it
|
|
28187
|
+
// can start/retry playback later, so watch for the scene to appear and hold
|
|
28188
|
+
// every `play` while the film is active. On exit resume only the videos the
|
|
28189
|
+
// wallpaper actually asked to play; a user-paused wallpaper stays paused.
|
|
28190
|
+
let scene = document.querySelector("[data-tl-scene]");
|
|
28191
|
+
let sceneVisibility = scene ? scene.style.visibility : "";
|
|
28192
|
+
let sceneHidden = false;
|
|
28193
|
+
const heldVideos = [];
|
|
28194
|
+
const holdSceneVideo = (event) => {
|
|
28195
|
+
const video = event !== null && event !== undefined ? event.currentTarget : null;
|
|
28196
|
+
const entry = heldVideos.find((candidate) => candidate.video === video);
|
|
28197
|
+
if (entry === null || entry === undefined) return;
|
|
28198
|
+
entry.pausedByFilm = true;
|
|
28199
|
+
try {
|
|
28200
|
+
if (video.paused === false) video.pause();
|
|
28201
|
+
} catch {
|
|
28202
|
+
// a detached video freezes by itself
|
|
28203
|
+
}
|
|
28204
|
+
};
|
|
28205
|
+
const holdVideo = (video) => {
|
|
28206
|
+
if (heldVideos.some((candidate) => candidate.video === video)) return;
|
|
28207
|
+
const entry = { video, pausedByFilm: false };
|
|
28208
|
+
heldVideos.push(entry);
|
|
28209
|
+
try {
|
|
28210
|
+
if (video.paused === false) {
|
|
28211
|
+
entry.pausedByFilm = true;
|
|
28212
|
+
video.pause();
|
|
28213
|
+
}
|
|
28214
|
+
video.addEventListener("play", holdSceneVideo);
|
|
28215
|
+
} catch {
|
|
28216
|
+
// a video without listeners simply keeps its old behaviour
|
|
28217
|
+
}
|
|
28218
|
+
};
|
|
28219
|
+
const hideScene = (found) => {
|
|
28220
|
+
scene = found;
|
|
28221
|
+
if (sceneObserver !== null) {
|
|
28222
|
+
try {
|
|
28223
|
+
sceneObserver.disconnect();
|
|
28224
|
+
} catch {
|
|
28225
|
+
// ignore
|
|
28226
|
+
}
|
|
28227
|
+
sceneObserver = null;
|
|
28228
|
+
}
|
|
28229
|
+
if (sceneWatch !== 0) {
|
|
28230
|
+
try {
|
|
28231
|
+
globalThis.clearInterval(sceneWatch);
|
|
28232
|
+
} catch {
|
|
28233
|
+
// ignore
|
|
28234
|
+
}
|
|
28235
|
+
sceneWatch = 0;
|
|
28236
|
+
}
|
|
28237
|
+
sceneVisibility = found.style.visibility;
|
|
28238
|
+
try {
|
|
28239
|
+
found.style.visibility = "hidden";
|
|
28240
|
+
sceneHidden = true;
|
|
28241
|
+
} catch {
|
|
28242
|
+
// a stripped scene still gets the video hold below
|
|
28243
|
+
}
|
|
28244
|
+
for (const video of found.querySelectorAll("video")) holdVideo(video);
|
|
28245
|
+
};
|
|
28246
|
+
let sceneObserver = null;
|
|
28247
|
+
let sceneWatch = 0;
|
|
28248
|
+
if (scene !== null) {
|
|
28249
|
+
hideScene(scene);
|
|
28250
|
+
} else if (typeof MutationObserver === "function") {
|
|
28251
|
+
sceneObserver = new MutationObserver(() => {
|
|
28252
|
+
if (scene !== null) return;
|
|
28253
|
+
const found = document.querySelector("[data-tl-scene]");
|
|
28254
|
+
if (found !== null) hideScene(found);
|
|
28255
|
+
});
|
|
28256
|
+
try {
|
|
28257
|
+
sceneObserver.observe(document.body, { childList: true });
|
|
28258
|
+
} catch {
|
|
28259
|
+
sceneObserver = null;
|
|
28260
|
+
}
|
|
28261
|
+
}
|
|
28262
|
+
if (scene === null && sceneObserver === null && typeof globalThis.setInterval === "function") {
|
|
28263
|
+
sceneWatch = globalThis.setInterval(() => {
|
|
28264
|
+
if (scene !== null) return;
|
|
28265
|
+
const found = document.querySelector("[data-tl-scene]");
|
|
28266
|
+
if (found !== null) hideScene(found);
|
|
28267
|
+
}, 250);
|
|
28268
|
+
}
|
|
28129
28269
|
const restoreScene = () => {
|
|
28130
|
-
if (
|
|
28131
|
-
|
|
28132
|
-
|
|
28270
|
+
if (sceneObserver !== null) {
|
|
28271
|
+
try {
|
|
28272
|
+
sceneObserver.disconnect();
|
|
28273
|
+
} catch {
|
|
28274
|
+
// ignore
|
|
28275
|
+
}
|
|
28276
|
+
sceneObserver = null;
|
|
28277
|
+
}
|
|
28278
|
+
if (sceneWatch !== 0) {
|
|
28279
|
+
try {
|
|
28280
|
+
globalThis.clearInterval(sceneWatch);
|
|
28281
|
+
} catch {
|
|
28282
|
+
// ignore
|
|
28283
|
+
}
|
|
28284
|
+
sceneWatch = 0;
|
|
28285
|
+
}
|
|
28286
|
+
if (scene !== null && sceneHidden === true) {
|
|
28287
|
+
try {
|
|
28288
|
+
scene.style.visibility = sceneVisibility;
|
|
28289
|
+
} catch {
|
|
28290
|
+
// ignore
|
|
28291
|
+
}
|
|
28292
|
+
sceneHidden = false;
|
|
28293
|
+
}
|
|
28294
|
+
for (const entry of heldVideos) {
|
|
28295
|
+
try {
|
|
28296
|
+
entry.video.removeEventListener("play", holdSceneVideo);
|
|
28297
|
+
} catch {
|
|
28298
|
+
// ignore
|
|
28299
|
+
}
|
|
28300
|
+
if (entry.pausedByFilm === true && entry.video.paused === true) {
|
|
28301
|
+
try {
|
|
28302
|
+
void entry.video.play().catch(() => {});
|
|
28303
|
+
} catch {
|
|
28304
|
+
// autoplay refusal is reported by the wallpaper controller
|
|
28305
|
+
}
|
|
28306
|
+
}
|
|
28307
|
+
entry.pausedByFilm = false;
|
|
28133
28308
|
}
|
|
28134
28309
|
};
|
|
28135
28310
|
// Hide the whole DSH tree while the opaque film is playing; the app still
|
|
@@ -28147,11 +28322,27 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
28147
28322
|
document.body.appendChild(host);
|
|
28148
28323
|
let disposed = false;
|
|
28149
28324
|
let hardTimer = 0;
|
|
28325
|
+
let fallbackTimer = 0;
|
|
28150
28326
|
let api = null;
|
|
28327
|
+
/** Only errors thrown *by this skin's bundle* end the film early; a DSH
|
|
28328
|
+
* rejection or an unrelated extension error must not cut the opening. */
|
|
28329
|
+
const onPageError = (event) => {
|
|
28330
|
+
if (disposed) return;
|
|
28331
|
+
const source = String(event !== null && event !== undefined ? event.filename ?? "" : "");
|
|
28332
|
+
if (source.indexOf(PLUGIN_ID) < 0) return;
|
|
28333
|
+
finishOnce("error");
|
|
28334
|
+
};
|
|
28335
|
+
try {
|
|
28336
|
+
globalThis.addEventListener?.("error", onPageError);
|
|
28337
|
+
} catch {
|
|
28338
|
+
// no window guard: the hard stop below still owns the exit
|
|
28339
|
+
}
|
|
28151
28340
|
const finishOnce = (reason) => {
|
|
28152
28341
|
if (disposed) return;
|
|
28153
28342
|
disposed = true;
|
|
28154
28343
|
if (hardTimer) clearTimeout(hardTimer);
|
|
28344
|
+
if (fallbackTimer) clearTimeout(fallbackTimer);
|
|
28345
|
+
try { globalThis.removeEventListener?.("error", onPageError); } catch {}
|
|
28155
28346
|
try { if (api) api.dispose(); else if (host.parentNode) host.parentNode.removeChild(host); } catch {}
|
|
28156
28347
|
try { restoreScene(); } catch {}
|
|
28157
28348
|
try { restoreRoot(); } catch {}
|
|
@@ -28164,7 +28355,11 @@ body[data-dsh-tianlight][data-tl-legibility="boost"] [data-tl-font-panel] {
|
|
|
28164
28355
|
onDone: () => finishOnce("done"),
|
|
28165
28356
|
onFallback: (reason) => {
|
|
28166
28357
|
if (typeof opts.onFallback === "function") opts.onFallback(reason || "fallback");
|
|
28167
|
-
|
|
28358
|
+
if (disposed || fallbackTimer !== 0) return;
|
|
28359
|
+
fallbackTimer = setTimeout(() => {
|
|
28360
|
+
fallbackTimer = 0;
|
|
28361
|
+
finishOnce("fallback");
|
|
28362
|
+
}, 1800);
|
|
28168
28363
|
},
|
|
28169
28364
|
});
|
|
28170
28365
|
} catch (error) {
|
package/lib/index.js
CHANGED
|
@@ -74,7 +74,7 @@ const HOST_API = '2'
|
|
|
74
74
|
* manifest is stamped with it. The handshake no longer compares it, so a
|
|
75
75
|
* browser-half-only update can run against an unchanged host process.
|
|
76
76
|
*/
|
|
77
|
-
const BUILD = '2.1.
|
|
77
|
+
const BUILD = '2.1.4'
|
|
78
78
|
|
|
79
79
|
function readRoots() {
|
|
80
80
|
try {
|
|
@@ -475,8 +475,9 @@ function handle(ctx, req, res) {
|
|
|
475
475
|
}
|
|
476
476
|
if (rest === '_weather') {
|
|
477
477
|
// v2.0.5: transport shim for networks where the renderer's TLS handshake to
|
|
478
|
-
// Open-Meteo is dropped. Read-only, no state, no caching.
|
|
479
|
-
|
|
478
|
+
// Open-Meteo is dropped. Read-only, no state, no caching. GET only: a HEAD has
|
|
479
|
+
// no body to return but would still spend an outbound request.
|
|
480
|
+
if (req.method !== 'GET') {
|
|
480
481
|
sendText(res, 405, 'method not allowed')
|
|
481
482
|
return
|
|
482
483
|
}
|
package/lib/weather-proxy.js
CHANGED
|
@@ -11,10 +11,14 @@
|
|
|
11
11
|
// /skin-tianlight/_weather?latitude=..&longitude=..
|
|
12
12
|
// 200 { ok: true, transport: "https" | "http", payload: <open-meteo json> }
|
|
13
13
|
// 400 { ok: false, error: "invalid" } missing / out-of-range coordinates
|
|
14
|
+
// 429 { ok: false, error: "busy" } two upstream requests already in flight
|
|
14
15
|
// 502 { ok: false, error: "network" | "timeout" }
|
|
15
16
|
//
|
|
16
17
|
// Only the two coordinates leave the machine. Nothing is cached, logged or written:
|
|
17
|
-
// the route is a transport shim, not a second weather model.
|
|
18
|
+
// the route is a transport shim, not a second weather model. The upstream host is a
|
|
19
|
+
// constant (no caller-supplied URL), the path is built from validated numbers, and
|
|
20
|
+
// every request has a hard wall-clock deadline plus a response-size cap — so this
|
|
21
|
+
// cannot be turned into an open proxy.
|
|
18
22
|
import http from 'node:http'
|
|
19
23
|
import https from 'node:https'
|
|
20
24
|
import { sendJson } from './http-media.js'
|
|
@@ -34,21 +38,47 @@ const TRANSPORT_TIMEOUT_MS = { https: 2500, http: 8000 }
|
|
|
34
38
|
let preferredTransport = null
|
|
35
39
|
/** The current-conditions payload is ~600 bytes; anything near this is not weather. */
|
|
36
40
|
const MAX_BYTES = 64 * 1024
|
|
41
|
+
/**
|
|
42
|
+
* One desktop page polls at most every few minutes, so two concurrent requests is
|
|
43
|
+
* already generous (a second window, a retry after Ctrl+F5). The cap keeps a buggy or
|
|
44
|
+
* hostile same-origin page from opening an unbounded number of outbound sockets.
|
|
45
|
+
*/
|
|
46
|
+
const MAX_INFLIGHT = 2
|
|
47
|
+
let inflight = 0
|
|
37
48
|
|
|
38
|
-
/** Trimmed, range-checked coordinate string, or null. */
|
|
49
|
+
/** Trimmed, length/range-checked coordinate string, or null. */
|
|
39
50
|
function coordinate(value, limit) {
|
|
40
|
-
if (typeof value !== 'string'
|
|
41
|
-
const
|
|
51
|
+
if (typeof value !== 'string') return null
|
|
52
|
+
const trimmed = value.trim()
|
|
53
|
+
// A coordinate is never long; the cap also keeps Number() away from huge inputs.
|
|
54
|
+
if (trimmed === '' || trimmed.length > 32) return null
|
|
55
|
+
const number = Number(trimmed)
|
|
42
56
|
if (Number.isFinite(number) === false || Math.abs(number) > limit) return null
|
|
43
57
|
return String(Math.round(number * 10000) / 10000)
|
|
44
58
|
}
|
|
45
59
|
|
|
60
|
+
/** The only URL this route can request; coordinates are already validated. */
|
|
61
|
+
function forecastPath(latitude, longitude) {
|
|
62
|
+
return (
|
|
63
|
+
FORECAST_PATH +
|
|
64
|
+
'?latitude=' +
|
|
65
|
+
encodeURIComponent(latitude) +
|
|
66
|
+
'&longitude=' +
|
|
67
|
+
encodeURIComponent(longitude) +
|
|
68
|
+
'¤t=' +
|
|
69
|
+
encodeURIComponent(CURRENT_FIELDS) +
|
|
70
|
+
'&timezone=auto'
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
46
74
|
/** One GET, resolved with the parsed JSON body. Errors carry a `code` for the caller. */
|
|
47
|
-
function requestJson(transport, path, timeoutMs) {
|
|
75
|
+
function requestJson(transport, path, timeoutMs, requestImpl) {
|
|
48
76
|
return new Promise((resolve, reject) => {
|
|
49
77
|
const secure = transport === 'https'
|
|
78
|
+
const send = typeof requestImpl === 'function' ? requestImpl : (secure ? https : http).request
|
|
50
79
|
let settled = false
|
|
51
80
|
let deadline = null
|
|
81
|
+
let request = null
|
|
52
82
|
const finish = (error, value) => {
|
|
53
83
|
if (settled) return
|
|
54
84
|
settled = true
|
|
@@ -56,45 +86,59 @@ function requestJson(transport, path, timeoutMs) {
|
|
|
56
86
|
if (error === null) resolve(value)
|
|
57
87
|
else reject(error)
|
|
58
88
|
}
|
|
59
|
-
const
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
finish(Object.assign(new Error(`upstream status ${response.statusCode}`), { code: 'status' }))
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
const chunks = []
|
|
74
|
-
let size = 0
|
|
75
|
-
response.on('data', (chunk) => {
|
|
76
|
-
size += chunk.length
|
|
77
|
-
if (size > MAX_BYTES) {
|
|
78
|
-
request.destroy()
|
|
79
|
-
finish(Object.assign(new Error('upstream payload too large'), { code: 'oversize' }))
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
chunks.push(chunk)
|
|
83
|
-
})
|
|
84
|
-
response.on('end', () => {
|
|
89
|
+
const onResponse = (response) => {
|
|
90
|
+
if (response.statusCode !== 200) {
|
|
91
|
+
response.resume()
|
|
92
|
+
finish(Object.assign(new Error(`upstream status ${response.statusCode}`), { code: 'status' }))
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
const chunks = []
|
|
96
|
+
let size = 0
|
|
97
|
+
response.on('data', (chunk) => {
|
|
98
|
+
size += chunk.length
|
|
99
|
+
if (size > MAX_BYTES) {
|
|
85
100
|
try {
|
|
86
|
-
|
|
101
|
+
if (request !== null) request.destroy()
|
|
87
102
|
} catch {
|
|
88
|
-
|
|
103
|
+
// already gone
|
|
89
104
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
105
|
+
finish(Object.assign(new Error('upstream payload too large'), { code: 'oversize' }))
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
chunks.push(chunk)
|
|
109
|
+
})
|
|
110
|
+
response.on('end', () => {
|
|
111
|
+
try {
|
|
112
|
+
finish(null, JSON.parse(Buffer.concat(chunks).toString('utf8')))
|
|
113
|
+
} catch {
|
|
114
|
+
finish(Object.assign(new Error('upstream payload is not json'), { code: 'json' }))
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
response.on('error', (error) => finish(error))
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
request = send(
|
|
121
|
+
{
|
|
122
|
+
host: FORECAST_HOST,
|
|
123
|
+
port: secure ? 443 : 80,
|
|
124
|
+
path,
|
|
125
|
+
method: 'GET',
|
|
126
|
+
headers: { accept: 'application/json', 'user-agent': 'tianlight-weather/2.0.5' },
|
|
127
|
+
},
|
|
128
|
+
onResponse,
|
|
129
|
+
)
|
|
130
|
+
} catch (error) {
|
|
131
|
+
finish(error)
|
|
132
|
+
return
|
|
133
|
+
}
|
|
94
134
|
// A hard wall-clock deadline: `request.setTimeout` only covers socket inactivity,
|
|
95
135
|
// and a handshake that stalls after connect can sit well past the budget.
|
|
96
136
|
deadline = setTimeout(() => {
|
|
97
|
-
|
|
137
|
+
try {
|
|
138
|
+
request.destroy()
|
|
139
|
+
} catch {
|
|
140
|
+
// already gone
|
|
141
|
+
}
|
|
98
142
|
finish(Object.assign(new Error('upstream timeout'), { code: 'timeout' }))
|
|
99
143
|
}, timeoutMs)
|
|
100
144
|
request.on('error', (error) => finish(error))
|
|
@@ -103,38 +147,57 @@ function requestJson(transport, path, timeoutMs) {
|
|
|
103
147
|
}
|
|
104
148
|
|
|
105
149
|
/** GET /skin-tianlight/_weather — HTTPS first, then the same host over plain HTTP. */
|
|
106
|
-
export async function handleWeatherProxy(url, res) {
|
|
150
|
+
export async function handleWeatherProxy(url, res, deps) {
|
|
107
151
|
const latitude = coordinate(url.searchParams.get('latitude'), 90)
|
|
108
152
|
const longitude = coordinate(url.searchParams.get('longitude'), 180)
|
|
109
153
|
if (latitude === null || longitude === null) {
|
|
110
154
|
sendJson(res, 400, { ok: false, error: 'invalid' })
|
|
111
155
|
return
|
|
112
156
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
'¤t=' +
|
|
120
|
-
encodeURIComponent(CURRENT_FIELDS) +
|
|
121
|
-
'&timezone=auto'
|
|
157
|
+
if (inflight >= MAX_INFLIGHT) {
|
|
158
|
+
sendJson(res, 429, { ok: false, error: 'busy' })
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
const request = deps !== null && typeof deps === 'object' && typeof deps.requestJson === 'function' ? deps.requestJson : requestJson
|
|
162
|
+
const path = forecastPath(latitude, longitude)
|
|
122
163
|
let timedOut = false
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
164
|
+
inflight += 1
|
|
165
|
+
try {
|
|
166
|
+
// Remember whichever transport actually worked on this machine: on the networks
|
|
167
|
+
// this route exists for, HTTPS never completes, so paying its budget on every
|
|
168
|
+
// poll would keep the card stale for seconds each time. The other transport is
|
|
169
|
+
// always kept as a fallback, so a recovery is picked up again.
|
|
170
|
+
const order = preferredTransport === 'http' ? ['http', 'https'] : ['https', 'http']
|
|
171
|
+
for (const transport of order) {
|
|
172
|
+
try {
|
|
173
|
+
const payload = await request(transport, path, TRANSPORT_TIMEOUT_MS[transport])
|
|
174
|
+
if (payload === null || typeof payload !== 'object') continue
|
|
175
|
+
preferredTransport = transport
|
|
176
|
+
sendJson(res, 200, { ok: true, transport, payload })
|
|
177
|
+
return
|
|
178
|
+
} catch (error) {
|
|
179
|
+
if (error !== null && error !== undefined && error.code === 'timeout') timedOut = true
|
|
180
|
+
}
|
|
137
181
|
}
|
|
182
|
+
sendJson(res, 502, { ok: false, error: timedOut ? 'timeout' : 'network' })
|
|
183
|
+
} finally {
|
|
184
|
+
inflight -= 1
|
|
138
185
|
}
|
|
139
|
-
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Test surface: no runtime behaviour depends on these exports. */
|
|
189
|
+
export const __test = {
|
|
190
|
+
FORECAST_HOST,
|
|
191
|
+
FORECAST_PATH,
|
|
192
|
+
TRANSPORT_TIMEOUT_MS,
|
|
193
|
+
MAX_BYTES,
|
|
194
|
+
MAX_INFLIGHT,
|
|
195
|
+
coordinate,
|
|
196
|
+
forecastPath,
|
|
197
|
+
requestJson,
|
|
198
|
+
resetInflight: () => {
|
|
199
|
+
inflight = 0
|
|
200
|
+
preferredTransport = null
|
|
201
|
+
},
|
|
202
|
+
inflight: () => inflight,
|
|
140
203
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-client-ui-skin-tianlight",
|
|
3
|
-
"description": "Tianlight skin for the dsh web GUI: Makoto Shinkai daylight skies, an 18.5s cinematic opening film / compact splash with
|
|
4
|
-
"version": "2.1.
|
|
3
|
+
"description": "Tianlight skin for the dsh web GUI: Makoto Shinkai daylight skies, an 18.5s cinematic opening film / compact splash with a 0.4x low-end tier, delayed performance fallback, optional reduced-motion override and explicit hint/Esc skip, a looping video wallpaper, a wallpaper library with upload/rotation, optional WebWallGL scene support, and a draggable Mint chibi-cat desktop companion",
|
|
4
|
+
"version": "2.1.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"bin": {
|
package/skin.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"id": "tianlight",
|
|
3
3
|
"name": "天光",
|
|
4
4
|
"nameEn": "TIANLIGHT",
|
|
5
|
-
"version": "2.1.
|
|
5
|
+
"version": "2.1.4",
|
|
6
6
|
"author": "local",
|
|
7
7
|
"tagline": "新海诚式天光 ・ 18.5 秒长片开机动画/简洁版(可选减少动态效果覆盖;仅提示/Esc 跳过) ・ 动态壁纸与可上传壁纸库 ・ 可选 WebWallGL 场景 ・ 薄荷小猫桌宠 ・ 职责通道(role pack → 桌宠气泡/选择) ・ 生活节奏与主动开口预算 ・ 可替换图片/≤32MiB 视频形象 ・ 液态玻璃三档 ・ AI 桌宠(严格权限) ・ 接入 DSH Agent(受控) ・ 桌宠即入口 ・ 兼容 DSH 0.2.0–0.2.2",
|
|
8
|
-
"description": "
|
|
8
|
+
"description": "天光是一套新海诚式日光天空主题:全屏循环视频壁纸与半透明天光玻璃面板,可选 18.5 秒长片或简洁版开机动画。壁纸库支持上传、轮播、标签与画面滤镜,并可接入 Wallpaper Engine 场景;桌宠「薄荷小猫」会陪你看时间、记事情、聊两句,角色中枢集中管理外观、生活节奏与权限。同一份构建适配 DSH 0.2.0 / 0.2.1 / 0.2.2。",
|
|
9
9
|
"tags": [
|
|
10
10
|
"shinkai",
|
|
11
11
|
"sky",
|