dsh-client-ui-skin-tianlight 2.1.3 → 2.1.5

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 CHANGED
@@ -783,7 +783,7 @@ node tools/release.mjs --dry-run --version 2.0.1-rc.2 --note "…"
783
783
  - **第三方**:v0.6.0 内嵌 dsh-we-wallpaper host half(MIT,v0.4.0 @ `61ccaa2`)、wcap(Unlicense)、
784
784
  RePKG(MIT,DXT 解码实现依据)、WebWallGL(MIT);组件、版本、归属与许可全文见
785
785
  [docs/THIRD-PARTY.md](docs/THIRD-PARTY.md)
786
- - **仓库完整版附带默认演示素材**:`assets/bg-4k.mp4`、`assets/cat.png`(约 34MB);`assets/uploads/`、`state/`、`assets/derived/`(旧版用户数据位置)与其它自加素材不提交;v2.0.1 起用户数据在 DSH profile 目录,根本不在仓库里。替换或再分发前请确认你有使用权,缺失时以渐变兜底
786
+ - **仓库完整版附带默认演示素材**:`assets/bg-4k.mp4`、`assets/cat.png`(约 17MB);`assets/uploads/`、`state/`、`assets/derived/`(旧版用户数据位置)与其它自加素材不提交;v2.0.1 起用户数据在 DSH profile 目录,根本不在仓库里。替换或再分发前请确认你有使用权,缺失时以渐变兜底
787
787
  - 桌宠形象与视频版权归各自权利方;如果只想要轻量代码仓库,删除这两个文件即可
788
788
 
