dsh-launch-screen 0.0.0-stage → 1.0.0
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/LICENSE +21 -0
- package/README.md +63 -2
- package/assets/screenshot-1.png +0 -0
- package/assets/screenshot-2.png +0 -0
- package/client.js +366 -0
- package/cordis.patch.yml +3 -0
- package/icon.png +0 -0
- package/icon.svg +4 -0
- package/index.js +130 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/media/main.mp4 +0 -0
- package/package.json +52 -4
- package/screenshots.json +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Neil Lowden
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-launch-screen
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A full-screen startup animation for the [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) Web GUI. Drop in your own clip and the app opens with it — once per launch, always skippable.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Once per launch**: the Host publishes a launch id; the browser remembers the last id it played. Refreshing or opening another tab does not replay the clip. Restarting DeepSeek Harness starts a new launch, so the clip plays again.
|
|
10
|
+
- **Always dismissible**: click anywhere, press Esc, or use the "skip" pill. A failed or blocked video closes itself immediately.
|
|
11
|
+
- **Muted by default**: browsers only allow autoplay without sound. The round button in the top-right corner enables sound.
|
|
12
|
+
- **Self-contained media**: the clip lives in `media/main.mp4` and is served by this plugin's Host half over HTTP, with byte-range support for seeking. Nothing outside the package is read at runtime.
|
|
13
|
+
- **Theme-aware controls**: skip and sound buttons inherit the app's font and use neutral overlay styling.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
From npm:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
dsh plugin add dsh-launch-screen
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
From GitHub:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
dsh plugin add Neil-Lowden/dsh-launch-screen
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
From a local checkout:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
dsh plugin add /path/to/dsh-launch-screen
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then enable **Launch screen** in Settings → Plugins (or `dsh plugin enable dsh-launch-screen`) and restart DeepSeek Harness.
|
|
36
|
+
|
|
37
|
+
## Replace the animation
|
|
38
|
+
|
|
39
|
+
Replace `media/main.mp4` with another H.264/AAC MP4 and reload. The clip is read from disk per request, so a local link install needs no reinstall. Keep the file reasonably small — it is downloaded in full by the browser on first play (the route supports single byte ranges, so seeking works).
|
|
40
|
+
|
|
41
|
+
## Files
|
|
42
|
+
|
|
43
|
+
| Path | Purpose |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `index.js` | Host half: `/boot-animation/launch.json` and `/boot-animation/media/main.mp4` (GET/HEAD, byte ranges) |
|
|
46
|
+
| `client.js` | Client half: launch gate, overlay, skip/sound controls |
|
|
47
|
+
| `media/main.mp4` | The clip (1280×720, H.264/AAC, 24 fps, 8.04 s) |
|
|
48
|
+
| `cordis.patch.yml` | Registers the bundle |
|
|
49
|
+
| `locale/*.json` | Plugin title/description |
|
|
50
|
+
| `icon.svg` / `icon.png` | Loader icon |
|
|
51
|
+
| `screenshots.json` | Storefront screenshots |
|
|
52
|
+
| `assets/` | Screenshot images |
|
|
53
|
+
|
|
54
|
+
## Notes and limits
|
|
55
|
+
|
|
56
|
+
- Requires the Web GUI over HTTP with this plugin's Host half running. If the page is ever loaded from `file://`, relative media URLs cannot resolve and the animation is skipped.
|
|
57
|
+
- The animation appears after React mounts, so it does not cover the pre-React boot screen.
|
|
58
|
+
- The clip is not transcoded: it is exactly the file at `media/main.mp4`.
|
|
59
|
+
- Removing or moving this package directory breaks a link install; a normal install is unaffected.
|
|
60
|
+
- The bundled clip is third-party artwork — replace it with your own if you redistribute this plugin without permission.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
[MIT](LICENSE)
|
|
Binary file
|
|
Binary file
|
package/client.js
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client half of the boot-animation bundle.
|
|
3
|
+
*
|
|
4
|
+
* Renders a full-screen overlay in the shell.overlay slot on the first page
|
|
5
|
+
* load after the Host process started, then stays out of the way. The overlay
|
|
6
|
+
* is always dismissible and never traps the UI.
|
|
7
|
+
*/
|
|
8
|
+
window.__ModuleLoader__.load({
|
|
9
|
+
id: 'dsh-launch-screen',
|
|
10
|
+
factory(require) {
|
|
11
|
+
const React = require('react')
|
|
12
|
+
const h = React.createElement
|
|
13
|
+
const { useCallback, useEffect, useRef, useState } = React
|
|
14
|
+
|
|
15
|
+
const LAUNCH_KEY = 'dsh.boot-animation.launch-id'
|
|
16
|
+
const LAUNCH_ENDPOINT = 'boot-animation/launch.json'
|
|
17
|
+
const MEDIA_ENDPOINT = 'boot-animation/media/main.mp4'
|
|
18
|
+
const DECIDE_TIMEOUT_MS = 1500
|
|
19
|
+
const START_TIMEOUT_MS = 4000
|
|
20
|
+
const FADE_MS = 350
|
|
21
|
+
|
|
22
|
+
const BUTTON_BASE = {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
borderRadius: 999,
|
|
25
|
+
border: '1px solid rgba(255, 255, 255, 0.25)',
|
|
26
|
+
background: 'rgba(0, 0, 0, 0.45)',
|
|
27
|
+
color: '#fff',
|
|
28
|
+
cursor: 'pointer',
|
|
29
|
+
font: '13px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function resolveAsset(path) {
|
|
33
|
+
try {
|
|
34
|
+
return new URL(path, document.baseURI).href
|
|
35
|
+
} catch {
|
|
36
|
+
return path
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function readSeenLaunchId() {
|
|
41
|
+
try {
|
|
42
|
+
return window.localStorage.getItem(LAUNCH_KEY)
|
|
43
|
+
} catch {
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function markLaunchSeen(launchId) {
|
|
49
|
+
try {
|
|
50
|
+
window.localStorage.setItem(LAUNCH_KEY, launchId)
|
|
51
|
+
} catch {
|
|
52
|
+
// No storage: the animation simply plays once per page load.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function readLaunchId() {
|
|
57
|
+
const controller = new AbortController()
|
|
58
|
+
const timer = window.setTimeout(() => controller.abort(), DECIDE_TIMEOUT_MS)
|
|
59
|
+
try {
|
|
60
|
+
const response = await fetch(resolveAsset(LAUNCH_ENDPOINT), {
|
|
61
|
+
cache: 'no-store',
|
|
62
|
+
signal: controller.signal,
|
|
63
|
+
})
|
|
64
|
+
if (!response.ok) throw new Error(`launch endpoint answered ${response.status}`)
|
|
65
|
+
const payload = await response.json()
|
|
66
|
+
if (!payload || typeof payload.launchId !== 'string' || payload.launchId === '') {
|
|
67
|
+
throw new Error('launch endpoint returned no launchId')
|
|
68
|
+
}
|
|
69
|
+
return payload.launchId
|
|
70
|
+
} finally {
|
|
71
|
+
window.clearTimeout(timer)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function SpeakerIcon({ muted }) {
|
|
76
|
+
return h(
|
|
77
|
+
'svg',
|
|
78
|
+
{
|
|
79
|
+
width: 20,
|
|
80
|
+
height: 20,
|
|
81
|
+
viewBox: '0 0 24 24',
|
|
82
|
+
fill: 'none',
|
|
83
|
+
stroke: 'currentColor',
|
|
84
|
+
strokeWidth: 1.8,
|
|
85
|
+
strokeLinecap: 'round',
|
|
86
|
+
strokeLinejoin: 'round',
|
|
87
|
+
'aria-hidden': 'true',
|
|
88
|
+
},
|
|
89
|
+
h('path', { key: 'body', d: 'M4 9.5h3.2L12 6v12l-4.8-3.5H4z' }),
|
|
90
|
+
muted
|
|
91
|
+
? [
|
|
92
|
+
h('path', { key: 'x1', d: 'M15.4 9.6l4.4 4.8' }),
|
|
93
|
+
h('path', { key: 'x2', d: 'M19.8 9.6l-4.4 4.8' }),
|
|
94
|
+
]
|
|
95
|
+
: [
|
|
96
|
+
h('path', { key: 'w1', d: 'M15.2 9.4a4.4 4.4 0 0 1 0 5.2' }),
|
|
97
|
+
h('path', { key: 'w2', d: 'M17.8 7a8 8 0 0 1 0 10' }),
|
|
98
|
+
],
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function Overlay({ launchId, t, onDone }) {
|
|
103
|
+
const [muted, setMuted] = useState(true)
|
|
104
|
+
const [closing, setClosing] = useState(false)
|
|
105
|
+
const rootRef = useRef(null)
|
|
106
|
+
const videoRef = useRef(null)
|
|
107
|
+
const barRef = useRef(null)
|
|
108
|
+
const closedRef = useRef(false)
|
|
109
|
+
const fadeTimerRef = useRef(0)
|
|
110
|
+
const startTimerRef = useRef(0)
|
|
111
|
+
|
|
112
|
+
const finish = useCallback(() => {
|
|
113
|
+
if (closedRef.current) return
|
|
114
|
+
closedRef.current = true
|
|
115
|
+
setClosing(true)
|
|
116
|
+
if (videoRef.current) {
|
|
117
|
+
try {
|
|
118
|
+
videoRef.current.pause()
|
|
119
|
+
} catch {
|
|
120
|
+
// The element may already be torn down.
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
fadeTimerRef.current = window.setTimeout(onDone, FADE_MS)
|
|
124
|
+
}, [onDone])
|
|
125
|
+
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
const root = rootRef.current
|
|
128
|
+
const video = videoRef.current
|
|
129
|
+
if (root) root.focus()
|
|
130
|
+
if (!video) {
|
|
131
|
+
finish()
|
|
132
|
+
return undefined
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const onPlaying = () => {
|
|
136
|
+
window.clearTimeout(startTimerRef.current)
|
|
137
|
+
markLaunchSeen(launchId)
|
|
138
|
+
}
|
|
139
|
+
const onTimeUpdate = () => {
|
|
140
|
+
const bar = barRef.current
|
|
141
|
+
const duration = video.duration
|
|
142
|
+
if (!bar || !Number.isFinite(duration) || duration <= 0) return
|
|
143
|
+
const fraction = Math.min(Math.max(video.currentTime / duration, 0), 1)
|
|
144
|
+
bar.style.width = `${fraction * 100}%`
|
|
145
|
+
}
|
|
146
|
+
const onWheel = (event) => {
|
|
147
|
+
event.preventDefault()
|
|
148
|
+
}
|
|
149
|
+
const onKeyDown = (event) => {
|
|
150
|
+
if (event.key !== 'Escape') return
|
|
151
|
+
event.preventDefault()
|
|
152
|
+
finish()
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
video.addEventListener('playing', onPlaying)
|
|
156
|
+
video.addEventListener('ended', finish)
|
|
157
|
+
video.addEventListener('error', finish)
|
|
158
|
+
video.addEventListener('timeupdate', onTimeUpdate)
|
|
159
|
+
window.addEventListener('wheel', onWheel, { passive: false })
|
|
160
|
+
window.addEventListener('keydown', onKeyDown, true)
|
|
161
|
+
|
|
162
|
+
video.muted = true
|
|
163
|
+
const attempt = video.play()
|
|
164
|
+
if (attempt && typeof attempt.catch === 'function') {
|
|
165
|
+
attempt.catch((error) => {
|
|
166
|
+
console.warn('[boot-animation] playback did not start:', error)
|
|
167
|
+
finish()
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
if (!video.paused) onPlaying()
|
|
171
|
+
|
|
172
|
+
startTimerRef.current = window.setTimeout(() => {
|
|
173
|
+
if (closedRef.current) return
|
|
174
|
+
console.warn('[boot-animation] video did not start in time; closing')
|
|
175
|
+
finish()
|
|
176
|
+
}, START_TIMEOUT_MS)
|
|
177
|
+
|
|
178
|
+
return () => {
|
|
179
|
+
window.clearTimeout(startTimerRef.current)
|
|
180
|
+
window.clearTimeout(fadeTimerRef.current)
|
|
181
|
+
window.removeEventListener('wheel', onWheel)
|
|
182
|
+
window.removeEventListener('keydown', onKeyDown, true)
|
|
183
|
+
video.removeEventListener('playing', onPlaying)
|
|
184
|
+
video.removeEventListener('ended', finish)
|
|
185
|
+
video.removeEventListener('error', finish)
|
|
186
|
+
video.removeEventListener('timeupdate', onTimeUpdate)
|
|
187
|
+
}
|
|
188
|
+
}, [finish, launchId])
|
|
189
|
+
|
|
190
|
+
const toggleMuted = () => {
|
|
191
|
+
const video = videoRef.current
|
|
192
|
+
const next = !muted
|
|
193
|
+
setMuted(next)
|
|
194
|
+
if (!video) return
|
|
195
|
+
video.muted = next
|
|
196
|
+
if (!next) {
|
|
197
|
+
const attempt = video.play()
|
|
198
|
+
if (attempt && typeof attempt.catch === 'function') attempt.catch(() => {})
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return h(
|
|
203
|
+
'div',
|
|
204
|
+
{
|
|
205
|
+
ref: rootRef,
|
|
206
|
+
tabIndex: -1,
|
|
207
|
+
role: 'dialog',
|
|
208
|
+
'aria-modal': 'true',
|
|
209
|
+
'aria-label': t('label'),
|
|
210
|
+
'data-dsh-boot-animation': '',
|
|
211
|
+
onClick: finish,
|
|
212
|
+
style: {
|
|
213
|
+
position: 'fixed',
|
|
214
|
+
inset: 0,
|
|
215
|
+
zIndex: 2147483000,
|
|
216
|
+
overflow: 'hidden',
|
|
217
|
+
display: 'grid',
|
|
218
|
+
placeItems: 'center',
|
|
219
|
+
background: '#000',
|
|
220
|
+
outline: 'none',
|
|
221
|
+
opacity: closing ? 0 : 1,
|
|
222
|
+
transition: `opacity ${FADE_MS}ms ease`,
|
|
223
|
+
pointerEvents: 'auto',
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
[
|
|
227
|
+
h('video', {
|
|
228
|
+
key: 'video',
|
|
229
|
+
ref: videoRef,
|
|
230
|
+
src: resolveAsset(MEDIA_ENDPOINT),
|
|
231
|
+
autoPlay: true,
|
|
232
|
+
muted: true,
|
|
233
|
+
playsInline: true,
|
|
234
|
+
preload: 'auto',
|
|
235
|
+
disablePictureInPicture: true,
|
|
236
|
+
'aria-hidden': 'true',
|
|
237
|
+
style: {
|
|
238
|
+
width: '100%',
|
|
239
|
+
height: '100%',
|
|
240
|
+
display: 'block',
|
|
241
|
+
objectFit: 'contain',
|
|
242
|
+
background: '#000',
|
|
243
|
+
pointerEvents: 'none',
|
|
244
|
+
},
|
|
245
|
+
}),
|
|
246
|
+
h('div', {
|
|
247
|
+
key: 'progress',
|
|
248
|
+
ref: barRef,
|
|
249
|
+
style: {
|
|
250
|
+
position: 'absolute',
|
|
251
|
+
left: 0,
|
|
252
|
+
bottom: 0,
|
|
253
|
+
width: '0%',
|
|
254
|
+
height: 2,
|
|
255
|
+
background: 'rgba(255, 255, 255, 0.6)',
|
|
256
|
+
},
|
|
257
|
+
}),
|
|
258
|
+
h(
|
|
259
|
+
'button',
|
|
260
|
+
{
|
|
261
|
+
key: 'sound',
|
|
262
|
+
type: 'button',
|
|
263
|
+
'aria-label': muted ? t('soundOn') : t('soundOff'),
|
|
264
|
+
'aria-pressed': !muted,
|
|
265
|
+
onClick: (event) => {
|
|
266
|
+
event.stopPropagation()
|
|
267
|
+
toggleMuted()
|
|
268
|
+
},
|
|
269
|
+
style: {
|
|
270
|
+
...BUTTON_BASE,
|
|
271
|
+
top: 20,
|
|
272
|
+
right: 20,
|
|
273
|
+
width: 40,
|
|
274
|
+
height: 40,
|
|
275
|
+
display: 'grid',
|
|
276
|
+
placeItems: 'center',
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
h(SpeakerIcon, { muted }),
|
|
280
|
+
),
|
|
281
|
+
h(
|
|
282
|
+
'button',
|
|
283
|
+
{
|
|
284
|
+
key: 'skip',
|
|
285
|
+
type: 'button',
|
|
286
|
+
onClick: (event) => {
|
|
287
|
+
event.stopPropagation()
|
|
288
|
+
finish()
|
|
289
|
+
},
|
|
290
|
+
style: { ...BUTTON_BASE, right: 20, bottom: 20, padding: '8px 14px' },
|
|
291
|
+
},
|
|
292
|
+
t('skip'),
|
|
293
|
+
),
|
|
294
|
+
],
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function BootAnimation({ t }) {
|
|
299
|
+
const [phase, setPhase] = useState('deciding')
|
|
300
|
+
const launchIdRef = useRef('')
|
|
301
|
+
const handleDone = useCallback(() => setPhase('done'), [])
|
|
302
|
+
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
let cancelled = false
|
|
305
|
+
if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
306
|
+
setPhase('done')
|
|
307
|
+
return undefined
|
|
308
|
+
}
|
|
309
|
+
readLaunchId()
|
|
310
|
+
.then((launchId) => {
|
|
311
|
+
if (cancelled) return
|
|
312
|
+
if (readSeenLaunchId() === launchId) {
|
|
313
|
+
setPhase('done')
|
|
314
|
+
return
|
|
315
|
+
}
|
|
316
|
+
launchIdRef.current = launchId
|
|
317
|
+
setPhase('playing')
|
|
318
|
+
})
|
|
319
|
+
.catch((error) => {
|
|
320
|
+
console.warn('[boot-animation] skipped:', error)
|
|
321
|
+
if (!cancelled) setPhase('done')
|
|
322
|
+
})
|
|
323
|
+
return () => {
|
|
324
|
+
cancelled = true
|
|
325
|
+
}
|
|
326
|
+
}, [])
|
|
327
|
+
|
|
328
|
+
if (phase !== 'playing' || launchIdRef.current === '') return null
|
|
329
|
+
return h(Overlay, { launchId: launchIdRef.current, t, onDone: handleDone })
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return {
|
|
333
|
+
inject: ['slots', 'locale'],
|
|
334
|
+
apply(ctx) {
|
|
335
|
+
ctx.effect(() => {
|
|
336
|
+
ctx.locale.register('boot-animation', 'en', {
|
|
337
|
+
label: 'Boot animation',
|
|
338
|
+
skip: 'Skip (Esc)',
|
|
339
|
+
soundOn: 'Enable sound',
|
|
340
|
+
soundOff: 'Mute',
|
|
341
|
+
})
|
|
342
|
+
}, 'boot-animation: locale en')
|
|
343
|
+
ctx.effect(() => {
|
|
344
|
+
ctx.locale.register('boot-animation', 'zh', {
|
|
345
|
+
label: '开启动画',
|
|
346
|
+
skip: '跳过 (Esc)',
|
|
347
|
+
soundOn: '开启声音',
|
|
348
|
+
soundOff: '静音',
|
|
349
|
+
})
|
|
350
|
+
}, 'boot-animation: locale zh')
|
|
351
|
+
const t = ctx.locale.bind('boot-animation')
|
|
352
|
+
ctx.slots.inject('shell.overlay', () =>
|
|
353
|
+
ctx.slots.register(
|
|
354
|
+
{
|
|
355
|
+
name: 'shell.overlay',
|
|
356
|
+
id: 'boot-animation',
|
|
357
|
+
order: 100,
|
|
358
|
+
label: 'Boot animation',
|
|
359
|
+
},
|
|
360
|
+
() => h(BootAnimation, { t }),
|
|
361
|
+
),
|
|
362
|
+
)
|
|
363
|
+
},
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
})
|
package/cordis.patch.yml
ADDED
package/icon.png
ADDED
|
Binary file
|
package/icon.svg
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36" fill="none">
|
|
2
|
+
<path d="M13.6 10.4 27 18 13.6 25.6Z" fill="#4D6BFE" stroke="#4D6BFE" stroke-width="2.2" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M6.5 30.4c4-2.4 7.7-2.4 11.5 0s7.5 2.4 11.5 0" stroke="#39D0FF" stroke-width="2.4" stroke-linecap="round"/>
|
|
4
|
+
</svg>
|
package/index.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host half of the boot-animation bundle.
|
|
3
|
+
*
|
|
4
|
+
* Serves the bundled media file and the current Host launch id over two exact
|
|
5
|
+
* webServer routes. The Client half uses the launch id to decide whether this
|
|
6
|
+
* page load is the first one after the Host started.
|
|
7
|
+
*/
|
|
8
|
+
import { createReadStream, promises as fs } from 'node:fs'
|
|
9
|
+
import { fileURLToPath } from 'node:url'
|
|
10
|
+
|
|
11
|
+
const MEDIA_FILE = fileURLToPath(new URL('./media/main.mp4', import.meta.url))
|
|
12
|
+
const LAUNCH_PATH = '/boot-animation/launch.json'
|
|
13
|
+
const MEDIA_PATH = '/boot-animation/media/main.mp4'
|
|
14
|
+
const LAUNCH_ID = `${process.pid}-${Math.round(Date.now() - process.uptime() * 1000)}`
|
|
15
|
+
const RANGE_HEADER = /^bytes=(\d*)-(\d*)$/
|
|
16
|
+
const NO_SNIFF = { 'x-content-type-options': 'nosniff' }
|
|
17
|
+
|
|
18
|
+
export const inject = ['webServer']
|
|
19
|
+
|
|
20
|
+
function methodAllowed(req, res) {
|
|
21
|
+
if (req.method === 'GET' || req.method === 'HEAD') return true
|
|
22
|
+
res.writeHead(405, { ...NO_SNIFF, allow: 'GET, HEAD', 'cache-control': 'no-store' })
|
|
23
|
+
res.end()
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function serveLaunch(req, res) {
|
|
28
|
+
if (!methodAllowed(req, res)) return
|
|
29
|
+
const body = JSON.stringify({ launchId: LAUNCH_ID })
|
|
30
|
+
res.writeHead(200, {
|
|
31
|
+
...NO_SNIFF,
|
|
32
|
+
'content-type': 'application/json; charset=utf-8',
|
|
33
|
+
'content-length': Buffer.byteLength(body),
|
|
34
|
+
'cache-control': 'no-store',
|
|
35
|
+
})
|
|
36
|
+
if (req.method === 'HEAD') {
|
|
37
|
+
res.end()
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
res.end(body)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Returns null (serve whole file), 'invalid' (416), or a byte range. */
|
|
44
|
+
function parseRange(header, size) {
|
|
45
|
+
if (typeof header !== 'string' || size === 0) return null
|
|
46
|
+
if (header.includes(',')) return null
|
|
47
|
+
const match = RANGE_HEADER.exec(header.trim())
|
|
48
|
+
if (!match) return 'invalid'
|
|
49
|
+
const [, rawStart, rawEnd] = match
|
|
50
|
+
if (rawStart === '' && rawEnd === '') return 'invalid'
|
|
51
|
+
if (rawStart === '') {
|
|
52
|
+
const suffix = Number(rawEnd)
|
|
53
|
+
if (!Number.isSafeInteger(suffix) || suffix <= 0) return 'invalid'
|
|
54
|
+
return { start: Math.max(size - suffix, 0), end: size - 1 }
|
|
55
|
+
}
|
|
56
|
+
const start = Number(rawStart)
|
|
57
|
+
const requestedEnd = rawEnd === '' ? size - 1 : Number(rawEnd)
|
|
58
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(requestedEnd)) return 'invalid'
|
|
59
|
+
if (start >= size || start > requestedEnd) return 'invalid'
|
|
60
|
+
return { start, end: Math.min(requestedEnd, size - 1) }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function serveMedia(req, res) {
|
|
64
|
+
if (!methodAllowed(req, res)) return
|
|
65
|
+
let stat
|
|
66
|
+
try {
|
|
67
|
+
stat = await fs.stat(MEDIA_FILE)
|
|
68
|
+
} catch {
|
|
69
|
+
res.writeHead(404, { ...NO_SNIFF, 'cache-control': 'no-store' })
|
|
70
|
+
res.end()
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
const size = stat.size
|
|
74
|
+
const range = parseRange(req.headers.range, size)
|
|
75
|
+
if (range === 'invalid') {
|
|
76
|
+
res.writeHead(416, {
|
|
77
|
+
...NO_SNIFF,
|
|
78
|
+
'content-range': `bytes */${size}`,
|
|
79
|
+
'cache-control': 'no-store',
|
|
80
|
+
})
|
|
81
|
+
res.end()
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
const headers = {
|
|
85
|
+
...NO_SNIFF,
|
|
86
|
+
'content-type': 'video/mp4',
|
|
87
|
+
'accept-ranges': 'bytes',
|
|
88
|
+
'cache-control': 'no-cache',
|
|
89
|
+
}
|
|
90
|
+
if (range === null) {
|
|
91
|
+
headers['content-length'] = size
|
|
92
|
+
res.writeHead(200, headers)
|
|
93
|
+
if (req.method === 'HEAD') {
|
|
94
|
+
res.end()
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
sendFile(req, res)
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
headers['content-length'] = range.end - range.start + 1
|
|
101
|
+
headers['content-range'] = `bytes ${range.start}-${range.end}/${size}`
|
|
102
|
+
res.writeHead(206, headers)
|
|
103
|
+
if (req.method === 'HEAD') {
|
|
104
|
+
res.end()
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
sendFile(req, res, range)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function sendFile(req, res, range) {
|
|
111
|
+
const stream = createReadStream(MEDIA_FILE, range ? { start: range.start, end: range.end } : undefined)
|
|
112
|
+
stream.on('error', () => {
|
|
113
|
+
res.destroy()
|
|
114
|
+
})
|
|
115
|
+
res.on('close', () => {
|
|
116
|
+
stream.destroy()
|
|
117
|
+
})
|
|
118
|
+
stream.pipe(res)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function apply(ctx) {
|
|
122
|
+
ctx.effect(
|
|
123
|
+
() => ctx.webServer.register({ kind: 'exact', path: LAUNCH_PATH, handler: serveLaunch }),
|
|
124
|
+
'boot-animation: launch id route',
|
|
125
|
+
)
|
|
126
|
+
ctx.effect(
|
|
127
|
+
() => ctx.webServer.register({ kind: 'exact', path: MEDIA_PATH, handler: serveMedia }),
|
|
128
|
+
'boot-animation: media route',
|
|
129
|
+
)
|
|
130
|
+
}
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Boot animation",
|
|
4
|
+
"description": "Plays the bundled main.mp4 as a full-screen splash once per DeepSeek Harness launch. Click anywhere or press Esc to skip; sound starts muted with a toggle. The clip is served from the plugin package, so the original desktop file can be deleted."
|
|
5
|
+
}
|
|
6
|
+
}
|
package/locale/zh.json
ADDED
package/media/main.mp4
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-launch-screen",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Full-screen startup animation for the DeepSeek Harness Web GUI: plays once per Host launch, click or Esc to skip, muted by default.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Neil Lowden",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Neil-Lowden/dsh-launch-screen.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/Neil-Lowden/dsh-launch-screen#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Neil-Lowden/dsh-launch-screen/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"dsh",
|
|
18
|
+
"deepseek",
|
|
19
|
+
"deepseek-harness",
|
|
20
|
+
"plugin",
|
|
21
|
+
"startup",
|
|
22
|
+
"animation",
|
|
23
|
+
"boot",
|
|
24
|
+
"launch"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": "./index.js",
|
|
28
|
+
"./client": "./client.js",
|
|
29
|
+
"./locale/*.json": "./locale/*.json",
|
|
30
|
+
"./icon": "./icon.svg"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"index.js",
|
|
34
|
+
"client.js",
|
|
35
|
+
"cordis.patch.yml",
|
|
36
|
+
"media/main.mp4",
|
|
37
|
+
"locale/*.json",
|
|
38
|
+
"icon.svg",
|
|
39
|
+
"icon.png",
|
|
40
|
+
"screenshots.json",
|
|
41
|
+
"assets/*.png",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"dsh": {
|
|
46
|
+
"bundle": {
|
|
47
|
+
"patch": "./cordis.patch.yml"
|
|
48
|
+
},
|
|
49
|
+
"client": {
|
|
50
|
+
"platform": "web",
|
|
51
|
+
"immediately": true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
package/screenshots.json
ADDED