create-disposabl-app 0.11.0 → 0.13.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/dist/disposabl.js +14 -10
- package/dist/index.js +40 -2
- package/dist/templates/default/.github/scripts/disposabl.mjs +15 -1
- package/dist/templates/default/.github/scripts/platforms.sh +1 -1
- package/dist/templates/default/.github/scripts/release.sh +1 -1
- package/dist/templates/default/.github/workflows/pipeline.yml +30 -2
- package/dist/templates/default/apps/desktop/README.md +16 -4
- package/dist/templates/default/apps/desktop/build-ci.mjs +7 -0
- package/dist/templates/default/apps/desktop/forge.config.mts +8 -4
- package/dist/templates/default/apps/desktop/package.json +3 -2
- package/dist/templates/default/apps/desktop/publish-update.mjs +93 -0
- package/dist/templates/default/apps/desktop/src/declarations.d.ts +4 -0
- package/dist/templates/default/apps/desktop/src/main.ts +86 -1
- package/dist/templates/default/apps/desktop/src/updates.ts +123 -0
- package/dist/templates/default/apps/desktop/stage-update.mjs +70 -0
- package/dist/templates/default/apps/desktop/vite.main.config.mts +10 -0
- package/dist/templates/default/apps/web/src/routeTree.gen.ts +31 -0
- package/dist/templates/default/apps/web/src/router/mobile-login.tsx +84 -0
- package/dist/templates/default/bun.lock +7 -2
- package/dist/templates/default/package.json +1 -1
- package/dist/templates/default/packages/backend/convex/authSetup.ts +9 -1
- package/dist/templates/default/packages/backend/convex/desktopUpdates/validator.ts +62 -0
- package/dist/templates/default/packages/backend/convex/desktopUpdates.ts +216 -0
- package/dist/templates/default/packages/backend/convex/http.ts +6 -0
- package/dist/templates/default/packages/backend/convex/schema.ts +2 -0
- package/dist/templates/default/packages/cli/auth.ts +1 -20
- package/dist/templates/default/packages/cli/origin.ts +22 -0
- package/dist/templates/default/packages/disposabl-kit/lib/indexing.ts +1 -0
- package/dist/templates/default/packages/disposabl-kit/server/files-functions.ts +1 -1
- package/dist/templates/default/packages/disposabl-kit/server/lib/static.ts +7 -0
- package/dist/templates/default/packages/disposabl-kit/server/lib/telemetry.ts +62 -12
- package/dist/templates/default/packages/tests/README.md +2 -0
- package/dist/templates/default/packages/tests/ci-platform-selection.test.ts +53 -0
- package/dist/templates/default/packages/tests/desktop-publication.test.ts +251 -0
- package/dist/templates/default/packages/tests/desktop-updates.test.ts +200 -0
- package/dist/templates/default/packages/tests/flows/desktop-updates.e2e.ts +102 -0
- package/dist/templates/default/packages/tests/flows/files.e2e.ts +48 -0
- package/dist/templates/default/packages/tests/telemetry.test.ts +170 -0
- package/dist/templates/default/vendor/README.md +7 -4
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.3.tgz +0 -0
- package/package.json +1 -1
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.1.tgz +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export type UpdateState = 'idle' | 'checking' | 'downloading' | 'ready';
|
|
2
|
+
|
|
3
|
+
export function feedUrl(
|
|
4
|
+
base: string,
|
|
5
|
+
channel: string,
|
|
6
|
+
platform: string,
|
|
7
|
+
arch: string,
|
|
8
|
+
) {
|
|
9
|
+
if (!base || !/^[a-z0-9][a-z0-9-]*$/.test(channel)) return '';
|
|
10
|
+
try {
|
|
11
|
+
const url = new URL(base);
|
|
12
|
+
if (
|
|
13
|
+
url.protocol !== 'https:' ||
|
|
14
|
+
url.username ||
|
|
15
|
+
url.password ||
|
|
16
|
+
url.search ||
|
|
17
|
+
url.hash
|
|
18
|
+
)
|
|
19
|
+
return '';
|
|
20
|
+
url.pathname = `${url.pathname.replace(/\/+$/, '')}/${channel}/${platform}/${arch}`;
|
|
21
|
+
return url.toString();
|
|
22
|
+
} catch {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createUpdateController(options: {
|
|
28
|
+
supported: boolean;
|
|
29
|
+
feed: string;
|
|
30
|
+
readyAt?: number;
|
|
31
|
+
now?: () => number;
|
|
32
|
+
start: () => void;
|
|
33
|
+
install: () => void | Promise<void>;
|
|
34
|
+
show: (kind: 'info' | 'error', message: string, detail?: string) => void;
|
|
35
|
+
confirmRestart: () => Promise<boolean>;
|
|
36
|
+
onState?: (state: UpdateState) => void;
|
|
37
|
+
}) {
|
|
38
|
+
let state: UpdateState = 'idle';
|
|
39
|
+
let confirming = false;
|
|
40
|
+
const setState = (next: UpdateState) => {
|
|
41
|
+
state = next;
|
|
42
|
+
options.onState?.(next);
|
|
43
|
+
};
|
|
44
|
+
const restartError = () =>
|
|
45
|
+
options.show(
|
|
46
|
+
'error',
|
|
47
|
+
'Could not restart to install the update.',
|
|
48
|
+
'Your update is still downloaded. Try Restart to update again.',
|
|
49
|
+
);
|
|
50
|
+
const restart = async () => {
|
|
51
|
+
if (state !== 'ready' || confirming) return;
|
|
52
|
+
confirming = true;
|
|
53
|
+
try {
|
|
54
|
+
if (await options.confirmRestart()) await options.install();
|
|
55
|
+
} catch {
|
|
56
|
+
restartError();
|
|
57
|
+
} finally {
|
|
58
|
+
confirming = false;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
get state() {
|
|
63
|
+
return state;
|
|
64
|
+
},
|
|
65
|
+
check() {
|
|
66
|
+
if (!options.supported)
|
|
67
|
+
return options.show(
|
|
68
|
+
'info',
|
|
69
|
+
'Automatic updates are unavailable for this build.',
|
|
70
|
+
'Download the latest installer from the app’s download page.',
|
|
71
|
+
);
|
|
72
|
+
if (!options.feed)
|
|
73
|
+
return options.show(
|
|
74
|
+
'error',
|
|
75
|
+
'Updates are not configured for this build.',
|
|
76
|
+
);
|
|
77
|
+
if ((options.now ?? Date.now)() < (options.readyAt ?? 0))
|
|
78
|
+
return options.show(
|
|
79
|
+
'info',
|
|
80
|
+
'Finishing installation. Try checking for updates in a few seconds.',
|
|
81
|
+
);
|
|
82
|
+
if (state === 'ready') {
|
|
83
|
+
void restart();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (state !== 'idle')
|
|
87
|
+
return options.show('info', 'An update check is already in progress.');
|
|
88
|
+
setState('checking');
|
|
89
|
+
try {
|
|
90
|
+
options.start();
|
|
91
|
+
} catch {
|
|
92
|
+
setState('idle');
|
|
93
|
+
options.show(
|
|
94
|
+
'error',
|
|
95
|
+
'Could not check for updates.',
|
|
96
|
+
'Please try again later.',
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
available() {
|
|
101
|
+
if (state === 'checking') setState('downloading');
|
|
102
|
+
},
|
|
103
|
+
unavailable() {
|
|
104
|
+
if (state !== 'checking') return;
|
|
105
|
+
setState('idle');
|
|
106
|
+
options.show('info', 'This app is up to date.');
|
|
107
|
+
},
|
|
108
|
+
downloaded() {
|
|
109
|
+
if (state !== 'checking' && state !== 'downloading') return;
|
|
110
|
+
setState('ready');
|
|
111
|
+
void restart();
|
|
112
|
+
},
|
|
113
|
+
error() {
|
|
114
|
+
if (state === 'ready') return restartError();
|
|
115
|
+
setState('idle');
|
|
116
|
+
options.show(
|
|
117
|
+
'error',
|
|
118
|
+
'Could not check for updates.',
|
|
119
|
+
'Check your connection and try again.',
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cp, mkdir, readdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const root = fileURLToPath(new URL('../..', import.meta.url));
|
|
6
|
+
const {
|
|
7
|
+
DISPOSABL_DESKTOP_UPDATE_URL: base,
|
|
8
|
+
DISPOSABL_DESKTOP_UPDATE_CHANNEL: channel = 'production',
|
|
9
|
+
DISPOSABL_DESKTOP_PLATFORM: platform,
|
|
10
|
+
DISPOSABL_RELEASE_VERSION: version,
|
|
11
|
+
} = process.env;
|
|
12
|
+
if (!base) process.exit(0);
|
|
13
|
+
const url = new URL(base);
|
|
14
|
+
if (
|
|
15
|
+
url.protocol !== 'https:' ||
|
|
16
|
+
url.username ||
|
|
17
|
+
url.password ||
|
|
18
|
+
url.search ||
|
|
19
|
+
url.hash ||
|
|
20
|
+
!/^[a-z0-9][a-z0-9-]*$/.test(channel)
|
|
21
|
+
)
|
|
22
|
+
throw new Error('Invalid desktop update URL or channel');
|
|
23
|
+
if (!/^\d+\.\d+\.\d+$/.test(version ?? ''))
|
|
24
|
+
throw new Error('Invalid update version');
|
|
25
|
+
const targets = { macos: ['darwin', 'arm64'], windows: ['win32', 'x64'] };
|
|
26
|
+
if (!targets[platform]) process.exit(0);
|
|
27
|
+
// Never stage an ad-hoc signed Mac app as an update.
|
|
28
|
+
if (platform === 'macos' && process.env.MACOS_NOTARIZE !== 'true')
|
|
29
|
+
process.exit(0);
|
|
30
|
+
const [os, arch] = targets[platform];
|
|
31
|
+
url.pathname = `${url.pathname.replace(/\/+$/, '')}/${channel}/${os}/${arch}/`;
|
|
32
|
+
const release = join(root, 'dist/release');
|
|
33
|
+
const output = join(root, 'dist/update', channel, os, arch);
|
|
34
|
+
await mkdir(output, { recursive: true });
|
|
35
|
+
const files = await readdir(release);
|
|
36
|
+
if (platform === 'macos') {
|
|
37
|
+
const zips = files.filter((name) => name.endsWith('.zip'));
|
|
38
|
+
if (zips.length !== 1) throw new Error('Expected one macOS ZIP');
|
|
39
|
+
const name = zips[0];
|
|
40
|
+
await cp(join(release, name), join(output, name));
|
|
41
|
+
const updateTo = {
|
|
42
|
+
version,
|
|
43
|
+
name: version,
|
|
44
|
+
pub_date: new Date().toISOString(),
|
|
45
|
+
url: new URL(encodeURIComponent(name), url).href,
|
|
46
|
+
};
|
|
47
|
+
await writeFile(
|
|
48
|
+
join(output, 'RELEASES.json'),
|
|
49
|
+
JSON.stringify(
|
|
50
|
+
{ currentRelease: version, releases: [{ version, updateTo }] },
|
|
51
|
+
null,
|
|
52
|
+
2,
|
|
53
|
+
) + '\n',
|
|
54
|
+
);
|
|
55
|
+
} else {
|
|
56
|
+
const releases = await readFile(join(release, 'RELEASES'), 'utf8');
|
|
57
|
+
const names = [
|
|
58
|
+
...releases.matchAll(/^[A-Fa-f0-9]{40}\s+(\S+)\s+\d+\s*$/gm),
|
|
59
|
+
].map((match) => match[1]);
|
|
60
|
+
if (
|
|
61
|
+
!names.length ||
|
|
62
|
+
names.some(
|
|
63
|
+
(name) =>
|
|
64
|
+
!files.includes(name) || name.includes('/') || name.includes('\\'),
|
|
65
|
+
)
|
|
66
|
+
)
|
|
67
|
+
throw new Error('Invalid Squirrel RELEASES');
|
|
68
|
+
for (const name of names) await cp(join(release, name), join(output, name));
|
|
69
|
+
await writeFile(join(output, 'RELEASES'), releases);
|
|
70
|
+
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
|
+
import manifest from './package.json' with { type: 'json' };
|
|
2
3
|
|
|
3
4
|
export default defineConfig({
|
|
4
5
|
define: {
|
|
6
|
+
DISPOSABL_DESKTOP_ID: JSON.stringify(
|
|
7
|
+
'disposablDesktopId' in manifest ? manifest.disposablDesktopId : '',
|
|
8
|
+
),
|
|
9
|
+
DISPOSABL_UPDATE_URL: JSON.stringify(
|
|
10
|
+
process.env.DISPOSABL_DESKTOP_UPDATE_URL || '',
|
|
11
|
+
),
|
|
12
|
+
DISPOSABL_UPDATE_CHANNEL: JSON.stringify(
|
|
13
|
+
process.env.DISPOSABL_DESKTOP_UPDATE_CHANNEL || 'production',
|
|
14
|
+
),
|
|
5
15
|
DISPOSABL_WEB_URL: JSON.stringify(
|
|
6
16
|
process.env.CONVEX_SITE_URL || process.env.VITE_CONVEX_SITE_URL || '',
|
|
7
17
|
),
|
|
@@ -16,6 +16,7 @@ import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsen
|
|
|
16
16
|
import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesForgotPasswordRouteImport } from './../../../packages/disposabl-kit/client/routes/_auth-pages/forgot-password'
|
|
17
17
|
import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesLegalIndexRouteImport } from './../../../packages/disposabl-kit/client/routes/legal/index'
|
|
18
18
|
import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRouteImport } from './../../../packages/disposabl-kit/client/routes/_auth-pages/login'
|
|
19
|
+
import { Route as MobileLoginRouteImport } from './router/mobile-login'
|
|
19
20
|
import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRouteImport } from './../../../packages/disposabl-kit/client/routes/pricing'
|
|
20
21
|
import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesResetPasswordRouteImport } from './../../../packages/disposabl-kit/client/routes/_auth-pages/reset-password'
|
|
21
22
|
import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRouteImport } from './../../../packages/disposabl-kit/client/routes/_auth-pages/signUp'
|
|
@@ -86,6 +87,12 @@ const DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRout
|
|
|
86
87
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesRouteRoute,
|
|
87
88
|
} as any,
|
|
88
89
|
)
|
|
90
|
+
const MobileLoginRoute = MobileLoginRouteImport.update({
|
|
91
|
+
id: '/mobile-login',
|
|
92
|
+
path: '/mobile-login',
|
|
93
|
+
getParentRoute: () =>
|
|
94
|
+
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesRouteRoute,
|
|
95
|
+
} as any)
|
|
89
96
|
const DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRoute =
|
|
90
97
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRouteImport.update(
|
|
91
98
|
{
|
|
@@ -191,6 +198,7 @@ export interface FileRoutesByFullPath {
|
|
|
191
198
|
'/consent': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsentRoute
|
|
192
199
|
'/forgot-password': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesForgotPasswordRoute
|
|
193
200
|
'/login': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute
|
|
201
|
+
'/mobile-login': typeof MobileLoginRoute
|
|
194
202
|
'/pricing': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRoute
|
|
195
203
|
'/reset-password': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesResetPasswordRoute
|
|
196
204
|
'/signup': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
|
|
@@ -210,6 +218,7 @@ export interface FileRoutesByTo {
|
|
|
210
218
|
'/consent': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsentRoute
|
|
211
219
|
'/forgot-password': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesForgotPasswordRoute
|
|
212
220
|
'/login': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute
|
|
221
|
+
'/mobile-login': typeof MobileLoginRoute
|
|
213
222
|
'/pricing': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRoute
|
|
214
223
|
'/reset-password': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesResetPasswordRoute
|
|
215
224
|
'/signup': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
|
|
@@ -231,6 +240,7 @@ export interface FileRoutesById {
|
|
|
231
240
|
'/_providers/consent': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsentRoute
|
|
232
241
|
'/_providers/forgot-password': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesForgotPasswordRoute
|
|
233
242
|
'/_providers/login': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute
|
|
243
|
+
'/_providers/mobile-login': typeof MobileLoginRoute
|
|
234
244
|
'/_providers/pricing': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRoute
|
|
235
245
|
'/_providers/reset-password': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesResetPasswordRoute
|
|
236
246
|
'/_providers/signup': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
|
|
@@ -253,6 +263,7 @@ export interface FileRouteTypes {
|
|
|
253
263
|
| '/consent'
|
|
254
264
|
| '/forgot-password'
|
|
255
265
|
| '/login'
|
|
266
|
+
| '/mobile-login'
|
|
256
267
|
| '/pricing'
|
|
257
268
|
| '/reset-password'
|
|
258
269
|
| '/signup'
|
|
@@ -272,6 +283,7 @@ export interface FileRouteTypes {
|
|
|
272
283
|
| '/consent'
|
|
273
284
|
| '/forgot-password'
|
|
274
285
|
| '/login'
|
|
286
|
+
| '/mobile-login'
|
|
275
287
|
| '/pricing'
|
|
276
288
|
| '/reset-password'
|
|
277
289
|
| '/signup'
|
|
@@ -292,6 +304,7 @@ export interface FileRouteTypes {
|
|
|
292
304
|
| '/_providers/consent'
|
|
293
305
|
| '/_providers/forgot-password'
|
|
294
306
|
| '/_providers/login'
|
|
307
|
+
| '/_providers/mobile-login'
|
|
295
308
|
| '/_providers/pricing'
|
|
296
309
|
| '/_providers/reset-password'
|
|
297
310
|
| '/_providers/signup'
|
|
@@ -363,6 +376,13 @@ declare module '@tanstack/react-router' {
|
|
|
363
376
|
preLoaderRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRouteImport
|
|
364
377
|
parentRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesRouteRoute
|
|
365
378
|
}
|
|
379
|
+
'/_providers/mobile-login': {
|
|
380
|
+
id: '/_providers/mobile-login'
|
|
381
|
+
path: '/mobile-login'
|
|
382
|
+
fullPath: '/mobile-login'
|
|
383
|
+
preLoaderRoute: typeof MobileLoginRouteImport
|
|
384
|
+
parentRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesRouteRoute
|
|
385
|
+
}
|
|
366
386
|
'/_providers/pricing': {
|
|
367
387
|
id: '/_providers/pricing'
|
|
368
388
|
path: '/pricing'
|
|
@@ -490,6 +510,7 @@ interface DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesRouteRouteChil
|
|
|
490
510
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsentRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesConsentRoute
|
|
491
511
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesForgotPasswordRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesForgotPasswordRoute
|
|
492
512
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute
|
|
513
|
+
MobileLoginRoute: typeof MobileLoginRoute
|
|
493
514
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRoute
|
|
494
515
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesResetPasswordRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesResetPasswordRoute
|
|
495
516
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute: typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
|
|
@@ -512,6 +533,7 @@ const DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesRouteRouteChildren
|
|
|
512
533
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesForgotPasswordRoute,
|
|
513
534
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute:
|
|
514
535
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesLoginRoute,
|
|
536
|
+
MobileLoginRoute: MobileLoginRoute,
|
|
515
537
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRoute:
|
|
516
538
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesPricingRoute,
|
|
517
539
|
DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesResetPasswordRoute:
|
|
@@ -545,3 +567,12 @@ const rootRouteChildren: RootRouteChildren = {
|
|
|
545
567
|
export const routeTree = rootRouteImport
|
|
546
568
|
._addFileChildren(rootRouteChildren)
|
|
547
569
|
._addFileTypes<FileRouteTypes>()
|
|
570
|
+
|
|
571
|
+
import type { getRouter } from './router.tsx'
|
|
572
|
+
import type { createStart } from '@tanstack/react-start'
|
|
573
|
+
declare module '@tanstack/react-start' {
|
|
574
|
+
interface Register {
|
|
575
|
+
ssr: true
|
|
576
|
+
router: Awaited<ReturnType<typeof getRouter>>
|
|
577
|
+
}
|
|
578
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
3
|
+
import { useAuthActions } from "@convex-dev/auth/react";
|
|
4
|
+
import { useMutation, useQuery } from "convex/react";
|
|
5
|
+
import { api } from "../../../../packages/backend/convex/_generated/api";
|
|
6
|
+
import { PasswordPage } from "../../../../packages/disposabl-kit/client/components/password-page";
|
|
7
|
+
import { Button } from "@disposabl/disposabl-kit/client/components/ui/button";
|
|
8
|
+
|
|
9
|
+
export const Route = createFileRoute("/_providers/mobile-login")({
|
|
10
|
+
component: MobileLogin,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
function MobileLogin() {
|
|
14
|
+
const [framed] = useState(
|
|
15
|
+
() => typeof window !== "undefined" && window.top !== window.self,
|
|
16
|
+
);
|
|
17
|
+
const [code] = useState(() =>
|
|
18
|
+
typeof window === "undefined" ? "" : window.location.hash.slice(1),
|
|
19
|
+
);
|
|
20
|
+
const account = useQuery(
|
|
21
|
+
api.browserHandoff.inspect,
|
|
22
|
+
code && !framed ? { code } : "skip",
|
|
23
|
+
);
|
|
24
|
+
const redeem = useMutation(api.browserHandoff.redeem);
|
|
25
|
+
const { setSession } = useAuthActions();
|
|
26
|
+
const [pending, setPending] = useState(false);
|
|
27
|
+
const [error, setError] = useState("");
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
// Keep this single-use credential out of history, referrers and subsequent navigation.
|
|
30
|
+
window.history.replaceState(
|
|
31
|
+
window.history.state,
|
|
32
|
+
"",
|
|
33
|
+
window.location.pathname,
|
|
34
|
+
);
|
|
35
|
+
}, []);
|
|
36
|
+
async function proceed() {
|
|
37
|
+
if (pending || !account?.name) return;
|
|
38
|
+
setPending(true);
|
|
39
|
+
try {
|
|
40
|
+
const session = await redeem({ code });
|
|
41
|
+
await setSession(session);
|
|
42
|
+
window.location.replace("/dashboard/connections?origin=mobile");
|
|
43
|
+
} catch {
|
|
44
|
+
setError(
|
|
45
|
+
"This link could not sign you in. Open connections again from the app.",
|
|
46
|
+
);
|
|
47
|
+
setPending(false);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return (
|
|
51
|
+
<PasswordPage
|
|
52
|
+
title="Continue from the app"
|
|
53
|
+
description="Use your signed-in Disposabl account to connect your services."
|
|
54
|
+
>
|
|
55
|
+
{framed ? (
|
|
56
|
+
<p role="alert">Open this link directly in your browser.</p>
|
|
57
|
+
) : code && account === undefined ? (
|
|
58
|
+
<p>Checking your account…</p>
|
|
59
|
+
) : account?.name ? (
|
|
60
|
+
<>
|
|
61
|
+
<p className="break-words font-medium">{account.name}</p>
|
|
62
|
+
<p>This signs this browser into the account shown above.</p>
|
|
63
|
+
<Button
|
|
64
|
+
className="min-h-12 w-full"
|
|
65
|
+
disabled={pending}
|
|
66
|
+
onClick={() => void proceed()}
|
|
67
|
+
>
|
|
68
|
+
{pending ? "Signing in…" : `Continue as ${account.name}`}
|
|
69
|
+
</Button>
|
|
70
|
+
</>
|
|
71
|
+
) : account ? (
|
|
72
|
+
<p role="alert">
|
|
73
|
+
Your account is signed in, but its email is missing. Reconnect Google
|
|
74
|
+
in the app to confirm which account this browser should use.
|
|
75
|
+
</p>
|
|
76
|
+
) : (
|
|
77
|
+
<p role="alert">
|
|
78
|
+
This link expired. Open connections again from the app.
|
|
79
|
+
</p>
|
|
80
|
+
)}
|
|
81
|
+
{error && <p role="alert">{error}</p>}
|
|
82
|
+
</PasswordPage>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@electron-forge/maker-dmg": "8.0.1",
|
|
24
24
|
"@electron-forge/maker-rpm": "8.0.1",
|
|
25
25
|
"@electron-forge/maker-squirrel": "8.0.1",
|
|
26
|
+
"@electron-forge/maker-zip": "8.0.1",
|
|
26
27
|
"@electron-forge/plugin-fuses": "8.0.1",
|
|
27
28
|
"@electron-forge/plugin-vite": "8.0.1",
|
|
28
29
|
"@electron-forge/publisher-github": "8.0.1",
|
|
@@ -287,7 +288,7 @@
|
|
|
287
288
|
"lightningcss": "1.30.1",
|
|
288
289
|
},
|
|
289
290
|
"catalog": {
|
|
290
|
-
"@convex-dev/auth": "file:vendor/convex-auth-437831bd-disposabl.
|
|
291
|
+
"@convex-dev/auth": "file:vendor/convex-auth-437831bd-disposabl.3.tgz",
|
|
291
292
|
"@convex-dev/mcp": "0.1.0-alpha.7",
|
|
292
293
|
"@convex-dev/static-hosting": "0.2.1",
|
|
293
294
|
"convex": "^1.49.0",
|
|
@@ -470,7 +471,7 @@
|
|
|
470
471
|
|
|
471
472
|
"@colors/colors": ["@colors/colors@1.5.0", "", {}, "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="],
|
|
472
473
|
|
|
473
|
-
"@convex-dev/auth": ["@convex-dev/auth@vendor/convex-auth-437831bd-disposabl.
|
|
474
|
+
"@convex-dev/auth": ["@convex-dev/auth@vendor/convex-auth-437831bd-disposabl.3.tgz", { "dependencies": { "@babel/code-frame": "^7.29.7", "@convex-dev/batch-worker": "^0.3.2", "@convex-dev/rate-limiter": "^0.3.2", "@simplewebauthn/browser": "^14.0.0", "@simplewebauthn/server": "^14.0.0", "argon2id-wasm": "0.0.0-alpha.2", "chalk": "^5.6.2", "commander": "^14.0.2", "cookie": "1.1.1", "jose": "^5.2.2" }, "peerDependencies": { "@convex-dev/resend": "^0.2.8", "convex": "^1.48.0", "next": "^16.0.0", "react": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@convex-dev/resend", "next", "react"], "hasInstallScript": true, "bin": { "@convex-dev/auth": "./dist/cli/init.js" } }, "sha512-ILtdtp/jnXthIDBCuUJ0Xwb/HFVuwbigdKgpBNYux39s0jjkKk50RPpxFivP9S6IsWd6Wl4uzQFe4dQGmCaavA=="],
|
|
474
475
|
|
|
475
476
|
"@convex-dev/batch-worker": ["@convex-dev/batch-worker@0.3.6", "", { "dependencies": { "convex-helpers": "^0.1.127" }, "peerDependencies": { "convex": "^1.43.0" } }, "sha512-tR+9DaHR3jG3oqkIFX0ok/6944h7UHEQgT6HTmiuxU+lERYuYMsxA2IWwFD5yTFbCpO3YJhqXU4QdGY90sgUqQ=="],
|
|
476
477
|
|
|
@@ -526,6 +527,8 @@
|
|
|
526
527
|
|
|
527
528
|
"@electron-forge/maker-squirrel": ["@electron-forge/maker-squirrel@8.0.1", "", { "dependencies": { "@electron-forge/core-utils": "8.0.1", "@electron-forge/maker-base": "8.0.1", "@electron-forge/shared-types": "8.0.1" }, "optionalDependencies": { "electron-winstaller": "^5.3.0" } }, "sha512-V6QrJvvmX2xbITXP1+/bXYe2hkMM7BYnQ8vzVHDOca2P6pn68MZsCSewqm8wiBIBSEeYuRhrztvV8aMlJ5n5Mg=="],
|
|
528
529
|
|
|
530
|
+
"@electron-forge/maker-zip": ["@electron-forge/maker-zip@8.0.1", "", { "dependencies": { "@electron-forge/core-utils": "8.0.1", "@electron-forge/maker-base": "8.0.1", "@electron-forge/shared-types": "8.0.1", "cross-zip": "^4.0.0" } }, "sha512-EyMyAMFRZTPKbe6K1HEAgnpAMC7OvR8tQ2iG/5Vd++iG2AVdFJ9usChfW72n172jk9CTfFc7L88IF8lXMYYvIQ=="],
|
|
531
|
+
|
|
529
532
|
"@electron-forge/multi-logger": ["@electron-forge/multi-logger@8.0.1", "", { "dependencies": { "debug": "^4.3.1", "ink": "^7.1.1", "react": "^19.2.0", "string-width": "^8.2.0", "wrap-ansi": "^10.0.0" } }, "sha512-cgYcETMtlkcYiMC8YcaaW8jFDmVZ6mbNBL0Yi0ekjoOjcBecJS/uy7+9GvM9DWq3Ie5YCfe4+AWuVR3HF56/sQ=="],
|
|
530
533
|
|
|
531
534
|
"@electron-forge/plugin-base": ["@electron-forge/plugin-base@8.0.1", "", { "dependencies": { "@electron-forge/shared-types": "8.0.1" } }, "sha512-lN0ZQyRmMNC/m/XV+Pc7mb/YnLlmSGzWb46McZrk5/vwDyS6t4ZqyA9LDpKs21chjEoQS7q7PLNDRuyh4Lb6KQ=="],
|
|
@@ -1898,6 +1901,8 @@
|
|
|
1898
1901
|
|
|
1899
1902
|
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
|
|
1900
1903
|
|
|
1904
|
+
"cross-zip": ["cross-zip@4.0.1", "", {}, "sha512-n63i0lZ0rvQ6FXiGQ+/JFCKAUyPFhLQYJIqKaa+tSJtfKeULF/IDNDAbdnSIxgS4NTuw2b0+lj8LzfITuq+ZxQ=="],
|
|
1905
|
+
|
|
1901
1906
|
"crypto-random-string": ["crypto-random-string@4.0.0", "", { "dependencies": { "type-fest": "^1.0.1" } }, "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA=="],
|
|
1902
1907
|
|
|
1903
1908
|
"css-select": ["css-select@5.2.2", "", { "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.1.0", "domhandler": "^5.0.2", "domutils": "^3.0.1", "nth-check": "^2.0.1" } }, "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw=="],
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"packages/*"
|
|
30
30
|
],
|
|
31
31
|
"catalog": {
|
|
32
|
-
"@convex-dev/auth": "file:vendor/convex-auth-437831bd-disposabl.
|
|
32
|
+
"@convex-dev/auth": "file:vendor/convex-auth-437831bd-disposabl.3.tgz",
|
|
33
33
|
"convex": "^1.49.0",
|
|
34
34
|
"lucide-react": "^1.70.0",
|
|
35
35
|
"react": "19.3.0",
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { setupConvexAuth } from "@convex-dev/auth/server";
|
|
2
2
|
import { components } from "./_generated/api";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const sessionTtl = {
|
|
5
|
+
accessTokenTtlSeconds: 60,
|
|
6
|
+
refreshInactivityTimeoutSeconds: 30 * 24 * 60 * 60,
|
|
7
|
+
sessionMaxLifetimeSeconds: 30 * 24 * 60 * 60,
|
|
8
|
+
};
|
|
9
|
+
export const auth = setupConvexAuth({
|
|
10
|
+
component: components.auth,
|
|
11
|
+
...sessionTtl,
|
|
12
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
|
|
4
|
+
export const feed = {
|
|
5
|
+
app: v.string(),
|
|
6
|
+
channel: v.string(),
|
|
7
|
+
platform: v.string(),
|
|
8
|
+
arch: v.string(),
|
|
9
|
+
};
|
|
10
|
+
export const publication = {
|
|
11
|
+
...feed,
|
|
12
|
+
version: v.string(),
|
|
13
|
+
build: v.number(),
|
|
14
|
+
attempt: v.number(),
|
|
15
|
+
filename: v.string(),
|
|
16
|
+
storageId: v.id("_storage"),
|
|
17
|
+
sha256: v.string(),
|
|
18
|
+
sha1: v.string(),
|
|
19
|
+
size: v.number(),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const resolvedUpdate = v.union(
|
|
23
|
+
v.null(),
|
|
24
|
+
v.object({
|
|
25
|
+
version: v.string(),
|
|
26
|
+
filename: v.string(),
|
|
27
|
+
sha1: v.string(),
|
|
28
|
+
size: v.number(),
|
|
29
|
+
url: v.string(),
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const desktopUpdateTable = defineTable({
|
|
34
|
+
app: v.string(),
|
|
35
|
+
channel: v.string(),
|
|
36
|
+
platform: v.string(),
|
|
37
|
+
arch: v.string(),
|
|
38
|
+
version: v.string(),
|
|
39
|
+
build: v.number(),
|
|
40
|
+
attempt: v.number(),
|
|
41
|
+
filename: v.string(),
|
|
42
|
+
storageId: v.id("_storage"),
|
|
43
|
+
sha256: v.string(),
|
|
44
|
+
sha1: v.string(),
|
|
45
|
+
size: v.number(),
|
|
46
|
+
})
|
|
47
|
+
.index("by_feed_build", [
|
|
48
|
+
"app",
|
|
49
|
+
"channel",
|
|
50
|
+
"platform",
|
|
51
|
+
"arch",
|
|
52
|
+
"build",
|
|
53
|
+
"attempt",
|
|
54
|
+
])
|
|
55
|
+
.index("by_storageId", ["storageId"])
|
|
56
|
+
.index("by_feed_filename", [
|
|
57
|
+
"app",
|
|
58
|
+
"channel",
|
|
59
|
+
"platform",
|
|
60
|
+
"arch",
|
|
61
|
+
"filename",
|
|
62
|
+
]);
|