789
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.3",
5
- "commit": "e122904d2817a140d3e521bae7913ed0babcb636",
6
- "builtAt": "2026-11-15T09:13:13+08:00",
4
+ "version": "2.1.5",
5
+ "commit": "5d719786a7fa8cbc483f424bd505d19e90dcce79",
6
+ "builtAt": "2026-11-15T13:50:27+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.5";
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&nbsp;Harness 的一片天</div>\n <div class=\"tc-l0\">TIANLIGHT 2.0.4</div>\n <div class=\"tc-l1\">06:12</div>\n <div class=\"tc-l2\">E 92°</div>\n </div>";
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&nbsp;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 2.0.4', '400 12px "Cascadia Mono", Consolas, monospace', 1.8, 26, 220)
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
- if (audioCtx.state === 'suspended') audioCtx.resume()
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
- 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(() => {
27888
- simpleVeil.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 500, easing: 'cubic-bezier(.4,0,1,1)', fill: 'forwards' })
27889
- }).catch(() => {})
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
- const t = skipStart ? Math.min(DURATION, 16650 + (now - skipStart) * 2.4) : Math.min(DURATION, now - startAt)
27896
- currentT = t
27897
- const dt = lastFrame ? now - lastFrame : 16.7
27898
- lastFrame = now
27899
- renderFrame(t, false)
27900
- updateDOM(t)
27901
- if (bench && benchData && !benchData.done) {
27902
- const ch = benchData.chapters[chapterAt(t)]
27903
- if (ch) { ch.frames += 1; ch.total += dt; ch.render += frame.renderMs; ch.max = Math.max(ch.max, dt) }
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 > 80 && t > 4000) { 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 = () => { if (gl && !destroyed) { resize(); if (fixedTime !== null) renderSplash(currentT) } }
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: pause/hide the wallpaper video behind it to free the
28122
- // GPU for the shader. Restore the exact prior state on every exit path.
28123
- const scene = document.querySelector("[data-tl-scene]");
28124
- const sceneVisibility = scene ? scene.style.visibility : "";
28125
- const sceneVideos = scene ? [...scene.querySelectorAll("video")] : [];
28126
- const scenePlaying = sceneVideos.map((video) => !video.paused);
28127
- if (scene) scene.style.visibility = "hidden";
28128
- for (const video of sceneVideos) { try { video.pause(); } catch {} }
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 (scene) scene.style.visibility = sceneVisibility;
28131
- for (let i = 0; i < sceneVideos.length; i += 1) {
28132
- if (scenePlaying[i]) { try { void sceneVideos[i].play().catch(() => {}); } catch {} }
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
- setTimeout(() => finishOnce("fallback"), 1800);
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.3'
77
+ const BUILD = '2.1.5'
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
- if (req.method !== 'GET' && req.method !== 'HEAD') {
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
  }
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 dsh-we-wallpaper contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-we-wallpaper contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -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' || value.trim() === '') return null
41
- const number = Number(value)
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
+ '&current=' +
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 request = (secure ? https : http).request(
60
- {
61
- host: FORECAST_HOST,
62
- port: secure ? 443 : 80,
63
- path,
64
- method: 'GET',
65
- headers: { accept: 'application/json', 'user-agent': 'tianlight-weather/2.0.5' },
66
- },
67
- (response) => {
68
- if (response.statusCode !== 200) {
69
- response.resume()
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
- finish(null, JSON.parse(Buffer.concat(chunks).toString('utf8')))
101
+ if (request !== null) request.destroy()
87
102
  } catch {
88
- finish(Object.assign(new Error('upstream payload is not json'), { code: 'json' }))
103
+ // already gone
89
104
  }
90
- })
91
- response.on('error', (error) => finish(error))
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
- request.destroy()
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
- const path =
114
- FORECAST_PATH +
115
- '?latitude=' +
116
- encodeURIComponent(latitude) +
117
- '&longitude=' +
118
- encodeURIComponent(longitude) +
119
- '&current=' +
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
- // Remember whichever transport actually worked on this machine: on the networks
124
- // this route exists for, HTTPS never completes, so paying its budget on every
125
- // poll would keep the card stale for seconds each time. The other transport is
126
- // always kept as a fallback, so a recovery is picked up again.
127
- const order = preferredTransport === 'http' ? ['http', 'https'] : ['https', 'http']
128
- for (const transport of order) {
129
- try {
130
- const payload = await requestJson(transport, path, TRANSPORT_TIMEOUT_MS[transport])
131
- if (payload === null || typeof payload !== 'object') continue
132
- preferredTransport = transport
133
- sendJson(res, 200, { ok: true, transport, payload })
134
- return
135
- } catch (error) {
136
- if (error !== null && error !== undefined && error.code === 'timeout') timedOut = true
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
- sendJson(res, 502, { ok: false, error: timedOut ? 'timeout' : 'network' })
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
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.3",
4
+ "version": "2.1.5",
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.3",
5
+ "version": "2.1.5",
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": "v2.1.0:18.5 秒电影片头级长片开机动画(四档、默认每天第一次,长片 B 与简洁 A 并存;AMD 780M 实测 0.4× 稳定段 15.2ms)。v2.1.1:新增“减少动态效果时仍播放”的显式无障碍覆盖,默认遵守系统;低电量仍跳过。v2.1.2:跳过只由右下角提示或 Esc 触发,点击画面其他位置不再误跳。v2.1.3:性能兜底改为 0.4× 持续 >80ms 且播放超过 4 秒才切简洁版,避免启动抖动把长片过早切走。以新海诚天光为基调的沉浸式皮肤:全屏循环视频壁纸置于内容之下,半透明天光玻璃面板;壁纸库支持上传、隐藏、轮播、画面滤镜与标签检索;可选的 WebWallGL 通道实时渲染 Wallpaper Engine 场景;可拖拽的薄荷 Q 版小猫桌宠会靠近回应、陪你互动。v0.5.0 加入了宿主配置同步与 schema 迁移、模块开关、渲染预算、特效与氛围层、时段/专注联动、系统音频与 Now Playing、网页壁纸、动态分辨率与预裁剪缓存、可选转码、导入导出包与配方分享链接、排版增强、可读性护栏、键盘无障碍与 zh/en 双语;v0.6.0 接入 Wallpaper Engine 壁纸库;v0.7.0 新增职责通道:外部角色包可在桌宠旁显示带按钮的职责气泡(审批/完成/喝水等),并把用户选择(等会儿/静音/休息时再说)回传给职责引擎。本版只改浏览器半,无需重启 DSH(Ctrl+F5 即可)。同一份构建适配 DSH 0.2.0 / 0.2.1 / 0.2.2(选择器桥按运行时钩子分层降级)。 v1.0.0 正式版:桌宠升级为有生活节奏的角色智能体——虚拟时钟/每日作息/主动开口预算/跨会话记忆,职责提醒可被静默与预算闸门延迟并在窗口期自动回放;形象可替换为本地图片或 ≤32 MiB 视频;新增可选液态玻璃(真实/柔和/磨砂,低电量自动降级);新增「角色 / 生活」设置页与专注计时;无宿主路由改动,Ctrl+F5 即可。 v1.1.0:角色中枢(侧栏入口 + 全屏面板,一屏管生活/形象/玻璃/记忆)、AI 桌宠(本地大脑 + 可选 LLM 适配器,严格能力白名单与硬上限、审计与暂停开关)、形象支持本地上传图片/视频(≤32MiB)。 v1.2.0:桌宠右键直达角色中枢;新增受控 DSH Agent 接入(agentChat 权限默认关闭、显式授权、无自动触发、每日≤10 次/≤500 字/60s,可连接现有会话或新建桌宠会话)。 v1.3.0:角色入口收进桌宠——去掉设置页「角色 / 生活」与侧栏「角色」按钮,右键桌宠(或桌宠菜单「角色中枢」)打开全部功能;生活节奏设置已并入角色中枢。 v1.4.0:权限模型调整——「驱动 DSH」仍强烈永久禁止;直接联网/读写文件/执行命令/代审批/代发消息/安装插件改为用户可显式授予的高风险权限(默认关闭、可撤销、全程审计;皮肤不内置实现,需你注册能力适配器才会被调用)。 v1.5.0:恢复默认桌宠形象、液态玻璃默认开启并加预览(实时可见)、角色中枢新增天气卡(启用/城市/定位/刷新,显示当前天气)、一键功能自检、应用内反馈面板(复制/预填 GitHub Issue/下载 JSON)+ GitHub issue 模板。 v1.6.0:安全上限整体上调(主动开口 12/50、本地 chat 20/分 1200/天、输入 1000 字、LLM 日 60/上限 120、分钟 6、输出 1200 字、20s 超时、Agent 日 30/上限 100、输入 1000 字/120s);液态玻璃在 depth!=off 时统一应用到全部界面(侧栏/设置/壁纸库/中枢/对话框/菜单/列表框/输入区/气泡/胶囊/提示等),无壁纸场景时自动补一层玻璃兜底,关闭档零变化、低电量自动降级。 v1.6.1:液态玻璃升级 v2(OriginOS 风更厚磨砂、多层 specular 高光、1px 亮暗边、外柔光、细噪点与柔和回弹);修复侧栏「新会话」按钮深色块并玻璃化;DSH 主界面右上新增常驻天气胶囊(点击打开角色中枢天气卡)。 v1.6.2:移除壁纸左上角固定的「晨光/太阳」装饰(旧版每张壁纸重建场景都会绘制一个 top-left dawn burst,看起来像常驻小太阳);场景层只保留 veil 天空光渐变,切换壁纸不再出现任何固定角标(仅视觉变化)。 v1.6.3:显示名精简为「天光」(skin id / 包名 / data 属性 / 设置键均不变,旧用户无迁移成本);完成 DSH 0.2.0-rc.2 / 0.2.1-rc.5 / 0.2.2-rc.1 三线兼容性实证(compat-matrix 三行全 COMPATIBLE、hook-scan 全桥接钩子在位、upgrade-check 升级假设全部成立)。 v1.6.4(公开 v1.0.3 正式版):桌宠新增「AI 对话」菜单(输入条 + 气泡回复,识别当前替换的图片/视频形象,视频上方空间不足自动翻转);每个自定义形象可编辑一套动作名与回复(按 mediaId 生效,未改动跟随默认);角色中枢形象文件名常显列表(文件名/类型/大小,点击切换);完成全代码审查修复(默认文案冻结、WE 宿主 stream error、低电量异步泄漏、bridge 节点清理、转码超时兜底、宿主同源栅栏收紧、聊天视口翻转)。 v1.6.5(公开 v1.0.4 正式版):修复桌宠「AI 对话」关不掉的问题——新增面板「×」关闭按钮、点空白关闭、全局 Esc 关闭、[hidden] 真正隐藏,并支持桌宠靠近屏幕底部时点桌宠直接退出(菜单被裁到视口外也能退出)。仅浏览器半,无宿主路由改动,Ctrl+F5 即可。 v1.6.6(公开 v1.0.5 正式版):修复 AI 对话面板在桌宠默认靠右位置时「×」关闭按钮被视口裁掉的问题(面板水平夹取进视口,拖拽/窗口缩放后重算),并把顶部翻转阈值改为按面板实际高度计算(新增按钮行后不再裁到顶部),略增大关闭按钮点击区域。仅浏览器半;版本常量变更,Ctrl+F5 + 重启 DSH 一次可消除宿主半 stale 提示。 v1.6.7(公开 v1.0.6 正式版):壁纸面板默认视图新增一等「URL 地址」「ShaderToy 代码」快捷来源(点击直达编辑器,并修复 URL/Shader 应用假成功与卡死);桌宠「AI 对话」收到回复即自动收起输入面板、只留气泡回复;新增「☰」对话历史(与 AI 对话相邻):可查看历史、开启新对话、编辑已发消息、删除对话,数据存本机 localStorage。仅浏览器半;版本常量变更,Ctrl+F5 + 重启 DSH 一次可消除宿主半 stale 提示。 v1.6.8(公开 v1.0.7 正式版):桌宠新增「自主思考」智能体——按间隔做内心独白、可自主开口(受既有主动开口预算约束),聊天回复融入最近对话/时段/记忆/当前想法更像人;角色中枢新增「自主思考」卡片(开关/间隔/自主开口/现在想一下/最近想法/清空)。不新增权限与网络通道,不驱动 DSH Agent;仅浏览器半,Ctrl+F5 即可;版本常量变更,重启 DSH 一次可消除宿主半 stale 提示。 v2.0.0:桌宠 AI 对话接入 DSH 自带 LLM(宿主路由 _pet-chat;默认跟随 DSH 默认模型,仍须在角色中枢两步授权 llm;不建会话、不调工具、60/日、6/分、1200 字、20s 超时;失败按稳定错误码提示);版本号统一为 2.0.0(仓库 / DSH 安装 / GitHub 发布同名同号);并入 v1.6.8 之后的体检修复批次(设置同步合并与冲突保护、宿主/桥接安全收口、统一浮层层序、壁纸切换与性能、可读性/低电量、导出导入一致性);默认演示素材精简为 bg-4k.mp4(H.264 4K)与 cat.png,bg-main.mp4 改为可选自备首选槽。本版改了宿主半:升级后必须重启 DSH 一次 + Ctrl+F5,之后纯浏览器半更新仍只需 Ctrl+F5。",
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",
@@ -1,21 +1,21 @@
1
- This is free and unencumbered software released into the public domain.
2
-
3
- Anyone is free to copy, modify, publish, use, compile, sell, or distribute
4
- this software, either in source code form or as a compiled binary, for any
5
- purpose, commercial or non-commercial, and by any means.
6
-
7
- In jurisdictions that recognize copyright laws, the author or authors of
8
- this software dedicate any and all copyright interest in the software to the
9
- public domain. We make this dedication for the benefit of the public at large
10
- and to the detriment of our heirs and successors. We intend this dedication
11
- to be an overt act of relinquishment in perpetuity of all present and future
12
- rights to this software under copyright law.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
19
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
-
21
- For more information, please refer to <https://unlicense.org>.
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or distribute
4
+ this software, either in source code form or as a compiled binary, for any
5
+ purpose, commercial or non-commercial, and by any means.
6
+
7
+ In jurisdictions that recognize copyright laws, the author or authors of
8
+ this software dedicate any and all copyright interest in the software to the
9
+ public domain. We make this dedication for the benefit of the public at large
10
+ and to the detriment of our heirs and successors. We intend this dedication
11
+ to be an overt act of relinquishment in perpetuity of all present and future
12
+ rights to this software under copyright law.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
19
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+
21
+ For more information, please refer to <https://unlicense.org>.
@@ -1,99 +1,99 @@
1
- param(
2
- [Parameter(Mandatory = $true)][ValidateSet('monitor', 'present', 'restore')][string]$Action,
3
- [string]$Title = 'DSH-WE-Record',
4
- [int]$Width = 0,
5
- [int]$Height = 0
6
- )
7
-
8
- # Desktop presentation for scene-video capture:
9
- # monitor - print the primary monitor's physical pixel size ("WxH")
10
- # present - hide taskbars, force the Wallpaper Engine record window
11
- # borderless-fullscreen topmost, move the cursor to its centre
12
- # (wcap captures the window under the cursor)
13
- # restore - bring the taskbars back
14
- # Everything is best-effort and reversible; a capture that fails midway must
15
- # still call 'restore' so the user's desktop returns to normal.
16
-
17
- $ErrorActionPreference = 'Stop'
18
-
19
- Add-Type -TypeDefinition @'
20
- using System;
21
- using System.Runtime.InteropServices;
22
- using System.Text;
23
-
24
- public static class SceneCaptureDesktop {
25
- [DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
26
- [DllImport("user32.dll")] public static extern int GetSystemMetrics(int index);
27
- [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string className, string windowName);
28
- [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int command);
29
- [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr after, int x, int y, int width, int height, uint flags);
30
- [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
31
- [DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y);
32
- [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr hWnd);
33
- [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int maxCount);
34
- [DllImport("user32.dll")] public static extern bool EnumWindows(EnumWindowsProc callback, IntPtr lParam);
35
- public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
36
-
37
- public static readonly IntPtr TopMost = new IntPtr(-1);
38
- public const uint ShowWindowFlag = 0x0040;
39
- public const uint KeepPositionFlag = 0x0002;
40
- public const uint KeepSizeFlag = 0x0001;
41
- }
42
- '@
43
-
44
- [SceneCaptureDesktop]::SetProcessDPIAware() | Out-Null
45
-
46
- function Get-TaskbarHandles {
47
- $handles = @()
48
- foreach ($className in @('Shell_TrayWnd', 'Shell_SecondaryTrayWnd')) {
49
- $handle = [SceneCaptureDesktop]::FindWindow($className, $null)
50
- if ($handle -ne [IntPtr]::Zero) { $handles += $handle }
51
- }
52
- return $handles
53
- }
54
-
55
- function Find-RecordWindow([string]$titlePart) {
56
- $script:found = [IntPtr]::Zero
57
- $callback = [SceneCaptureDesktop+EnumWindowsProc]{
58
- param([IntPtr]$hWnd, [IntPtr]$lParam)
59
- if (-not [SceneCaptureDesktop]::IsWindowVisible($hWnd)) { return $true }
60
- $text = New-Object System.Text.StringBuilder 1024
61
- [void][SceneCaptureDesktop]::GetWindowText($hWnd, $text, 1024)
62
- if ($text.ToString().Contains($titlePart)) {
63
- $script:found = $hWnd
64
- return $false
65
- }
66
- return $true
67
- }
68
- [void][SceneCaptureDesktop]::EnumWindows($callback, [IntPtr]::Zero)
69
- return $script:found
70
- }
71
-
72
- switch ($Action) {
73
- 'monitor' {
74
- # 0 = SM_CXSCREEN, 1 = SM_CYSCREEN (primary monitor, physical pixels
75
- # because the process is DPI-aware)
76
- Write-Output ("{0}x{1}" -f [SceneCaptureDesktop]::GetSystemMetrics(0), [SceneCaptureDesktop]::GetSystemMetrics(1))
77
- }
78
- 'present' {
79
- foreach ($handle in (Get-TaskbarHandles)) { [void][SceneCaptureDesktop]::ShowWindow($handle, 0) }
80
- $window = Find-RecordWindow $Title
81
- if ($window -eq [IntPtr]::Zero) { Write-Output 'window-not-found'; exit 2 }
82
- if ($Width -gt 0 -and $Height -gt 0) {
83
- [void][SceneCaptureDesktop]::SetWindowPos($window, [SceneCaptureDesktop]::TopMost, 0, 0, $Width, $Height, [SceneCaptureDesktop]::ShowWindowFlag)
84
- }
85
- else {
86
- $flags = [SceneCaptureDesktop]::KeepPositionFlag -bor [SceneCaptureDesktop]::KeepSizeFlag -bor [SceneCaptureDesktop]::ShowWindowFlag
87
- [void][SceneCaptureDesktop]::SetWindowPos($window, [SceneCaptureDesktop]::TopMost, 0, 0, 0, 0, $flags)
88
- }
89
- [void][SceneCaptureDesktop]::SetForegroundWindow($window)
90
- if ($Width -gt 0 -and $Height -gt 0) {
91
- [void][SceneCaptureDesktop]::SetCursorPos([int]($Width / 2), [int]($Height / 2))
92
- }
93
- Write-Output 'ok'
94
- }
95
- 'restore' {
96
- foreach ($handle in (Get-TaskbarHandles)) { [void][SceneCaptureDesktop]::ShowWindow($handle, 5) }
97
- Write-Output 'ok'
98
- }
99
- }
1
+ param(
2
+ [Parameter(Mandatory = $true)][ValidateSet('monitor', 'present', 'restore')][string]$Action,
3
+ [string]$Title = 'DSH-WE-Record',
4
+ [int]$Width = 0,
5
+ [int]$Height = 0
6
+ )
7
+
8
+ # Desktop presentation for scene-video capture:
9
+ # monitor - print the primary monitor's physical pixel size ("WxH")
10
+ # present - hide taskbars, force the Wallpaper Engine record window
11
+ # borderless-fullscreen topmost, move the cursor to its centre
12
+ # (wcap captures the window under the cursor)
13
+ # restore - bring the taskbars back
14
+ # Everything is best-effort and reversible; a capture that fails midway must
15
+ # still call 'restore' so the user's desktop returns to normal.
16
+
17
+ $ErrorActionPreference = 'Stop'
18
+
19
+ Add-Type -TypeDefinition @'
20
+ using System;
21
+ using System.Runtime.InteropServices;
22
+ using System.Text;
23
+
24
+ public static class SceneCaptureDesktop {
25
+ [DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
26
+ [DllImport("user32.dll")] public static extern int GetSystemMetrics(int index);
27
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string className, string windowName);
28
+ [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int command);
29
+ [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr after, int x, int y, int width, int height, uint flags);
30
+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
31
+ [DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y);
32
+ [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr hWnd);
33
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int maxCount);
34
+ [DllImport("user32.dll")] public static extern bool EnumWindows(EnumWindowsProc callback, IntPtr lParam);
35
+ public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
36
+
37
+ public static readonly IntPtr TopMost = new IntPtr(-1);
38
+ public const uint ShowWindowFlag = 0x0040;
39
+ public const uint KeepPositionFlag = 0x0002;
40
+ public const uint KeepSizeFlag = 0x0001;
41
+ }
42
+ '@
43
+
44
+ [SceneCaptureDesktop]::SetProcessDPIAware() | Out-Null
45
+
46
+ function Get-TaskbarHandles {
47
+ $handles = @()
48
+ foreach ($className in @('Shell_TrayWnd', 'Shell_SecondaryTrayWnd')) {
49
+ $handle = [SceneCaptureDesktop]::FindWindow($className, $null)
50
+ if ($handle -ne [IntPtr]::Zero) { $handles += $handle }
51
+ }
52
+ return $handles
53
+ }
54
+
55
+ function Find-RecordWindow([string]$titlePart) {
56
+ $script:found = [IntPtr]::Zero
57
+ $callback = [SceneCaptureDesktop+EnumWindowsProc]{
58
+ param([IntPtr]$hWnd, [IntPtr]$lParam)
59
+ if (-not [SceneCaptureDesktop]::IsWindowVisible($hWnd)) { return $true }
60
+ $text = New-Object System.Text.StringBuilder 1024
61
+ [void][SceneCaptureDesktop]::GetWindowText($hWnd, $text, 1024)
62
+ if ($text.ToString().Contains($titlePart)) {
63
+ $script:found = $hWnd
64
+ return $false
65
+ }
66
+ return $true
67
+ }
68
+ [void][SceneCaptureDesktop]::EnumWindows($callback, [IntPtr]::Zero)
69
+ return $script:found
70
+ }
71
+
72
+ switch ($Action) {
73
+ 'monitor' {
74
+ # 0 = SM_CXSCREEN, 1 = SM_CYSCREEN (primary monitor, physical pixels
75
+ # because the process is DPI-aware)
76
+ Write-Output ("{0}x{1}" -f [SceneCaptureDesktop]::GetSystemMetrics(0), [SceneCaptureDesktop]::GetSystemMetrics(1))
77
+ }
78
+ 'present' {
79
+ foreach ($handle in (Get-TaskbarHandles)) { [void][SceneCaptureDesktop]::ShowWindow($handle, 0) }
80
+ $window = Find-RecordWindow $Title
81
+ if ($window -eq [IntPtr]::Zero) { Write-Output 'window-not-found'; exit 2 }
82
+ if ($Width -gt 0 -and $Height -gt 0) {
83
+ [void][SceneCaptureDesktop]::SetWindowPos($window, [SceneCaptureDesktop]::TopMost, 0, 0, $Width, $Height, [SceneCaptureDesktop]::ShowWindowFlag)
84
+ }
85
+ else {
86
+ $flags = [SceneCaptureDesktop]::KeepPositionFlag -bor [SceneCaptureDesktop]::KeepSizeFlag -bor [SceneCaptureDesktop]::ShowWindowFlag
87
+ [void][SceneCaptureDesktop]::SetWindowPos($window, [SceneCaptureDesktop]::TopMost, 0, 0, 0, 0, $flags)
88
+ }
89
+ [void][SceneCaptureDesktop]::SetForegroundWindow($window)
90
+ if ($Width -gt 0 -and $Height -gt 0) {
91
+ [void][SceneCaptureDesktop]::SetCursorPos([int]($Width / 2), [int]($Height / 2))
92
+ }
93
+ Write-Output 'ok'
94
+ }
95
+ 'restore' {
96
+ foreach ($handle in (Get-TaskbarHandles)) { [void][SceneCaptureDesktop]::ShowWindow($handle, 5) }
97
+ Write-Output 'ok'
98
+ }
99
+ }
@@ -1,24 +1,24 @@
1
- Add-Type -TypeDefinition @'
2
- using System;
3
- using System.Runtime.InteropServices;
4
-
5
- public static class WcapHotkey {
6
- [DllImport("user32.dll")]
7
- private static extern void keybd_event(byte key, byte scan, uint flags, UIntPtr extraInfo);
8
-
9
- public static void Send() {
10
- const uint KeyUp = 0x0002;
11
- const byte Control = 0x11;
12
- const byte LeftWindows = 0x5B;
13
- const byte PrintScreen = 0x2C;
14
- keybd_event(Control, 0, 0, UIntPtr.Zero);
15
- keybd_event(LeftWindows, 0, 0, UIntPtr.Zero);
16
- keybd_event(PrintScreen, 0, 0, UIntPtr.Zero);
17
- keybd_event(PrintScreen, 0, KeyUp, UIntPtr.Zero);
18
- keybd_event(LeftWindows, 0, KeyUp, UIntPtr.Zero);
19
- keybd_event(Control, 0, KeyUp, UIntPtr.Zero);
20
- }
21
- }
22
- '@
23
-
24
- [WcapHotkey]::Send()
1
+ Add-Type -TypeDefinition @'
2
+ using System;
3
+ using System.Runtime.InteropServices;
4
+
5
+ public static class WcapHotkey {
6
+ [DllImport("user32.dll")]
7
+ private static extern void keybd_event(byte key, byte scan, uint flags, UIntPtr extraInfo);
8
+
9
+ public static void Send() {
10
+ const uint KeyUp = 0x0002;
11
+ const byte Control = 0x11;
12
+ const byte LeftWindows = 0x5B;
13
+ const byte PrintScreen = 0x2C;
14
+ keybd_event(Control, 0, 0, UIntPtr.Zero);
15
+ keybd_event(LeftWindows, 0, 0, UIntPtr.Zero);
16
+ keybd_event(PrintScreen, 0, 0, UIntPtr.Zero);
17
+ keybd_event(PrintScreen, 0, KeyUp, UIntPtr.Zero);
18
+ keybd_event(LeftWindows, 0, KeyUp, UIntPtr.Zero);
19
+ keybd_event(Control, 0, KeyUp, UIntPtr.Zero);
20
+ }
21
+ }
22
+ '@
23
+
24
+ [WcapHotkey]::Send()