@limrun/ui 0.8.0 → 0.9.0-rc.1
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 +9 -0
- package/dist/components/device-install/device-install-dialog.d.ts +5 -0
- package/dist/components/device-install/index.d.ts +2 -0
- package/dist/core/device-install/apple/client.d.ts +16 -0
- package/dist/core/device-install/apple/crypto.d.ts +20 -0
- package/dist/core/device-install/apple/gsa-srp.d.ts +26 -0
- package/dist/core/device-install/apple/index.d.ts +5 -0
- package/dist/core/device-install/apple/provisioning.d.ts +150 -0
- package/dist/core/device-install/apple/relay.d.ts +33 -0
- package/dist/core/device-install/index.d.ts +4 -0
- package/dist/core/device-install/operations/index.d.ts +6 -0
- package/dist/core/device-install/operations/limbuild-client.d.ts +28 -0
- package/dist/core/device-install/operations/operations.d.ts +32 -0
- package/dist/core/device-install/operations/relay-client.d.ts +25 -0
- package/dist/core/device-install/operations/relay-protocol.d.ts +27 -0
- package/dist/core/device-install/operations/usbmux.d.ts +32 -0
- package/dist/core/device-install/operations/webusb.d.ts +21 -0
- package/dist/core/device-install/storage/browser-storage.d.ts +25 -0
- package/dist/core/device-install/storage/index.d.ts +1 -0
- package/dist/core/device-install/types.d.ts +48 -0
- package/dist/device-install/index.cjs +9 -0
- package/dist/device-install/index.d.ts +3 -0
- package/dist/device-install/index.js +212 -0
- package/dist/device-install/react.cjs +1 -0
- package/dist/device-install/react.d.ts +1 -0
- package/dist/device-install/react.js +4 -0
- package/dist/device-install-dialog-CTwVViYY.js +2 -0
- package/dist/device-install-dialog-zzKJu7SM.mjs +328 -0
- package/dist/device-install-dialog.css +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-device-install.d.ts +55 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +401 -408
- package/dist/use-device-install-CgrOKKyi.mjs +13042 -0
- package/dist/use-device-install-DDKRf6IL.js +23 -0
- package/package.json +15 -2
- package/src/components/device-install/device-install-dialog.css +244 -0
- package/src/components/device-install/device-install-dialog.tsx +363 -0
- package/src/components/device-install/index.ts +2 -0
- package/src/core/device-install/apple/client.ts +64 -0
- package/src/core/device-install/apple/crypto.ts +202 -0
- package/src/core/device-install/apple/gsa-srp.ts +127 -0
- package/src/core/device-install/apple/index.ts +5 -0
- package/src/core/device-install/apple/provisioning.ts +255 -0
- package/src/core/device-install/apple/relay.ts +305 -0
- package/src/core/device-install/index.ts +4 -0
- package/src/core/device-install/operations/index.ts +6 -0
- package/src/core/device-install/operations/limbuild-client.ts +104 -0
- package/src/core/device-install/operations/operations.ts +217 -0
- package/src/core/device-install/operations/relay-client.ts +255 -0
- package/src/core/device-install/operations/relay-protocol.ts +71 -0
- package/src/core/device-install/operations/usbmux.ts +270 -0
- package/src/core/device-install/operations/webusb-dom.d.ts +54 -0
- package/src/core/device-install/operations/webusb.ts +105 -0
- package/src/core/device-install/storage/browser-storage.ts +238 -0
- package/src/core/device-install/storage/index.ts +1 -0
- package/src/core/device-install/types.ts +65 -0
- package/src/device-install/index.ts +3 -0
- package/src/device-install/react.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-device-install.ts +522 -0
- package/src/index.ts +2 -0
- package/vite.config.ts +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limrun/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-rc.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -13,6 +13,16 @@
|
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
14
|
"require": "./dist/index.cjs"
|
|
15
15
|
},
|
|
16
|
+
"./device-install": {
|
|
17
|
+
"types": "./dist/device-install/index.d.ts",
|
|
18
|
+
"import": "./dist/device-install/index.js",
|
|
19
|
+
"require": "./dist/device-install/index.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./device-install/react": {
|
|
22
|
+
"types": "./dist/device-install/react.d.ts",
|
|
23
|
+
"import": "./dist/device-install/react.js",
|
|
24
|
+
"require": "./dist/device-install/react.cjs"
|
|
25
|
+
},
|
|
16
26
|
"./package.json": "./package.json"
|
|
17
27
|
},
|
|
18
28
|
"scripts": {
|
|
@@ -29,6 +39,7 @@
|
|
|
29
39
|
},
|
|
30
40
|
"license": "MIT",
|
|
31
41
|
"devDependencies": {
|
|
42
|
+
"@types/node-forge": "^1.3.14",
|
|
32
43
|
"@types/react": "^19.1.12",
|
|
33
44
|
"@types/react-dom": "^19.1.9",
|
|
34
45
|
"@vitejs/plugin-react-swc": "^4.0.1",
|
|
@@ -40,6 +51,8 @@
|
|
|
40
51
|
"vite-plugin-lib-inject-css": "^2.2.2"
|
|
41
52
|
},
|
|
42
53
|
"dependencies": {
|
|
43
|
-
"
|
|
54
|
+
"@foxt/js-srp": "^0.0.3-patch2",
|
|
55
|
+
"clsx": "^2.1.1",
|
|
56
|
+
"node-forge": "^1.4.0"
|
|
44
57
|
}
|
|
45
58
|
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
.lr-device-install {
|
|
2
|
+
font-family:
|
|
3
|
+
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lr-device-install__trigger,
|
|
7
|
+
.lr-device-install__primary,
|
|
8
|
+
.lr-device-install__secondary,
|
|
9
|
+
.lr-device-install__icon-button {
|
|
10
|
+
border: 1px solid #d1d5db;
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
font: inherit;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.lr-device-install__trigger,
|
|
17
|
+
.lr-device-install__primary {
|
|
18
|
+
background: #111827;
|
|
19
|
+
color: #ffffff;
|
|
20
|
+
padding: 8px 12px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.lr-device-install__secondary,
|
|
24
|
+
.lr-device-install__icon-button {
|
|
25
|
+
background: #ffffff;
|
|
26
|
+
color: #111827;
|
|
27
|
+
padding: 8px 12px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.lr-device-install__trigger:disabled,
|
|
31
|
+
.lr-device-install__primary:disabled,
|
|
32
|
+
.lr-device-install__secondary:disabled {
|
|
33
|
+
cursor: not-allowed;
|
|
34
|
+
opacity: 0.55;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.lr-device-install__backdrop {
|
|
38
|
+
align-items: center;
|
|
39
|
+
background: rgb(17 24 39 / 0.55);
|
|
40
|
+
display: flex;
|
|
41
|
+
inset: 0;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
padding: 24px;
|
|
44
|
+
position: fixed;
|
|
45
|
+
z-index: 50;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.lr-device-install__dialog {
|
|
49
|
+
background: #ffffff;
|
|
50
|
+
border-radius: 16px;
|
|
51
|
+
box-shadow: 0 24px 80px rgb(15 23 42 / 0.28);
|
|
52
|
+
color: #111827;
|
|
53
|
+
max-height: min(90vh, 900px);
|
|
54
|
+
max-width: 880px;
|
|
55
|
+
overflow: auto;
|
|
56
|
+
padding: 24px;
|
|
57
|
+
width: 100%;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.lr-device-install__header {
|
|
61
|
+
align-items: flex-start;
|
|
62
|
+
display: flex;
|
|
63
|
+
gap: 16px;
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
margin-bottom: 18px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.lr-device-install__header h2,
|
|
69
|
+
.lr-device-install__step h3,
|
|
70
|
+
.lr-device-install__logs h3 {
|
|
71
|
+
margin: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.lr-device-install__header p,
|
|
75
|
+
.lr-device-install__step p,
|
|
76
|
+
.lr-device-install__logs {
|
|
77
|
+
color: #4b5563;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.lr-device-install__error {
|
|
81
|
+
background: #fef2f2;
|
|
82
|
+
border: 1px solid #fecaca;
|
|
83
|
+
border-radius: 10px;
|
|
84
|
+
color: #991b1b;
|
|
85
|
+
margin-bottom: 14px;
|
|
86
|
+
padding: 10px 12px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.lr-device-install__steps {
|
|
90
|
+
display: grid;
|
|
91
|
+
gap: 12px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.lr-device-install__step {
|
|
95
|
+
border: 1px solid #e5e7eb;
|
|
96
|
+
border-radius: 12px;
|
|
97
|
+
padding: 14px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.lr-device-install__step--active {
|
|
101
|
+
border-color: #111827;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.lr-device-install__step-header {
|
|
105
|
+
align-items: flex-start;
|
|
106
|
+
display: grid;
|
|
107
|
+
gap: 12px;
|
|
108
|
+
grid-template-columns: auto 1fr auto;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.lr-device-install__step-number {
|
|
112
|
+
align-items: center;
|
|
113
|
+
background: #111827;
|
|
114
|
+
border-radius: 999px;
|
|
115
|
+
color: #ffffff;
|
|
116
|
+
display: flex;
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
font-weight: 700;
|
|
119
|
+
height: 28px;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
width: 28px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.lr-device-install__status {
|
|
125
|
+
border-radius: 999px;
|
|
126
|
+
font-size: 12px;
|
|
127
|
+
padding: 3px 8px;
|
|
128
|
+
text-transform: capitalize;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.lr-device-install__status--idle {
|
|
132
|
+
background: #f3f4f6;
|
|
133
|
+
color: #4b5563;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.lr-device-install__status--active {
|
|
137
|
+
background: #dbeafe;
|
|
138
|
+
color: #1d4ed8;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.lr-device-install__status--complete {
|
|
142
|
+
background: #dcfce7;
|
|
143
|
+
color: #166534;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.lr-device-install__status--error {
|
|
147
|
+
background: #fee2e2;
|
|
148
|
+
color: #991b1b;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.lr-device-install__step-body {
|
|
152
|
+
display: grid;
|
|
153
|
+
gap: 12px;
|
|
154
|
+
margin-top: 12px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.lr-device-install__grid {
|
|
158
|
+
display: grid;
|
|
159
|
+
gap: 10px;
|
|
160
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.lr-device-install__field {
|
|
164
|
+
display: grid;
|
|
165
|
+
gap: 6px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.lr-device-install__field span {
|
|
169
|
+
color: #374151;
|
|
170
|
+
font-size: 13px;
|
|
171
|
+
font-weight: 600;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.lr-device-install__field input {
|
|
175
|
+
border: 1px solid #d1d5db;
|
|
176
|
+
border-radius: 8px;
|
|
177
|
+
font: inherit;
|
|
178
|
+
padding: 8px 10px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.lr-device-install__build-logs {
|
|
182
|
+
border: 1px solid #e5e7eb;
|
|
183
|
+
border-radius: 10px;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.lr-device-install__build-logs summary {
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
font-weight: 600;
|
|
190
|
+
padding: 10px 12px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.lr-device-install__build-logs pre {
|
|
194
|
+
background: #0f172a;
|
|
195
|
+
color: #e5e7eb;
|
|
196
|
+
margin: 0;
|
|
197
|
+
max-height: 240px;
|
|
198
|
+
overflow: auto;
|
|
199
|
+
padding: 12px;
|
|
200
|
+
white-space: pre-wrap;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.lr-device-install__device {
|
|
204
|
+
background: #f9fafb;
|
|
205
|
+
border: 1px solid #e5e7eb;
|
|
206
|
+
border-radius: 10px;
|
|
207
|
+
padding: 10px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.lr-device-install__logs {
|
|
211
|
+
border-top: 1px solid #e5e7eb;
|
|
212
|
+
margin-top: 18px;
|
|
213
|
+
padding-top: 14px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.lr-device-install__logs ol {
|
|
217
|
+
display: grid;
|
|
218
|
+
gap: 6px;
|
|
219
|
+
list-style: none;
|
|
220
|
+
margin: 8px 0 0;
|
|
221
|
+
max-height: 160px;
|
|
222
|
+
overflow: auto;
|
|
223
|
+
padding: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.lr-device-install__logs li {
|
|
227
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
|
|
228
|
+
font-size: 12px;
|
|
229
|
+
white-space: pre-wrap;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@media (max-width: 760px) {
|
|
233
|
+
.lr-device-install__grid {
|
|
234
|
+
grid-template-columns: 1fr;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.lr-device-install__step-header {
|
|
238
|
+
grid-template-columns: auto 1fr;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.lr-device-install__status {
|
|
242
|
+
grid-column: 2;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { useId, useState, type ChangeEvent, type ReactNode } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { useDeviceInstall, type UseDeviceInstallOptions } from '../../hooks/use-device-install';
|
|
4
|
+
import type { DeviceInstallStep, DeviceInstallStepStatus } from '../../core/device-install';
|
|
5
|
+
import './device-install-dialog.css';
|
|
6
|
+
|
|
7
|
+
export type DeviceInstallDialogProps = UseDeviceInstallOptions & {
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const steps: Array<{ id: DeviceInstallStep; title: string; description: string }> = [
|
|
12
|
+
{
|
|
13
|
+
id: 'build',
|
|
14
|
+
title: 'Start a device build',
|
|
15
|
+
description: 'Upload signing assets if needed, then follow the live build logs until the device build succeeds.',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 'usb',
|
|
19
|
+
title: 'Access USB procedures',
|
|
20
|
+
description: 'Allow WebUSB access to the connected iPhone from a Chromium browser on a secure origin.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'pair',
|
|
24
|
+
title: 'Pair with this browser',
|
|
25
|
+
description: 'Pair once and store the pair record locally so future installs can reuse it.',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'install',
|
|
29
|
+
title: 'Start installation',
|
|
30
|
+
description: 'Relay the last successful device build to the paired iPhone.',
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export function DeviceInstallDialog({
|
|
35
|
+
disabled,
|
|
36
|
+
...hookOptions
|
|
37
|
+
}: DeviceInstallDialogProps) {
|
|
38
|
+
const [open, setOpen] = useState(false);
|
|
39
|
+
const [appleAccountName, setAppleAccountName] = useState('');
|
|
40
|
+
const [applePassword, setApplePassword] = useState('');
|
|
41
|
+
const [appleTwoFactorCode, setAppleTwoFactorCode] = useState('');
|
|
42
|
+
const dialogTitleId = useId();
|
|
43
|
+
const deviceInstall = useDeviceInstall(hookOptions);
|
|
44
|
+
|
|
45
|
+
const updateSigningFiles = (field: 'certificateFile' | 'provisioningProfileFile', event: ChangeEvent<HTMLInputElement>) => {
|
|
46
|
+
deviceInstall.setSigningFiles({
|
|
47
|
+
[field]: event.currentTarget.files?.[0],
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className="lr-device-install">
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
className="lr-device-install__trigger"
|
|
56
|
+
disabled={disabled || !hookOptions.apiUrl}
|
|
57
|
+
onClick={() => setOpen(true)}
|
|
58
|
+
>
|
|
59
|
+
Install to iPhone
|
|
60
|
+
</button>
|
|
61
|
+
|
|
62
|
+
{open && (
|
|
63
|
+
<div className="lr-device-install__backdrop" role="presentation">
|
|
64
|
+
<section
|
|
65
|
+
aria-labelledby={dialogTitleId}
|
|
66
|
+
aria-modal="true"
|
|
67
|
+
className="lr-device-install__dialog"
|
|
68
|
+
role="dialog"
|
|
69
|
+
>
|
|
70
|
+
<header className="lr-device-install__header">
|
|
71
|
+
<div>
|
|
72
|
+
<h2 id={dialogTitleId}>Install to a real iPhone</h2>
|
|
73
|
+
<p>Follow each step to build, authorize USB, pair, and install from this browser.</p>
|
|
74
|
+
</div>
|
|
75
|
+
<button type="button" className="lr-device-install__icon-button" onClick={() => setOpen(false)}>
|
|
76
|
+
Close
|
|
77
|
+
</button>
|
|
78
|
+
</header>
|
|
79
|
+
|
|
80
|
+
{deviceInstall.error && <div className="lr-device-install__error">{deviceInstall.error}</div>}
|
|
81
|
+
|
|
82
|
+
<div className="lr-device-install__steps">
|
|
83
|
+
{steps.map((step, index) => (
|
|
84
|
+
<StepCard
|
|
85
|
+
key={step.id}
|
|
86
|
+
index={index + 1}
|
|
87
|
+
step={step}
|
|
88
|
+
active={deviceInstall.currentStep === step.id}
|
|
89
|
+
status={deviceInstall.stepStatuses[step.id]}
|
|
90
|
+
>
|
|
91
|
+
{step.id === 'build' && (
|
|
92
|
+
<div className="lr-device-install__step-body">
|
|
93
|
+
<div className="lr-device-install__grid">
|
|
94
|
+
<label className="lr-device-install__field">
|
|
95
|
+
<span>Apple ID</span>
|
|
96
|
+
<input
|
|
97
|
+
type="email"
|
|
98
|
+
autoComplete="username"
|
|
99
|
+
placeholder="name@example.com"
|
|
100
|
+
value={appleAccountName}
|
|
101
|
+
onChange={(event) => setAppleAccountName(event.currentTarget.value)}
|
|
102
|
+
/>
|
|
103
|
+
</label>
|
|
104
|
+
<label className="lr-device-install__field">
|
|
105
|
+
<span>Apple ID password</span>
|
|
106
|
+
<input
|
|
107
|
+
type="password"
|
|
108
|
+
autoComplete="current-password"
|
|
109
|
+
placeholder="Password stays in this browser"
|
|
110
|
+
value={applePassword}
|
|
111
|
+
onChange={(event) => setApplePassword(event.currentTarget.value)}
|
|
112
|
+
/>
|
|
113
|
+
</label>
|
|
114
|
+
<label className="lr-device-install__field">
|
|
115
|
+
<span>Generated .p12 password</span>
|
|
116
|
+
<input
|
|
117
|
+
type="password"
|
|
118
|
+
placeholder="Used when exporting Apple certificate"
|
|
119
|
+
onChange={(event) =>
|
|
120
|
+
deviceInstall.setSigningFiles({ certificatePassword: event.currentTarget.value })
|
|
121
|
+
}
|
|
122
|
+
/>
|
|
123
|
+
</label>
|
|
124
|
+
</div>
|
|
125
|
+
<div className="lr-device-install__actions">
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
className="lr-device-install__secondary"
|
|
129
|
+
disabled={
|
|
130
|
+
disabled ||
|
|
131
|
+
!hookOptions.apiUrl ||
|
|
132
|
+
!appleAccountName ||
|
|
133
|
+
!applePassword ||
|
|
134
|
+
deviceInstall.busyAction === 'build'
|
|
135
|
+
}
|
|
136
|
+
onClick={() =>
|
|
137
|
+
void deviceInstall.startAppleIDLogin({
|
|
138
|
+
accountName: appleAccountName,
|
|
139
|
+
password: applePassword,
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
>
|
|
143
|
+
{deviceInstall.appleSigningStatus === 'authenticating'
|
|
144
|
+
? 'Signing in...'
|
|
145
|
+
: 'Sign in with Apple ID'}
|
|
146
|
+
</button>
|
|
147
|
+
<span className="lr-device-install__hint">
|
|
148
|
+
Apple password is used only by browser-side SRP. Status: {deviceInstall.appleSigningStatus}
|
|
149
|
+
</span>
|
|
150
|
+
</div>
|
|
151
|
+
{deviceInstall.appleSigningStatus === 'two-factor-required' && (
|
|
152
|
+
<div className="lr-device-install__grid">
|
|
153
|
+
<label className="lr-device-install__field">
|
|
154
|
+
<span>Two-factor code</span>
|
|
155
|
+
<input
|
|
156
|
+
type="text"
|
|
157
|
+
inputMode="numeric"
|
|
158
|
+
autoComplete="one-time-code"
|
|
159
|
+
value={appleTwoFactorCode}
|
|
160
|
+
onChange={(event) => setAppleTwoFactorCode(event.currentTarget.value)}
|
|
161
|
+
/>
|
|
162
|
+
</label>
|
|
163
|
+
<button
|
|
164
|
+
type="button"
|
|
165
|
+
className="lr-device-install__secondary"
|
|
166
|
+
disabled={!appleTwoFactorCode || deviceInstall.busyAction === 'build'}
|
|
167
|
+
onClick={() => void deviceInstall.submitAppleTwoFactorCode(appleTwoFactorCode)}
|
|
168
|
+
>
|
|
169
|
+
Submit Apple ID code
|
|
170
|
+
</button>
|
|
171
|
+
</div>
|
|
172
|
+
)}
|
|
173
|
+
{deviceInstall.appleTeams.length > 0 && (
|
|
174
|
+
<label className="lr-device-install__field">
|
|
175
|
+
<span>Apple Developer team</span>
|
|
176
|
+
<select
|
|
177
|
+
value={deviceInstall.selectedAppleTeamID ?? ''}
|
|
178
|
+
onChange={(event) =>
|
|
179
|
+
deviceInstall.setSelectedAppleTeamID(event.currentTarget.value || undefined)
|
|
180
|
+
}
|
|
181
|
+
>
|
|
182
|
+
{deviceInstall.appleTeams.map((team, index) => {
|
|
183
|
+
const teamID =
|
|
184
|
+
team.teamId ??
|
|
185
|
+
(team.providerId === undefined ? undefined : String(team.providerId)) ??
|
|
186
|
+
team.publicProviderId ??
|
|
187
|
+
'';
|
|
188
|
+
return (
|
|
189
|
+
<option key={`${teamID}-${index}`} value={teamID}>
|
|
190
|
+
{team.name ?? 'Apple Developer Team'} {teamID ? `(${teamID})` : ''}
|
|
191
|
+
</option>
|
|
192
|
+
);
|
|
193
|
+
})}
|
|
194
|
+
</select>
|
|
195
|
+
</label>
|
|
196
|
+
)}
|
|
197
|
+
<div className="lr-device-install__grid">
|
|
198
|
+
<label className="lr-device-install__field">
|
|
199
|
+
<span>Certificate (.p12)</span>
|
|
200
|
+
<input
|
|
201
|
+
type="file"
|
|
202
|
+
accept=".p12,application/x-pkcs12"
|
|
203
|
+
onChange={(event) => updateSigningFiles('certificateFile', event)}
|
|
204
|
+
/>
|
|
205
|
+
</label>
|
|
206
|
+
<label className="lr-device-install__field">
|
|
207
|
+
<span>Provisioning profile</span>
|
|
208
|
+
<input
|
|
209
|
+
type="file"
|
|
210
|
+
accept=".mobileprovision"
|
|
211
|
+
onChange={(event) => updateSigningFiles('provisioningProfileFile', event)}
|
|
212
|
+
/>
|
|
213
|
+
</label>
|
|
214
|
+
<label className="lr-device-install__field">
|
|
215
|
+
<span>Uploaded .p12 password</span>
|
|
216
|
+
<input
|
|
217
|
+
type="password"
|
|
218
|
+
placeholder="Export password"
|
|
219
|
+
onChange={(event) =>
|
|
220
|
+
deviceInstall.setSigningFiles({ certificatePassword: event.currentTarget.value })
|
|
221
|
+
}
|
|
222
|
+
/>
|
|
223
|
+
</label>
|
|
224
|
+
</div>
|
|
225
|
+
<button
|
|
226
|
+
type="button"
|
|
227
|
+
className="lr-device-install__primary"
|
|
228
|
+
disabled={disabled || !deviceInstall.canBuild}
|
|
229
|
+
onClick={() => void deviceInstall.startDeviceBuild()}
|
|
230
|
+
>
|
|
231
|
+
{deviceInstall.busyAction === 'build' ? 'Starting build...' : 'Start device build'}
|
|
232
|
+
</button>
|
|
233
|
+
<details
|
|
234
|
+
className="lr-device-install__build-logs"
|
|
235
|
+
open={deviceInstall.buildLogPanelOpen}
|
|
236
|
+
onToggle={(event) => deviceInstall.setBuildLogPanelOpen(event.currentTarget.open)}
|
|
237
|
+
>
|
|
238
|
+
<summary>Build logs ({deviceInstall.buildStatus})</summary>
|
|
239
|
+
<pre>
|
|
240
|
+
{deviceInstall.buildLogs.length > 0
|
|
241
|
+
? deviceInstall.buildLogs
|
|
242
|
+
.filter((line) => line.type !== 'meta')
|
|
243
|
+
.map((line) => line.data)
|
|
244
|
+
.join('\n')
|
|
245
|
+
: 'Build logs will appear here while the device build is running.'}
|
|
246
|
+
</pre>
|
|
247
|
+
</details>
|
|
248
|
+
</div>
|
|
249
|
+
)}
|
|
250
|
+
|
|
251
|
+
{step.id === 'usb' && (
|
|
252
|
+
<div className="lr-device-install__step-body">
|
|
253
|
+
<p>
|
|
254
|
+
WebUSB works in Chromium browsers on secure origins. Connect the iPhone over USB and approve
|
|
255
|
+
the browser permission prompt.
|
|
256
|
+
</p>
|
|
257
|
+
<button
|
|
258
|
+
type="button"
|
|
259
|
+
className="lr-device-install__primary"
|
|
260
|
+
disabled={disabled || !deviceInstall.canRequestUSBAccess}
|
|
261
|
+
onClick={() => void deviceInstall.requestUSBAccess()}
|
|
262
|
+
>
|
|
263
|
+
{deviceInstall.busyAction === 'usb' ? 'Selecting iPhone...' : 'Allow USB access'}
|
|
264
|
+
</button>
|
|
265
|
+
{deviceInstall.device && (
|
|
266
|
+
<div className="lr-device-install__device">
|
|
267
|
+
{`${deviceInstall.device.productName ?? 'iPhone'} ${
|
|
268
|
+
deviceInstall.device.serialNumber ?? ''
|
|
269
|
+
}`.trim()}
|
|
270
|
+
</div>
|
|
271
|
+
)}
|
|
272
|
+
</div>
|
|
273
|
+
)}
|
|
274
|
+
|
|
275
|
+
{step.id === 'pair' && (
|
|
276
|
+
<div className="lr-device-install__step-body">
|
|
277
|
+
{deviceInstall.pairConfirmationRequired && (
|
|
278
|
+
<p>
|
|
279
|
+
Unlock the iPhone and tap <strong>Trust</strong> in the system dialog, then confirm the pair
|
|
280
|
+
record.
|
|
281
|
+
</p>
|
|
282
|
+
)}
|
|
283
|
+
<button
|
|
284
|
+
type="button"
|
|
285
|
+
className="lr-device-install__primary"
|
|
286
|
+
disabled={disabled || !deviceInstall.canPairBrowser}
|
|
287
|
+
onClick={() => void deviceInstall.pairBrowser()}
|
|
288
|
+
>
|
|
289
|
+
{deviceInstall.busyAction === 'pair'
|
|
290
|
+
? 'Pairing...'
|
|
291
|
+
: deviceInstall.pairConfirmationRequired
|
|
292
|
+
? 'Confirm pair record'
|
|
293
|
+
: 'Pair browser'}
|
|
294
|
+
</button>
|
|
295
|
+
<p>
|
|
296
|
+
{deviceInstall.hasPairRecord
|
|
297
|
+
? 'Pair record is stored locally. Installation is available.'
|
|
298
|
+
: 'Pair this browser once before installing.'}
|
|
299
|
+
</p>
|
|
300
|
+
</div>
|
|
301
|
+
)}
|
|
302
|
+
|
|
303
|
+
{step.id === 'install' && (
|
|
304
|
+
<div className="lr-device-install__step-body">
|
|
305
|
+
<button
|
|
306
|
+
type="button"
|
|
307
|
+
className="lr-device-install__primary"
|
|
308
|
+
disabled={disabled || !deviceInstall.canInstall}
|
|
309
|
+
onClick={() => void deviceInstall.startInstallation()}
|
|
310
|
+
>
|
|
311
|
+
{deviceInstall.busyAction === 'install' ? 'Installing...' : 'Install last build'}
|
|
312
|
+
</button>
|
|
313
|
+
<button type="button" className="lr-device-install__secondary" onClick={deviceInstall.stopRelay}>
|
|
314
|
+
Stop relay
|
|
315
|
+
</button>
|
|
316
|
+
</div>
|
|
317
|
+
)}
|
|
318
|
+
</StepCard>
|
|
319
|
+
))}
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<footer className="lr-device-install__logs">
|
|
323
|
+
<h3>Progress</h3>
|
|
324
|
+
<ol>
|
|
325
|
+
{deviceInstall.logs.map((entry, index) => (
|
|
326
|
+
<li key={`${index}-${entry.slice(0, 24)}`}>{entry}</li>
|
|
327
|
+
))}
|
|
328
|
+
</ol>
|
|
329
|
+
</footer>
|
|
330
|
+
</section>
|
|
331
|
+
</div>
|
|
332
|
+
)}
|
|
333
|
+
</div>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function StepCard({
|
|
338
|
+
index,
|
|
339
|
+
step,
|
|
340
|
+
active,
|
|
341
|
+
status,
|
|
342
|
+
children,
|
|
343
|
+
}: {
|
|
344
|
+
index: number;
|
|
345
|
+
step: { id: DeviceInstallStep; title: string; description: string };
|
|
346
|
+
active: boolean;
|
|
347
|
+
status: DeviceInstallStepStatus;
|
|
348
|
+
children: ReactNode;
|
|
349
|
+
}) {
|
|
350
|
+
return (
|
|
351
|
+
<article className={clsx('lr-device-install__step', active && 'lr-device-install__step--active')}>
|
|
352
|
+
<div className="lr-device-install__step-header">
|
|
353
|
+
<div className="lr-device-install__step-number">{index}</div>
|
|
354
|
+
<div>
|
|
355
|
+
<h3>{step.title}</h3>
|
|
356
|
+
<p>{step.description}</p>
|
|
357
|
+
</div>
|
|
358
|
+
<span className={clsx('lr-device-install__status', `lr-device-install__status--${status}`)}>{status}</span>
|
|
359
|
+
</div>
|
|
360
|
+
{children}
|
|
361
|
+
</article>
|
|
362
|
+
);
|
|
363
|
+
}
|