@linxin666/dsh-remote-bridge 0.4.8 → 0.4.9
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.i18n.yaml +2 -2
- package/README.md +50 -17
- package/README.zh.md +50 -17
- package/lib/client.js +274 -253
- package/lib/client.js.map +1 -1
- package/lib/index.js +6690 -2277
- package/lib/types/client/PairEntry.d.ts +2 -2
- package/lib/types/client/PairPanel.d.ts +10 -2
- package/lib/types/client/icons.d.ts +5 -13
- package/lib/types/client/locales.d.ts +10 -14
- package/lib/types/client/semantic.d.ts +9 -5
- package/lib/types/core/commands.d.ts +59 -0
- package/lib/types/core/connection.d.ts +68 -0
- package/lib/types/core/devices.d.ts +98 -2
- package/lib/types/core/hub.d.ts +65 -15
- package/lib/types/core/liveactivity.d.ts +324 -0
- package/lib/types/core/protocol.d.ts +260 -1
- package/lib/types/core/push.d.ts +178 -0
- package/lib/types/core/questions.d.ts +61 -9
- package/lib/types/core/session-meta.d.ts +55 -1
- package/lib/types/core/squads.d.ts +130 -0
- package/lib/types/core/usage-stats.d.ts +160 -0
- package/lib/types/core/usage.d.ts +294 -0
- package/lib/types/host/apns.d.ts +151 -0
- package/lib/types/host/squads-ledger.d.ts +39 -0
- package/lib/types/host/squads.d.ts +77 -0
- package/lib/types/host/usage-stats.d.ts +75 -0
- package/lib/types/host/watchers.d.ts +88 -0
- package/lib/types/index.d.ts +18 -2
- package/package.json +13 -13
- package/src/client/PairEntry.tsx +58 -31
- package/src/client/PairPanel.tsx +181 -97
- package/src/client/icons.tsx +17 -60
- package/src/client/locales.ts +15 -23
- package/src/client/panel.module.css +239 -186
- package/src/client/semantic.ts +10 -6
- package/src/core/commands.ts +95 -0
- package/src/core/connection.ts +646 -10
- package/src/core/devices.ts +221 -3
- package/src/core/hub.ts +362 -42
- package/src/core/liveactivity.ts +833 -0
- package/src/core/protocol.ts +294 -1
- package/src/core/push.ts +354 -0
- package/src/core/questions.ts +81 -10
- package/src/core/session-meta.ts +73 -1
- package/src/core/squads.ts +345 -0
- package/src/core/usage-stats.ts +424 -0
- package/src/core/usage.ts +937 -0
- package/src/core/wire.ts +8 -0
- package/src/host/apns.ts +320 -0
- package/src/host/squads-ledger.ts +105 -0
- package/src/host/squads.ts +206 -0
- package/src/host/usage-stats.ts +155 -0
- package/src/host/watchers.ts +272 -0
- package/src/index.ts +257 -8
package/src/client/PairPanel.tsx
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The protocol v1 pairing panel
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* relay (never this machine's loopback address), and the code is one-shot.
|
|
2
|
+
* The protocol v1 pairing panel: the QR symbol, the countdown with its expiry
|
|
3
|
+
* state, the one address fact the reader must not miss, and the two actions that
|
|
4
|
+
* keep a fresh code on screen.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* The shell is the official headless `Modal` and every action is the official
|
|
7
|
+
* `Button`, so the overlay, the mask, the card, the focus trap, the Escape
|
|
8
|
+
* command and the interaction states belong to the library. This file owns the
|
|
9
|
+
* information order and the state presentation only: every state and action
|
|
10
|
+
* arrives through props, and the clock is a prop, so the expiry flip is
|
|
11
|
+
* deterministic instead of read from `Date.now()` here.
|
|
10
12
|
*/
|
|
11
|
-
import { memo } from 'react'
|
|
13
|
+
import { memo, useLayoutEffect, useRef } from 'react'
|
|
12
14
|
import { QRCodeSVG } from 'qrcode.react'
|
|
15
|
+
import {
|
|
16
|
+
Button, IconCheckOutlineRegular, IconCloseOutlineRegular, IconCopyOutlineRegular,
|
|
17
|
+
IconRefreshOutlineRegular, IconWarningOutlineRegular, Modal,
|
|
18
|
+
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
13
19
|
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
14
|
-
import {
|
|
15
|
-
|
|
20
|
+
import {
|
|
21
|
+
EXPIRED_ATTR, PART_COPY, PART_NOTICE, PART_PANEL, PART_QR, PART_REFRESH, PLUGIN_ATTR, QR_VALUE_ATTR,
|
|
22
|
+
} from './semantic.ts'
|
|
16
23
|
import css from './panel.module.css'
|
|
17
24
|
|
|
25
|
+
/** The custom property carrying the dialog's own enter keyframe name. */
|
|
26
|
+
const EXIT_NAME_VAR = '--pair-exit-name'
|
|
27
|
+
|
|
18
28
|
/** What the panel is currently showing. */
|
|
19
29
|
export type PairPanelState =
|
|
20
30
|
/** A read is in flight. */
|
|
@@ -45,9 +55,17 @@ export interface PairPanelProps {
|
|
|
45
55
|
/** This page's own `host:port`, named in the origin warning. */
|
|
46
56
|
host: string
|
|
47
57
|
copy: PairCopyState
|
|
58
|
+
/** Whether the modal is mounted at all (the entry keeps it for the leave leg). */
|
|
59
|
+
showing: boolean
|
|
60
|
+
/** Whether the leave leg is running; the card stays mounted until it ends. */
|
|
61
|
+
closing: boolean
|
|
62
|
+
/** The panel element's id, so the seat trigger can name what it expands. */
|
|
63
|
+
id: string
|
|
48
64
|
onClose(): void
|
|
65
|
+
/** The leave leg reported completion: the entry may unmount the modal now. */
|
|
66
|
+
onExited(): void
|
|
49
67
|
onRefresh(): void
|
|
50
|
-
onCopy(
|
|
68
|
+
onCopy(payload: string): void
|
|
51
69
|
}
|
|
52
70
|
|
|
53
71
|
/**
|
|
@@ -62,14 +80,9 @@ const PairQrCode = memo(function PairQrCode({ value, label }: { value: string; l
|
|
|
62
80
|
return <QRCodeSVG value={value} size={184} level="M" marginSize={1} aria-label={label} />
|
|
63
81
|
})
|
|
64
82
|
|
|
65
|
-
/**
|
|
66
|
-
function
|
|
67
|
-
return (
|
|
68
|
-
<div className={css.notice} data-dsh-part={PART_NOTICE} data-tone={tone} role={tone === 'plain' ? 'status' : 'alert'}>
|
|
69
|
-
<p className={css.noticeTitle}>{title}</p>
|
|
70
|
-
{body !== undefined && <p className={css.noticeBody}>{body}</p>}
|
|
71
|
-
</div>
|
|
72
|
-
)
|
|
83
|
+
/** The one string the panel hands out: what the symbol encodes, what copy copies. */
|
|
84
|
+
function payloadOf(state: PairPanelState): string {
|
|
85
|
+
return state.kind === 'ready' ? (state.pairingUrl ?? state.token) : ''
|
|
73
86
|
}
|
|
74
87
|
|
|
75
88
|
/**
|
|
@@ -77,107 +90,178 @@ function Notice({ tone, title, body }: { tone: 'plain' | 'warning' | 'alert'; ti
|
|
|
77
90
|
* @param props - locale seat, view state, clock, page host and actions.
|
|
78
91
|
* @returns the panel element tree.
|
|
79
92
|
*/
|
|
80
|
-
export function PairPanel({
|
|
81
|
-
|
|
82
|
-
|
|
93
|
+
export function PairPanel({
|
|
94
|
+
t, state, now, host, copy, showing, closing, id, onClose, onExited, onRefresh, onCopy,
|
|
95
|
+
}: PairPanelProps) {
|
|
96
|
+
const panel = useRef<HTMLDivElement | null>(null)
|
|
97
|
+
const ready = state.kind === 'ready'
|
|
98
|
+
const remainingMs = ready ? Math.max(0, state.expiresAt - now) : 0
|
|
99
|
+
const expired = ready && remainingMs <= 0
|
|
83
100
|
const seconds = Math.ceil(remainingMs / 1000)
|
|
84
|
-
const windowMs =
|
|
101
|
+
const windowMs = ready ? Math.max(1, state.expiresAt - state.issuedAt) : 1
|
|
85
102
|
const percent = Math.min(100, Math.max(0, Math.round((remainingMs / windowMs) * 100)))
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
103
|
+
const payload = payloadOf(state)
|
|
104
|
+
// Only a live code can be handed out. An expired one is still on screen, so
|
|
105
|
+
// its button stays put and reports that it is switched off.
|
|
106
|
+
const canCopy = !expired && payload !== ''
|
|
107
|
+
// A refusal the host raised is retried; a live or expired code is minted again.
|
|
108
|
+
const primaryLabel = state.kind === 'failed' || state.kind === 'unreachable' ? t('action.retry') : t('pair.refresh')
|
|
109
|
+
const located = ready && state.pairingUrl !== null
|
|
110
|
+
|
|
111
|
+
// The library owns the enter animation and the bundler scopes its keyframe
|
|
112
|
+
// name, so the leave leg cannot name it in CSS. Read the mounted dialog's own
|
|
113
|
+
// animation at the moment closing starts and hand it to the card: the exit
|
|
114
|
+
// then plays that exact keyframe backwards (M2, same path reversed). Clearing
|
|
115
|
+
// it on reopen is what lets the same card come back to full opacity.
|
|
116
|
+
useLayoutEffect(() => {
|
|
117
|
+
const element = panel.current
|
|
118
|
+
if (element === null) return
|
|
119
|
+
if (!closing) {
|
|
120
|
+
element.style.removeProperty(EXIT_NAME_VAR)
|
|
121
|
+
return
|
|
122
|
+
}
|
|
123
|
+
const dialog = element.parentElement
|
|
124
|
+
const enter = dialog === null ? '' : window.getComputedStyle(dialog).animationName
|
|
125
|
+
if (enter !== '' && enter !== 'none') element.style.setProperty(EXIT_NAME_VAR, enter)
|
|
126
|
+
}, [closing])
|
|
89
127
|
|
|
90
128
|
return (
|
|
91
|
-
<
|
|
92
|
-
<div className={css.mask} aria-hidden="true" onClick={onClose} />
|
|
129
|
+
<Modal open={showing} onClose={onClose} title={t('title')} headless className={css.dialog}>
|
|
93
130
|
<div
|
|
131
|
+
ref={panel}
|
|
132
|
+
id={id}
|
|
94
133
|
className={css.panel}
|
|
95
|
-
role="dialog"
|
|
96
|
-
aria-modal="true"
|
|
97
|
-
aria-label={t('title')}
|
|
98
134
|
data-dsh-plugin={PLUGIN_ATTR}
|
|
99
135
|
data-dsh-part={PART_PANEL}
|
|
136
|
+
data-closing={closing || undefined}
|
|
137
|
+
onAnimationEnd={(event) => {
|
|
138
|
+
if (closing && event.target === event.currentTarget) onExited()
|
|
139
|
+
}}
|
|
140
|
+
onTransitionEnd={(event) => {
|
|
141
|
+
if (closing && event.target === event.currentTarget && event.propertyName === 'opacity') onExited()
|
|
142
|
+
}}
|
|
100
143
|
>
|
|
101
|
-
<
|
|
144
|
+
<header className={css.header}>
|
|
102
145
|
<div className={css.heading}>
|
|
103
146
|
<h2 className={css.title}>{t('title')}</h2>
|
|
104
147
|
<p className={css.subtitle}>{t('subtitle')}</p>
|
|
105
148
|
</div>
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
)}
|
|
116
|
-
|
|
117
|
-
{state.kind === 'failed' && (
|
|
118
|
-
<Notice tone="alert" title={t('failed.title')} body={t('failed.body', { status: String(state.status) })} />
|
|
119
|
-
)}
|
|
149
|
+
<Button
|
|
150
|
+
className={css.close}
|
|
151
|
+
variant="ghost"
|
|
152
|
+
size="sm"
|
|
153
|
+
aria-label={t('action.close')}
|
|
154
|
+
icon={<IconCloseOutlineRegular />}
|
|
155
|
+
onClick={onClose}
|
|
156
|
+
/>
|
|
157
|
+
</header>
|
|
120
158
|
|
|
121
|
-
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
159
|
+
<div className={css.body}>
|
|
160
|
+
{(state.kind === 'forbidden' || state.kind === 'failed' || state.kind === 'unreachable') && (
|
|
161
|
+
<div className={css.notice} data-dsh-part={PART_NOTICE} data-tone="alert" role="alert">
|
|
162
|
+
<span className={css.noticeIcon} aria-hidden="true"><IconWarningOutlineRegular /></span>
|
|
163
|
+
<div className={css.noticeCopy}>
|
|
164
|
+
<p className={css.noticeTitle}>
|
|
165
|
+
{state.kind === 'forbidden' && t('forbidden.title')}
|
|
166
|
+
{state.kind === 'failed' && t('failed.title')}
|
|
167
|
+
{state.kind === 'unreachable' && t('unreachable.title')}
|
|
168
|
+
</p>
|
|
169
|
+
<p className={css.noticeText}>
|
|
170
|
+
{state.kind === 'forbidden' && t('forbidden.body')}
|
|
171
|
+
{state.kind === 'failed' && t('failed.body', { status: String(state.status) })}
|
|
172
|
+
{state.kind === 'unreachable' && t('unreachable.body')}
|
|
173
|
+
</p>
|
|
130
174
|
</div>
|
|
131
|
-
{expired ? (
|
|
132
|
-
<Notice tone="alert" title={t('pair.expired')} body={t('pair.expiredHint')} />
|
|
133
|
-
) : (
|
|
134
|
-
<div className={css.countdown}>
|
|
135
|
-
<span className={css.countdownText}>{t('pair.countdown', { s: String(seconds) })}</span>
|
|
136
|
-
<span className={css.bar}>
|
|
137
|
-
<span className={css.barFill} style={{ width: `${String(percent)}%` }} />
|
|
138
|
-
</span>
|
|
139
|
-
</div>
|
|
140
|
-
)}
|
|
141
175
|
</div>
|
|
176
|
+
)}
|
|
142
177
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<
|
|
146
|
-
|
|
178
|
+
{(state.kind === 'reading' || ready) && (
|
|
179
|
+
<>
|
|
180
|
+
<div className={css.qrCard}>
|
|
181
|
+
<div
|
|
182
|
+
className={css.qrSlot}
|
|
183
|
+
data-dsh-part={PART_QR}
|
|
184
|
+
{...{ [QR_VALUE_ATTR]: payload }}
|
|
185
|
+
{...{ [EXPIRED_ATTR]: expired || undefined }}
|
|
186
|
+
>
|
|
187
|
+
{ready ? (
|
|
188
|
+
<PairQrCode value={payload} label={t('pair.qrLabel')} />
|
|
189
|
+
) : (
|
|
190
|
+
<span className={css.skeleton} aria-hidden="true" />
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
193
|
+
<div className={css.status}>
|
|
194
|
+
{!ready && <p className={css.statusText}>{t('state.reading')}</p>}
|
|
195
|
+
{ready && expired && <p className={css.statusText} role="status">{t('pair.expired')}</p>}
|
|
196
|
+
{ready && !expired && (
|
|
197
|
+
<>
|
|
198
|
+
<p className={css.statusText}>{t('pair.countdown', { s: String(seconds) })}</p>
|
|
199
|
+
<span className={css.bar} aria-hidden="true">
|
|
200
|
+
<span className={css.barFill} style={{ width: `${String(percent)}%` }} />
|
|
201
|
+
</span>
|
|
202
|
+
</>
|
|
203
|
+
)}
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
147
206
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
{copy === 'copied' ? <CheckIcon /> : <CopyIcon />}
|
|
157
|
-
{copy === 'copied' ? t('action.copied') : copy === 'failed' ? t('action.copyFailed') : t('action.copy')}
|
|
158
|
-
</button>
|
|
207
|
+
<p className={css.address} data-tone={located ? 'plain' : 'warning'}>
|
|
208
|
+
{ready && located && t('origin.located', { origin: state.origin ?? '' })}
|
|
209
|
+
{ready && !located && t('origin.missing', { host })}
|
|
210
|
+
</p>
|
|
211
|
+
<p className={css.hint}>{t('pair.usedHint')}</p>
|
|
212
|
+
</>
|
|
213
|
+
)}
|
|
214
|
+
</div>
|
|
159
215
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
216
|
+
{/* The row exists only while it holds an action: a refusal offers
|
|
217
|
+
nothing to press, and copy itself needs a code to hand out. An
|
|
218
|
+
actionless row would still spend the panel's own gap. */}
|
|
219
|
+
{state.kind !== 'forbidden' && (
|
|
220
|
+
<footer className={css.actions}>
|
|
221
|
+
{ready && (
|
|
222
|
+
<Button
|
|
223
|
+
variant="outline"
|
|
224
|
+
size="sm"
|
|
225
|
+
data-dsh-part={PART_COPY}
|
|
226
|
+
disabled={!canCopy}
|
|
227
|
+
icon={copy === 'copied' ? <IconCheckOutlineRegular /> : <IconCopyOutlineRegular />}
|
|
228
|
+
onClick={() => { onCopy(payload) }}
|
|
229
|
+
>
|
|
230
|
+
<span className={css.labels}>
|
|
231
|
+
<span className={css.label} data-visible={copy === 'idle'} aria-hidden={copy !== 'idle'}>
|
|
232
|
+
{t('action.copy')}
|
|
233
|
+
</span>
|
|
234
|
+
<span className={css.label} data-visible={copy === 'copied'} aria-hidden={copy !== 'copied'}>
|
|
235
|
+
{t('action.copied')}
|
|
236
|
+
</span>
|
|
237
|
+
<span className={css.label} data-visible={copy === 'failed'} aria-hidden={copy !== 'failed'}>
|
|
238
|
+
{t('action.copyFailed')}
|
|
239
|
+
</span>
|
|
240
|
+
</span>
|
|
241
|
+
</Button>
|
|
168
242
|
)}
|
|
169
|
-
|
|
243
|
+
<Button
|
|
244
|
+
variant="primary"
|
|
245
|
+
size="sm"
|
|
246
|
+
data-dsh-part={PART_REFRESH}
|
|
247
|
+
disabled={state.kind === 'reading'}
|
|
248
|
+
icon={<IconRefreshOutlineRegular />}
|
|
249
|
+
onClick={onRefresh}
|
|
250
|
+
>
|
|
251
|
+
{primaryLabel}
|
|
252
|
+
</Button>
|
|
253
|
+
</footer>
|
|
170
254
|
)}
|
|
171
255
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
)}
|
|
256
|
+
{/* Renaming the button under the pointer is not announced: a control's
|
|
257
|
+
label is reported when focus lands on it, not when it changes. The
|
|
258
|
+
outcome is said once from this region instead, and said as nothing
|
|
259
|
+
while there is no outcome to report. */}
|
|
260
|
+
<div className={css.announce} role="status">
|
|
261
|
+
{copy === 'copied' && t('action.copied')}
|
|
262
|
+
{copy === 'failed' && t('action.copyFailed')}
|
|
179
263
|
</div>
|
|
180
264
|
</div>
|
|
181
|
-
</
|
|
265
|
+
</Modal>
|
|
182
266
|
)
|
|
183
267
|
}
|
package/src/client/icons.tsx
CHANGED
|
@@ -1,72 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* `@deepseek-ai/dsh-client-ui-primitives`
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* The pairing seat's QR glyph. It is the one icon this package draws itself
|
|
3
|
+
* (I4 exception, recorded here): the official icon set in
|
|
4
|
+
* `@deepseek-ai/dsh-client-ui-primitives` ships no QR or scan metaphor, and a
|
|
5
|
+
* text or emoji stand-in is not an icon (I1). Every other glyph this panel
|
|
6
|
+
* needs — close, copy, check, refresh, warning — comes from that set.
|
|
7
7
|
*/
|
|
8
8
|
import type { SVGProps } from 'react'
|
|
9
9
|
|
|
10
|
-
/** Shared svg attrs for the 16px stroke icon family. */
|
|
11
|
-
function iconProps(props: SVGProps<SVGSVGElement>): SVGProps<SVGSVGElement> {
|
|
12
|
-
return {
|
|
13
|
-
width: 16,
|
|
14
|
-
height: 16,
|
|
15
|
-
viewBox: '0 0 16 16',
|
|
16
|
-
fill: 'none',
|
|
17
|
-
stroke: 'currentColor',
|
|
18
|
-
strokeWidth: 1.3,
|
|
19
|
-
strokeLinecap: 'round',
|
|
20
|
-
strokeLinejoin: 'round',
|
|
21
|
-
'aria-hidden': true,
|
|
22
|
-
...props,
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
10
|
/** A QR-symbol glyph: three finder squares plus a payload dot. */
|
|
27
11
|
export function QrIcon(props: SVGProps<SVGSVGElement>) {
|
|
28
12
|
return (
|
|
29
|
-
<svg
|
|
13
|
+
<svg
|
|
14
|
+
width={16}
|
|
15
|
+
height={16}
|
|
16
|
+
viewBox="0 0 16 16"
|
|
17
|
+
fill="none"
|
|
18
|
+
stroke="currentColor"
|
|
19
|
+
strokeWidth={1.3}
|
|
20
|
+
strokeLinecap="round"
|
|
21
|
+
strokeLinejoin="round"
|
|
22
|
+
aria-hidden="true"
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
30
25
|
<path d="M2.5 2.5h4v4h-4zM9.5 2.5h4v4h-4zM2.5 9.5h4v4h-4z" />
|
|
31
26
|
<path d="M9.5 9.5h1.6v1.6H9.5zM12.4 9.5h1.1M9.5 12.4v1.1M12 13.5h1.5v-1.5h-1.5z" />
|
|
32
27
|
</svg>
|
|
33
28
|
)
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
/** Copy glyph. */
|
|
37
|
-
export function CopyIcon(props: SVGProps<SVGSVGElement>) {
|
|
38
|
-
return (
|
|
39
|
-
<svg {...iconProps(props)}>
|
|
40
|
-
<rect x="5.5" y="5.5" width="9" height="9" rx="1.5" />
|
|
41
|
-
<path d="M2.5 10.5v-7A1.5 1.5 0 0 1 4 2h5.5" />
|
|
42
|
-
</svg>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Check glyph for the transient copied state. */
|
|
47
|
-
export function CheckIcon(props: SVGProps<SVGSVGElement>) {
|
|
48
|
-
return (
|
|
49
|
-
<svg {...iconProps(props)}>
|
|
50
|
-
<path d="M3 8.5 6.5 12l6.5-8" />
|
|
51
|
-
</svg>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Close glyph for the panel header. */
|
|
56
|
-
export function CloseIcon(props: SVGProps<SVGSVGElement>) {
|
|
57
|
-
return (
|
|
58
|
-
<svg {...iconProps(props)}>
|
|
59
|
-
<path d="M4 4l8 8M12 4l-8 8" />
|
|
60
|
-
</svg>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Refresh glyph for the mint-again action. */
|
|
65
|
-
export function RefreshIcon(props: SVGProps<SVGSVGElement>) {
|
|
66
|
-
return (
|
|
67
|
-
<svg {...iconProps(props)}>
|
|
68
|
-
<path d="M13 8a5 5 0 1 1-1.8-3.85" />
|
|
69
|
-
<path d="M13.2 2.4V5.6H10" />
|
|
70
|
-
</svg>
|
|
71
|
-
)
|
|
72
|
-
}
|
package/src/client/locales.ts
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `remote-bridge` namespace dictionaries: the protocol v1 pairing panel copy.
|
|
3
3
|
*
|
|
4
|
-
* The panel has one job —
|
|
5
|
-
* QR symbol
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* The panel has one job — put the live one-shot code in front of the operator as
|
|
5
|
+
* a QR symbol — so the copy carries exactly four things: what to do with the
|
|
6
|
+
* symbol, how long it lives, which address the phone will actually dial, and why
|
|
7
|
+
* the code is single-use. No key states how the host finds its public address:
|
|
8
|
+
* that is an implementation fact the reader cannot act on.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
12
12
|
export const zh = {
|
|
13
13
|
'entry.label': '配对手机(协议 v1)',
|
|
14
14
|
'title': '协议 v1 配对',
|
|
15
|
-
'subtitle': '用手机 App
|
|
15
|
+
'subtitle': '用手机 App 扫描二维码,即可让手机以协议 v1 连上这台宿主。配对码由本机签发,只在本机显示。',
|
|
16
16
|
'state.reading': '正在取配对码…',
|
|
17
17
|
'pair.qrLabel': '配对二维码',
|
|
18
|
-
'pair.payloadLabel': '二维码内容(可复制后粘贴到手机)',
|
|
19
18
|
'pair.countdown': '剩余 {s} 秒',
|
|
20
|
-
'pair.expired': '
|
|
21
|
-
'pair.expiredHint': '过期的配对码不会被手机接受,请重新取码。',
|
|
22
|
-
'pair.usedHint': '配对码一次性:手机调用 pair.begin 的瞬间即作废,重新取码也会作废上一张。',
|
|
19
|
+
'pair.expired': '配对码已过期',
|
|
23
20
|
'pair.refresh': '重新取码',
|
|
24
|
-
'
|
|
25
|
-
'origin.
|
|
26
|
-
'origin.
|
|
27
|
-
'origin.located.body': '二维码里已经带上 {origin}:手机扫一次就同时设好连接地址与配对码,不需要手填任何东西。',
|
|
21
|
+
'pair.usedHint': '配对码一次性有效:手机一开始配对即作废,重新取码也会作废上一张。',
|
|
22
|
+
'origin.located': '手机将连到 {origin}',
|
|
23
|
+
'origin.missing': '没有找到公网地址:请先在手机里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。',
|
|
28
24
|
'forbidden.title': '这个页面不是从本机打开的',
|
|
29
25
|
'forbidden.body': '配对码只能在本机 Web UI 上取。请在本机浏览器打开 http://127.0.0.1:<端口> 后重试。',
|
|
30
26
|
'failed.title': '取配对码失败',
|
|
@@ -42,19 +38,15 @@ export const zh = {
|
|
|
42
38
|
export const en: Record<RemoteBridgeKey, string> = {
|
|
43
39
|
'entry.label': 'Pair a phone (protocol v1)',
|
|
44
40
|
'title': 'Protocol v1 pairing',
|
|
45
|
-
'subtitle': 'Scan the QR code with the phone app to
|
|
41
|
+
'subtitle': 'Scan the QR code with the phone app to let the phone reach this host over protocol v1. The code is minted by this machine and shown only here.',
|
|
46
42
|
'state.reading': 'Requesting a pairing code…',
|
|
47
43
|
'pair.qrLabel': 'Pairing QR code',
|
|
48
|
-
'pair.payloadLabel': 'What the QR encodes (copy it to paste on the phone)',
|
|
49
44
|
'pair.countdown': '{s} s left',
|
|
50
|
-
'pair.expired': 'The pairing code expired
|
|
51
|
-
'pair.expiredHint': 'An expired code is never accepted; request a new one.',
|
|
52
|
-
'pair.usedHint': 'The code is single-use: the phone spends it the moment it calls pair.begin, and requesting a new one voids the previous code.',
|
|
45
|
+
'pair.expired': 'The pairing code expired',
|
|
53
46
|
'pair.refresh': 'New code',
|
|
54
|
-
'
|
|
55
|
-
'origin.
|
|
56
|
-
'origin.
|
|
57
|
-
'origin.located.body': 'The QR carries {origin}: one scan sets both the connection address and the pairing code, with nothing to type.',
|
|
47
|
+
'pair.usedHint': 'The code is single-use: pairing spends it, and a new code voids the previous one.',
|
|
48
|
+
'origin.located': 'The phone will dial {origin}',
|
|
49
|
+
'origin.missing': 'No public address found: set the phone app to your public relay first, then scan. {host} (this page) is reachable only from this machine.',
|
|
58
50
|
'forbidden.title': 'This page is not open on this machine',
|
|
59
51
|
'forbidden.body': 'Pairing codes can only be read from the machine itself. Open http://127.0.0.1:<port> in a browser on this machine and retry.',
|
|
60
52
|
'failed.title': 'Could not read a pairing code',
|