@tapflowio/relay 0.9.0 → 0.9.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/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +1 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +12 -3
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/loadEnvFile.d.ts.map +1 -1
- package/dist/lib/loadEnvFile.js +3 -1
- package/dist/lib/loadEnvFile.js.map +1 -1
- package/dist/server.js +4 -6
- package/dist/server.js.map +1 -1
- package/package.json +5 -5
- package/public/assets/AppCenter-CH3MXel8.js +16 -0
- package/public/assets/AppCenter-CH3MXel8.js.br +0 -0
- package/public/assets/{Default-DQiKj0NT.js → Default-CK_yhJO6.js} +1 -1
- package/public/assets/Default-CK_yhJO6.js.br +0 -0
- package/public/assets/{Invite-B4MMcQtw.js → Invite-9g1gI701.js} +1 -1
- package/public/assets/Invite-9g1gI701.js.br +0 -0
- package/public/assets/{MacResources-BfZAJ5BP.js → MacResources-41d3_9X2.js} +1 -1
- package/public/assets/MacResources-41d3_9X2.js.br +0 -0
- package/public/assets/{NotFound-D85RKzwv.js → NotFound-DsMP9eZN.js} +1 -1
- package/public/assets/NotFound-DsMP9eZN.js.br +2 -0
- package/public/assets/QASession-B02bILlB.js +130 -0
- package/public/assets/QASession-B02bILlB.js.br +0 -0
- package/public/assets/{ResetPassword-Degmb6sl.js → ResetPassword-DsXsNFTA.js} +1 -1
- package/public/assets/ResetPassword-DsXsNFTA.js.br +0 -0
- package/public/assets/{Setup-DKOFxDo2.js → Setup-CouJNq4v.js} +1 -1
- package/public/assets/Setup-CouJNq4v.js.br +0 -0
- package/public/assets/Team-DUG0YTtb.js +6 -0
- package/public/assets/Team-DUG0YTtb.js.br +0 -0
- package/public/assets/Tokens-BWBEl4ax.js +6 -0
- package/public/assets/Tokens-BWBEl4ax.js.br +0 -0
- package/public/assets/alert-dialog-qlHDtr4B.js +1 -0
- package/public/assets/alert-dialog-qlHDtr4B.js.br +0 -0
- package/public/assets/{badge-Cktrrdvf.js → badge-Cx2-XXcg.js} +1 -1
- package/public/assets/badge-Cx2-XXcg.js.br +0 -0
- package/public/assets/build-format-BvNznvYq.js +11 -0
- package/public/assets/build-format-BvNznvYq.js.br +0 -0
- package/public/assets/dialog-DzNUT3NF.js +11 -0
- package/public/assets/dialog-DzNUT3NF.js.br +0 -0
- package/public/assets/index-Dfs85Uiw.js +274 -0
- package/public/assets/index-Dfs85Uiw.js.br +0 -0
- package/public/assets/pencil-CrO7Me4O.js +6 -0
- package/public/assets/pencil-CrO7Me4O.js.br +0 -0
- package/public/assets/plus-DnAOz8DL.js +6 -0
- package/public/assets/plus-DnAOz8DL.js.br +0 -0
- package/public/assets/{table-NBRnBazr.js → table-BXnp_tRt.js} +1 -1
- package/public/assets/table-BXnp_tRt.js.br +0 -0
- package/public/assets/tabs-BTnhanO2.js +1 -0
- package/public/assets/tabs-BTnhanO2.js.br +0 -0
- package/public/index.html +1 -1
- package/public/index.html.br +0 -0
- package/public/assets/AppCenter-CaY73Tvf.js +0 -16
- package/public/assets/AppCenter-CaY73Tvf.js.br +0 -0
- package/public/assets/Default-DQiKj0NT.js.br +0 -0
- package/public/assets/Invite-B4MMcQtw.js.br +0 -0
- package/public/assets/MacResources-BfZAJ5BP.js.br +0 -0
- package/public/assets/NotFound-D85RKzwv.js.br +0 -0
- package/public/assets/QASession-B9FSUtZo.js +0 -130
- package/public/assets/QASession-B9FSUtZo.js.br +0 -0
- package/public/assets/ResetPassword-Degmb6sl.js.br +0 -0
- package/public/assets/Setup-DKOFxDo2.js.br +0 -0
- package/public/assets/Team-Bgspan2B.js +0 -6
- package/public/assets/Team-Bgspan2B.js.br +0 -0
- package/public/assets/Tokens-C3u48FUG.js +0 -6
- package/public/assets/Tokens-C3u48FUG.js.br +0 -0
- package/public/assets/alert-dialog-Ci_cWoVo.js +0 -7
- package/public/assets/alert-dialog-Ci_cWoVo.js.br +0 -0
- package/public/assets/badge-Cktrrdvf.js.br +0 -0
- package/public/assets/build-format-Blzidb1D.js +0 -11
- package/public/assets/build-format-Blzidb1D.js.br +0 -0
- package/public/assets/dialog-BuZjQWBQ.js +0 -11
- package/public/assets/dialog-BuZjQWBQ.js.br +0 -0
- package/public/assets/index-ClAB0eKw.js +0 -258
- package/public/assets/index-ClAB0eKw.js.br +0 -0
- package/public/assets/pencil-BoxokH2R.js +0 -6
- package/public/assets/pencil-BoxokH2R.js.br +0 -0
- package/public/assets/plus-C0Y4Yk9P.js +0 -6
- package/public/assets/plus-C0Y4Yk9P.js.br +0 -0
- package/public/assets/table-NBRnBazr.js.br +0 -0
- package/public/assets/tabs-CB9a8dpY.js +0 -1
- package/public/assets/tabs-CB9a8dpY.js.br +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export { RelayServer } from './RelayServer.js';
|
|
2
2
|
export { SessionManager } from './SessionManager.js';
|
|
3
3
|
export { initDb, getDb, closeDb } from './db.js';
|
|
4
|
-
export { config } from './lib/config.js';
|
|
4
|
+
export { config, loadedEnvPath } from './lib/config.js';
|
|
5
5
|
export type { TapflowConfig } from './lib/config.js';
|
|
6
6
|
export { buildCorsOrigins, proxyWithoutPublicUrlWarning } from './lib/proxyConfig.js';
|
|
7
|
-
export { loadDataDirEnv } from './lib/loadEnvFile.js';
|
|
8
7
|
export type { CertProvider, CertMaterial, CertStrategy } from './lib/cert/index.js';
|
|
9
8
|
export type { DnsProvider } from './lib/cert/index.js';
|
|
10
9
|
export { createCertProvider, startCertRenewal, startAddressPublisher, dnsProviders } from './lib/cert/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AACrF,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACnF,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC/G,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { RelayServer } from './RelayServer.js';
|
|
2
2
|
export { SessionManager } from './SessionManager.js';
|
|
3
3
|
export { initDb, getDb, closeDb } from './db.js';
|
|
4
|
-
export { config } from './lib/config.js';
|
|
4
|
+
export { config, loadedEnvPath } from './lib/config.js';
|
|
5
5
|
export { buildCorsOrigins, proxyWithoutPublicUrlWarning } from './lib/proxyConfig.js';
|
|
6
|
-
export { loadDataDirEnv } from './lib/loadEnvFile.js';
|
|
7
6
|
export { createCertProvider, startCertRenewal, startAddressPublisher, dnsProviders } from './lib/cert/index.js';
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEvD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AAGrF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
43
43
|
}, z.core.$strip>;
|
|
44
44
|
}, z.core.$strip>;
|
|
45
45
|
export type TapflowConfig = z.infer<typeof configSchema>;
|
|
46
|
+
export declare let loadedEnvPath: string | null;
|
|
46
47
|
export declare function loadOrCreatePersistedSecret(dataDir: string): string;
|
|
47
48
|
export declare const config: {
|
|
48
49
|
local: {
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmDvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBhB,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AA+BxD,eAAO,IAAI,aAAa,EAAE,MAAM,GAAG,IAAW,CAAA;AA4G9C,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkBnE;AAaD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAA;AAC5B,eAAO,MAAM,SAAS,QAAkB,CAAA"}
|
package/dist/lib/config.js
CHANGED
|
@@ -5,6 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
import { createLogger } from '@tapflowio/agent-core';
|
|
6
6
|
import { parseTrustedProxies } from './clientAddress.js';
|
|
7
7
|
import { dnsProviders } from './cert/dnsRegistry.js';
|
|
8
|
+
import { loadDataDirEnv } from './loadEnvFile.js';
|
|
8
9
|
const logger = createLogger('relay:config');
|
|
9
10
|
const tunnelSshSchema = z.object({
|
|
10
11
|
host: z.string().min(1),
|
|
@@ -87,6 +88,8 @@ const DEFAULTS = {
|
|
|
87
88
|
function resolveDataDir(raw) {
|
|
88
89
|
return path.isAbsolute(raw) ? raw : path.join(process.cwd(), raw);
|
|
89
90
|
}
|
|
91
|
+
// Populated by load(): path of the dataDir/.env that was loaded, or null. CLI/server use it for a "loaded credentials" log.
|
|
92
|
+
export let loadedEnvPath = null;
|
|
90
93
|
function load() {
|
|
91
94
|
let file = {};
|
|
92
95
|
const configPath = path.join(process.cwd(), 'tapflow.config.json');
|
|
@@ -101,10 +104,17 @@ function load() {
|
|
|
101
104
|
if (file.local != null && 'jwtSecret' in file.local) {
|
|
102
105
|
logger.warn('local.jwtSecret in tapflow.config.json is deprecated — use JWT_SECRET env var instead');
|
|
103
106
|
}
|
|
107
|
+
// Resolve dataDir first, then load <dataDir>/.env, so every secret read below (JWT_SECRET, SMTP,
|
|
108
|
+
// DNS/ACME tokens) defaults to the .env file. dataDir itself can't come from .env (chicken-and-egg):
|
|
109
|
+
// it's set only by config.json or TAPFLOW_DATA_DIR. ambient process.env still wins over the file.
|
|
110
|
+
let dataDir = resolveDataDir(file.local?.dataDir ?? DEFAULTS.local.dataDir);
|
|
111
|
+
if (process.env.TAPFLOW_DATA_DIR)
|
|
112
|
+
dataDir = resolveDataDir(process.env.TAPFLOW_DATA_DIR);
|
|
113
|
+
loadedEnvPath = loadDataDirEnv(dataDir);
|
|
104
114
|
const cfg = {
|
|
105
115
|
local: {
|
|
106
116
|
port: file.local?.port ?? DEFAULTS.local.port,
|
|
107
|
-
dataDir
|
|
117
|
+
dataDir,
|
|
108
118
|
wsBackpressureBytes: DEFAULTS.local.wsBackpressureBytes,
|
|
109
119
|
trustedProxies: parseTrustedProxies(process.env.TAPFLOW_TRUSTED_PROXIES),
|
|
110
120
|
},
|
|
@@ -155,8 +165,7 @@ function load() {
|
|
|
155
165
|
};
|
|
156
166
|
if (process.env.TAPFLOW_PORT)
|
|
157
167
|
cfg.local.port = Number(process.env.TAPFLOW_PORT);
|
|
158
|
-
|
|
159
|
-
cfg.local.dataDir = resolveDataDir(process.env.TAPFLOW_DATA_DIR);
|
|
168
|
+
// TAPFLOW_DATA_DIR is already applied above (before the .env load) — it can't be set from .env.
|
|
160
169
|
if (process.env.TAPFLOW_WS_BACKPRESSURE_BYTES)
|
|
161
170
|
cfg.local.wsBackpressureBytes = Number(process.env.TAPFLOW_WS_BACKPRESSURE_BYTES);
|
|
162
171
|
if (process.env.TAPFLOW_RELAY_URL)
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,MAAM,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,CAAA;AAE3C,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAA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ED,SAAS,aAAa;IACpB,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACzC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;YACvC,MAAM,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAA;YACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAA;IAC/B,CAAC;IACD,OAAO,2BAA2B,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAC1D,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,EAAE,CAAA;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadEnvFile.d.ts","sourceRoot":"","sources":["../../src/lib/loadEnvFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadEnvFile.d.ts","sourceRoot":"","sources":["../../src/lib/loadEnvFile.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU7D"}
|
package/dist/lib/loadEnvFile.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
//
|
|
3
|
+
// gitignore된 <dataDir>/.env 에서 자격 증명(JWT_SECRET·SMTP·DNS/ACME 토큰 등)을 로드한다.
|
|
4
|
+
// config.load()가 secret을 읽기 전에 호출되어 .env가 모든 비밀의 기본 경로가 된다(#287에서 시작).
|
|
5
|
+
// process.loadEnvFile 은 기존 process.env 값을 안 덮으므로 ambient(셸) 가 항상 우선.
|
|
4
6
|
export function loadDataDirEnv(dataDir) {
|
|
5
7
|
const envPath = path.join(dataDir, '.env');
|
|
6
8
|
if (!fs.existsSync(envPath))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadEnvFile.js","sourceRoot":"","sources":["../../src/lib/loadEnvFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,
|
|
1
|
+
{"version":3,"file":"loadEnvFile.js","sourceRoot":"","sources":["../../src/lib/loadEnvFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,2EAA2E;AAC3E,uEAAuE;AACvE,qEAAqE;AACrE,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC1C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAA;IACxC,IAAI,CAAC;QACH,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAC5B,OAAO,OAAO,CAAA;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,gDAAgD;QAChD,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { initDb } from './db.js';
|
|
3
3
|
import { RelayServer } from './RelayServer.js';
|
|
4
|
-
import { config } from './lib/config.js';
|
|
4
|
+
import { config, loadedEnvPath } from './lib/config.js';
|
|
5
5
|
import { buildCorsOrigins, proxyWithoutPublicUrlWarning } from './lib/proxyConfig.js';
|
|
6
6
|
import { createCertProvider, startCertRenewal, startAddressPublisher } from './lib/cert/index.js';
|
|
7
|
-
import { loadDataDirEnv } from './lib/loadEnvFile.js';
|
|
8
7
|
import { createLogger } from '@tapflowio/agent-core';
|
|
9
8
|
const logger = createLogger('relay');
|
|
10
9
|
const { port, dataDir } = config.local;
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
logger.info(`Loaded credentials from ${envPath}`);
|
|
10
|
+
// config loaded <dataDir>/.env before reading any secret (JWT/SMTP/DNS tokens); just report it here.
|
|
11
|
+
if (loadedEnvPath)
|
|
12
|
+
logger.info(`Loaded credentials from ${loadedEnvPath}`);
|
|
15
13
|
const dbPath = path.join(dataDir, 'tapflow.db');
|
|
16
14
|
const uploadsDir = path.join(dataDir, 'uploads');
|
|
17
15
|
initDb(dbPath);
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AACrF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;AAEpC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,KA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1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapflowio/relay",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "WebSocket relay server for tapflow — NAT traversal, session routing, JWT auth, bundled dashboard",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tapflow",
|
|
@@ -46,23 +46,23 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"acme-client": "^5.4.0",
|
|
49
|
-
"better-sqlite3": "^12.
|
|
49
|
+
"better-sqlite3": "^12.11.1",
|
|
50
50
|
"busboy": "^1.6.0",
|
|
51
51
|
"jsonwebtoken": "^9.0.3",
|
|
52
52
|
"nodemailer": "^8.0.11",
|
|
53
53
|
"ws": "^8.21.0",
|
|
54
54
|
"zod": "^4.4.3",
|
|
55
|
-
"@tapflowio/agent-core": "0.9.
|
|
55
|
+
"@tapflowio/agent-core": "0.9.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/better-sqlite3": "^7.6.13",
|
|
59
59
|
"@types/busboy": "^1.5.4",
|
|
60
60
|
"@types/jsonwebtoken": "^9.0.10",
|
|
61
|
-
"@types/node": "^20.
|
|
61
|
+
"@types/node": "^20.19.43",
|
|
62
62
|
"@types/nodemailer": "^8.0.0",
|
|
63
63
|
"@types/ws": "^8.0.0",
|
|
64
64
|
"typescript": "^5.0.0",
|
|
65
|
-
"vitest": "^4.1.
|
|
65
|
+
"vitest": "^4.1.9"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsc && rm -rf dist/migrations && cp -r src/migrations dist/migrations",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{Y as T,a7 as n,a4 as e,B as b,L as y,a9 as P,K as G,I as L,S as E,g as K,al as Q,am as J}from"./index-Dfs85Uiw.js";import{d as W,S as X,P as Z,g as ee,f as se,h as ae,b as te,u as le}from"./build-format-BvNznvYq.js";import{D as z,f as M,a as U,d as V,e as q,S as k,i as D,j as A,g as C,h as c,C as ne}from"./dialog-DzNUT3NF.js";import{P as re}from"./plus-DnAOz8DL.js";import{B as O}from"./badge-Cx2-XXcg.js";import{A as ie,c as ce,f as oe,g as de,d as xe,e as ue,b as pe,a as he}from"./alert-dialog-qlHDtr4B.js";/**
|
|
2
|
+
* @license lucide-react v0.577.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const me=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],fe=T("layers",me);/**
|
|
7
|
+
* @license lucide-react v0.577.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const ge=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],je=T("package",ge);/**
|
|
12
|
+
* @license lucide-react v0.577.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const ve=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Ne=T("upload",ve);function Se({onSuccess:s,appId:l}){const[u,r]=n.useState(!1),[a,h]=n.useState(null),[o,p]=n.useState("none"),g=n.useRef(null);function f(i){if(i.preventDefault(),!a)return;const d=new FormData;d.append("file",a),o!=="none"&&d.append("status",o),l&&d.append("app_id",String(l));const N=fetch("/api/v1/builds",{method:"POST",credentials:"include",body:d}).then(async x=>{if(!x.ok){const m=await x.json().catch(()=>({}));throw new Error(m.error??"Upload failed. Check the file format.")}s()});P.promise(N,{loading:"Uploading build…",success:"Build uploaded",error:x=>x instanceof Error?x.message:"Failed to upload build"}),r(!1),h(null),p("none")}function v(i){r(i),i||(h(null),p("none"))}return e.jsxs(z,{open:u,onOpenChange:v,children:[e.jsx(M,{asChild:!0,children:e.jsxs(b,{size:"sm",children:[e.jsx(Ne,{className:"mr-2 h-4 w-4"}),"Upload build"]})}),e.jsxs(U,{className:"sm:max-w-md",children:[e.jsx(V,{children:e.jsx(q,{children:"Upload build"})}),e.jsxs("form",{onSubmit:f,className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{children:"File"}),e.jsx("div",{className:"flex h-24 cursor-pointer items-center justify-center rounded-md border-2 border-dashed text-sm text-muted-foreground hover:border-primary",onClick:()=>{var i;return(i=g.current)==null?void 0:i.click()},onDragOver:i=>i.preventDefault(),onDrop:i=>{i.preventDefault();const d=i.dataTransfer.files[0];d&&h(d)},children:a?a.name:"Click or drag to upload"}),e.jsx("input",{ref:g,type:"file",accept:".zip,.apk",className:"hidden",onChange:i=>{var d;return h(((d=i.target.files)==null?void 0:d[0])??null)}}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["iOS: ",e.jsx("code",{children:".app.zip"})," (zip the ",e.jsx("code",{children:".app"})," folder after ",e.jsx("code",{children:"xcodebuild -sdk iphonesimulator"}),") · Android: ",e.jsx("code",{children:".apk"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(y,{children:["Status ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsxs(k,{value:o,onValueChange:p,children:[e.jsx(D,{children:e.jsx(A,{})}),e.jsxs(C,{children:[e.jsx(c,{value:"none",children:"None"}),e.jsx(c,{value:"Backlog",children:"Backlog"}),e.jsx(c,{value:"In Progress",children:"In Progress"}),e.jsx(c,{value:"Done",children:"Done"}),e.jsx(c,{value:"Rejected",children:"Rejected"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(b,{type:"button",variant:"outline",className:"w-24",onClick:()=>r(!1),children:"Cancel"}),e.jsx(b,{type:"submit",className:"w-24",disabled:!a,children:"Upload"})]})]})]})]})}function w({className:s,...l}){return e.jsx("span",{className:G("font-mono text-xs tabular-nums tracking-tight",s),...l})}function be({onSuccess:s}){const[l,u]=n.useState(!1),[r,a]=n.useState(""),[h,o]=n.useState(""),[p,g]=n.useState("ios"),[f,v]=n.useState(""),[i,d]=n.useState(!1);async function N(x){x.preventDefault(),v(""),d(!0);try{const m=await W({name:r.trim(),bundle_id_key:h.trim(),platform:p});if(!m){v("Failed to create app");return}if("error"in m){v(m.error);return}u(!1),a(""),o(""),g("ios"),P.success("App created"),s()}catch{P.error("Failed to create app — check your network")}finally{d(!1)}}return e.jsxs(z,{open:l,onOpenChange:u,children:[e.jsx(M,{asChild:!0,children:e.jsxs("button",{className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:[e.jsx(re,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Add App"})]})}),e.jsxs(U,{className:"sm:max-w-sm",children:[e.jsx(V,{children:e.jsx(q,{children:"Add App"})}),e.jsxs("form",{onSubmit:N,className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(y,{htmlFor:"app-name",children:"Name"}),e.jsx(L,{id:"app-name",value:r,onChange:x=>a(x.target.value),placeholder:"My App",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(y,{htmlFor:"bundle-id",children:"Bundle ID"}),e.jsx(L,{id:"bundle-id",value:h,onChange:x=>o(x.target.value),placeholder:"com.example.myapp",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(y,{htmlFor:"platform",children:"Platform"}),e.jsxs(k,{value:p,onValueChange:x=>g(x),children:[e.jsx(D,{id:"platform",children:e.jsx(A,{})}),e.jsxs(C,{children:[e.jsx(c,{value:"ios",children:"iOS"}),e.jsx(c,{value:"android",children:"Android"}),e.jsx(c,{value:"both",children:"Both"})]})]})]}),f&&e.jsx("p",{className:"text-sm text-destructive",children:f}),e.jsx(b,{type:"submit",disabled:i,className:"w-full",children:i?"Creating…":"Create App"})]})]})]})}function ye({apps:s,selectedAppId:l,onSelect:u,onAdd:r}){return e.jsxs("aside",{className:"w-64 shrink-0 border-r flex flex-col gap-1 p-3 overflow-y-auto",children:[e.jsx("span",{className:"px-2 pb-1 font-mono text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Apps"}),s.length===0&&e.jsx("span",{className:"px-2 text-sm text-muted-foreground",children:"No apps yet"}),s.map(a=>e.jsxs("button",{onClick:()=>u(a.id),className:["flex flex-col gap-0.5 rounded-md px-2 py-2 text-left text-sm hover:bg-accent overflow-hidden",a.id===l?"bg-accent font-medium":""].join(" "),children:[e.jsx("span",{className:"truncate",children:a.name}),e.jsx(w,{className:"text-muted-foreground truncate",children:a.bundle_id_key})]},a.id)),e.jsx("div",{className:"mt-1 border-t pt-1",children:e.jsx(be,{onSuccess:r})})]})}function we(s){const r=new Date(s).getTime()+6048e5-Date.now();if(r<=0)return{label:"Expired",urgent:!0};const a=Math.floor(r/36e5);return a<1?{label:"< 1 hour left",urgent:!0}:a<24?{label:`Expires in ${a}h`,urgent:a<6}:{label:`Expires in ${Math.floor(a/24)}d`,urgent:!1}}function ke({build:s,isLast:l,onNavigate:u,onStatusChange:r}){const[a,h]=n.useState(!1),o=s.status_label==="Done",p=o&&s.completed_at?we(s.completed_at):null;function g(f){if(f==="Done"){h(!0);return}r(s.id,f==="none"?null:f)}return e.jsxs(e.Fragment,{children:[e.jsx(ie,{open:a,onOpenChange:h,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:"Mark as Done?"}),e.jsx(xe,{children:"Build files will be automatically deleted after 7 days. Reverting the status will cancel the scheduled deletion."})]}),e.jsxs(ue,{children:[e.jsx(pe,{children:"Cancel"}),e.jsx(he,{onClick:()=>{r(s.id,"Done"),h(!1)},children:"Confirm"})]})]})}),e.jsxs("div",{className:["flex items-center gap-3 px-4 py-3",l?"":"border-b"].join(" "),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-sm font-medium",children:["build ",e.jsx(w,{children:s.build_number??"—"})]}),e.jsx(O,{tone:s.platform==="ios"?"ios":"android",className:"text-xs capitalize",children:s.platform}),s.status_label&&e.jsx(O,{tone:X[s.status_label],className:"text-xs",children:s.status_label})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"14px",marginTop:"0.7rem",alignItems:"center"},className:"text-xs text-muted-foreground",children:[s.uploader&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:s.uploader}),e.jsx(E,{orientation:"vertical",className:"h-3"})]}),e.jsx(w,{children:new Date(s.uploaded_at).toLocaleDateString()}),p&&e.jsxs(e.Fragment,{children:[e.jsx(E,{orientation:"vertical",className:"h-3"}),e.jsx("span",{className:p.urgent?"text-destructive":"",children:p.label})]})]})]}),e.jsxs(k,{value:s.status_label??"none",onValueChange:g,children:[e.jsx(D,{className:"h-9 w-32 text-xs",children:e.jsx(A,{})}),e.jsxs(C,{children:[e.jsx(c,{value:"none",children:e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(c,{value:"Backlog",children:"Backlog"}),e.jsx(c,{value:"In Progress",children:"In Progress"}),e.jsx(c,{value:"Done",children:"Done"}),e.jsx(c,{value:"Rejected",children:"Rejected"})]})]}),e.jsxs(b,{size:"sm",onClick:()=>u(s.id),disabled:o,children:[e.jsx(Z,{className:"mr-1.5 h-3.5 w-3.5"}),"Start QA"]})]})]})}function De({versionName:s,builds:l,isOpen:u,onToggle:r,onNavigate:a,onStatusChange:h}){return e.jsxs("div",{className:"rounded-lg shadow-card-2 overflow-hidden",children:[e.jsxs("button",{className:"flex w-full items-center gap-2 px-4 py-3 text-left hover:bg-accent/50 bg-card",onClick:r,children:[u?e.jsx(ne,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(K,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx(w,{className:"font-medium text-sm text-foreground",children:s}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",l.length," build",l.length>1?"s":"",")"]})]}),u&&e.jsx("div",{className:"border-t bg-card",children:l.map((o,p)=>e.jsx(ke,{build:o,isLast:p===l.length-1,onNavigate:a,onStatusChange:h},o.id))})]})}function Te(){const s=Q(),[l,u]=J(),[r,a]=n.useState([]),[h,o]=n.useState([]),[p,g]=n.useState(""),[f,v]=n.useState("all"),[i,d]=n.useState(!0),[N,x]=n.useState(new Set),m=l.get("appId")?Number(l.get("appId")):null,R=r.find(t=>t.id===m)??null,_=n.useCallback(async()=>{const t=await ee();a(t),!l.get("appId")&&t.length>0&&u({appId:String(t[0].id)},{replace:!0})},[l,u]),B=n.useCallback(async()=>{if(!m){o([]),d(!1);return}d(!0);try{const t=await se({appId:m,search:p,statusFilter:f});o(t),t.length>0&&N.size===0&&x(new Set([t[0].version_name??"Unversioned"]))}finally{d(!1)}},[m,p,f]);n.useEffect(()=>{_()},[]),n.useEffect(()=>{B()},[B]);function $(t){t!==m&&(o([]),x(new Set)),u({appId:String(t)})}function H(t){x(S=>{const j=new Set(S);return j.has(t)?j.delete(t):j.add(t),j})}async function Y(t,S){await le(t,S),o(j=>j.map(I=>I.id===t?{...I,status_label:S}:I))}const F=ae(h);return e.jsxs("div",{className:"flex h-full gap-0",children:[e.jsx(ye,{apps:r,selectedAppId:m,onSelect:$,onAdd:_}),e.jsxs("main",{className:"flex-1 flex flex-col gap-4 p-4 overflow-y-auto min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-display-sm",children:R?R.name:"App Center"}),e.jsx(Se,{onSuccess:()=>{_(),B()},appId:m})]}),m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(te,{placeholder:"Search version…",value:p,onChange:g}),e.jsxs(k,{value:f,onValueChange:v,children:[e.jsx(D,{className:"h-8 w-36",children:e.jsx(A,{placeholder:"Status"})}),e.jsxs(C,{children:[e.jsx(c,{value:"all",children:"All statuses"}),e.jsx(c,{value:"Backlog",children:"Backlog"}),e.jsx(c,{value:"In Progress",children:"In Progress"}),e.jsx(c,{value:"Done",children:"Done"}),e.jsx(c,{value:"Rejected",children:"Rejected"})]})]})]}),i?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"}):F.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center",children:[e.jsx(je,{className:"w-8 h-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-sm font-medium",children:"No builds yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Upload the first build to get started."})]}):e.jsx("div",{className:"flex flex-col gap-2",children:F.map(({versionName:t,builds:S})=>e.jsx(De,{versionName:t,builds:S,isOpen:N.has(t),onToggle:()=>H(t),onNavigate:j=>s(`/app-center/build?id=${j}`),onStatusChange:Y},t))})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center",children:[e.jsx(fe,{className:"w-8 h-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-sm font-medium",children:"No app selected"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose an app from the sidebar to view its builds."})]})]})]})}export{Te as AppCenter};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ar as X,ad as Z,a9 as i,ak as S,ac as y,aq as I,a6 as e,C as g,d as j,e as v,b as w,L as m,I as u,S as M,k as O,ab as n,B as h,E as ee,J as se,H as ae,a7 as A,_ as $,aa as p}from"./index-ClAB0eKw.js";import{B as re}from"./badge-Cktrrdvf.js";import{A as te,h as oe,c as ne,f as ie,g as le,d as ce,e as de,b as me,a as ue}from"./alert-dialog-Ci_cWoVo.js";import{P as W}from"./pencil-BoxokH2R.js";const he=A({teamName:p().min(1),logo:$(File).nullable().optional()}),pe=A({displayName:p().min(1),avatar:$(File).nullable().optional()}),fe=A({currentPassword:p().min(1),newPassword:p().min(8),confirmPassword:p()}).refine(f=>f.newPassword===f.confirmPassword,{message:"Passwords do not match",path:["confirmPassword"]});function we(){const{resolvedTheme:f}=X(),J=f==="dark"?"/logo-dark.svg":"/logo.svg",{user:o}=Z(),b=(o==null?void 0:o.role)==="Admin",N=(o==null?void 0:o.role)==="Admin"||(o==null?void 0:o.role)==="Developer",[V,P]=i.useState(null),k=i.useRef(null),d=S({resolver:y(he),mode:"onBlur",defaultValues:{teamName:"",logo:null}});i.useEffect(()=>{b&&fetch("/api/v1/settings",{credentials:"include"}).then(s=>s.ok?s.json():null).then(s=>{s&&(d.reset({teamName:s.team_name,logo:null}),P(s.logo_url))})},[b]);async function q(s){const a=new FormData;a.append("team_name",s.teamName),s.logo&&a.append("logo",s.logo);try{if(!(await fetch("/api/v1/settings",{method:"PATCH",credentials:"include",body:a})).ok){n.error("Failed to update workspace");return}n.success("Workspace updated")}catch{n.error("Failed to update workspace")}}const[C,F]=i.useState(null),D=i.useRef(null),c=S({resolver:y(pe),mode:"onBlur",defaultValues:{displayName:"",avatar:null}});i.useEffect(()=>{o&&(c.reset({displayName:o.displayName??"",avatar:null}),F(o.avatarUrl??null))},[o]);async function Q(s){const a=new FormData;a.append("display_name",s.displayName),s.avatar&&a.append("avatar",s.avatar);try{if(!(await fetch("/api/v1/profile",{method:"PATCH",credentials:"include",body:a})).ok){n.error("Failed to update profile");return}n.success("Profile updated")}catch{n.error("Failed to update profile")}}const t=S({resolver:y(fe),mode:"onBlur"});async function Y(s){try{const a=await fetch("/api/v1/auth/change-password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:s.currentPassword,newPassword:s.newPassword})});if(!a.ok){const r=await a.json();t.setError("root",{message:r.error??"Failed to change password"});return}t.reset(),n.success("Password changed")}catch{t.setError("root",{message:"Network error"})}}const[T,E]=i.useState([]),[B,L]=i.useState({}),[U,z]=i.useState({}),[R,_]=i.useState({});i.useEffect(()=>{N&&fetch("/api/v1/apps",{credentials:"include"}).then(s=>s.ok?s.json():null).then(s=>{if(!s)return;E(s.items);const a={};s.items.forEach(r=>{a[r.id]=r.name}),L(a)})},[N]);async function G(s){_(a=>({...a,[s]:!0}));try{if(!(await fetch(`/api/v1/apps/${s}`,{method:"DELETE",credentials:"include"})).ok){n.error("Failed to delete app");return}E(r=>r.filter(l=>l.id!==s)),n.success("App deleted")}catch{n.error("Failed to delete app")}finally{_(a=>({...a,[s]:!1}))}}async function K(s){z(a=>({...a,[s]:!0}));try{if(!(await fetch(`/api/v1/apps/${s}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B[s]})})).ok){n.error("Failed to update app");return}n.success("App updated")}catch{n.error("Failed to update app")}finally{z(a=>({...a,[s]:!1}))}}const x=I({control:c.control,name:"displayName"});return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[900px] mx-auto w-full p-6",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-display-sm",children:"Settings"}),b&&e.jsxs(g,{children:[e.jsx(j,{children:e.jsx(v,{children:"Workspace"})}),e.jsx(w,{children:e.jsxs("form",{onSubmit:d.handleSubmit(q),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"team-name",children:"Team name"}),e.jsx(u,{id:"team-name",placeholder:"My QA Team",...d.register("teamName")}),d.formState.errors.teamName&&e.jsx("p",{className:"text-sm text-destructive",children:d.formState.errors.teamName.message})]}),e.jsx(M,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{children:["Logo ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(png · jpg, max 2MB)"})]}),e.jsx(O,{name:"logo",control:d.control,render:({field:s})=>e.jsxs("div",{className:"relative w-16 h-16",children:[e.jsx("img",{src:V??J,alt:"logo",className:"w-16 h-16 rounded-lg object-contain"}),e.jsx("button",{type:"button",onClick:()=>{var a;return(a=k.current)==null?void 0:a.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(W,{className:"w-3 h-3"})}),e.jsx("input",{ref:k,type:"file",accept:".png,.jpg,.jpeg",className:"hidden",onChange:a=>{var l;const r=(l=a.target.files)==null?void 0:l[0];if(r&&r.size>2*1024*1024){n.error("Image must be 2MB or less");return}r&&(s.onChange(r),P(URL.createObjectURL(r)))}})]})})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(h,{type:"submit",size:"sm",disabled:d.formState.isSubmitting,children:d.formState.isSubmitting?"Saving…":"Save changes"})})]})})]}),e.jsxs(g,{children:[e.jsx(j,{children:e.jsx(v,{children:"Profile"})}),e.jsx(w,{children:e.jsxs("form",{onSubmit:c.handleSubmit(Q),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"display-name",children:"Nickname"}),e.jsx(u,{id:"display-name",placeholder:"Your name",...c.register("displayName")}),c.formState.errors.displayName&&e.jsx("p",{className:"text-sm text-destructive",children:c.formState.errors.displayName.message})]}),e.jsx(M,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{children:["Avatar ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(png · jpg, max 2MB)"})]}),e.jsx(O,{name:"avatar",control:c.control,render:({field:s})=>{var a;return e.jsxs("div",{className:"relative w-14 h-14",children:[C?e.jsx("img",{src:C,alt:"avatar",className:"w-14 h-14 rounded-full object-cover border"}):e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center text-lg font-medium",style:(()=>{const r=ee(x||(o==null?void 0:o.email)||"");return{backgroundColor:r.bg,color:r.fg}})(),children:((a=x==null?void 0:x[0])==null?void 0:a.toUpperCase())??"?"}),e.jsx("button",{type:"button",onClick:()=>{var r;return(r=D.current)==null?void 0:r.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(W,{className:"w-3 h-3"})}),e.jsx("input",{ref:D,type:"file",accept:".png,.jpg,.jpeg",className:"hidden",onChange:r=>{var H;const l=(H=r.target.files)==null?void 0:H[0];if(l&&l.size>2*1024*1024){n.error("Image must be 2MB or less");return}l&&(s.onChange(l),F(URL.createObjectURL(l)))}})]})}})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(h,{type:"submit",size:"sm",disabled:c.formState.isSubmitting,children:c.formState.isSubmitting?"Saving…":"Save changes"})})]})})]}),e.jsxs(g,{children:[e.jsx(j,{children:e.jsx(v,{children:"Password"})}),e.jsx(w,{children:e.jsxs("form",{onSubmit:t.handleSubmit(Y),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"current-password",children:"Current password"}),e.jsx(u,{id:"current-password",type:"password",...t.register("currentPassword")}),t.formState.errors.currentPassword&&e.jsx("p",{className:"text-sm text-destructive",children:t.formState.errors.currentPassword.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"new-password",children:"New password"}),e.jsx(u,{id:"new-password",type:"password",...t.register("newPassword")}),t.formState.errors.newPassword&&e.jsx("p",{className:"text-sm text-destructive",children:t.formState.errors.newPassword.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"confirm-password",children:"Confirm new password"}),e.jsx(u,{id:"confirm-password",type:"password",...t.register("confirmPassword")}),t.formState.errors.confirmPassword&&e.jsx("p",{className:"text-sm text-destructive",children:t.formState.errors.confirmPassword.message})]}),t.formState.errors.root&&e.jsx("p",{className:"text-sm text-destructive",children:t.formState.errors.root.message}),e.jsx("div",{className:"flex justify-end",children:e.jsx(h,{type:"submit",size:"sm",disabled:t.formState.isSubmitting,children:t.formState.isSubmitting?"Saving…":"Change password"})})]})})]}),N&&T.length>0&&e.jsxs(g,{children:[e.jsx(j,{children:e.jsx(v,{children:"Apps"})}),e.jsx(w,{children:e.jsx("div",{className:"flex flex-col divide-y divide-border",children:T.map(s=>e.jsxs("div",{className:"flex flex-col gap-2 py-4 first:pt-0 last:pb-0",children:[e.jsx(m,{htmlFor:`app-${s.id}`,children:"App Name"}),e.jsx(u,{id:`app-${s.id}`,value:B[s.id]??"",onChange:a=>L(r=>({...r,[s.id]:a.target.value}))}),e.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:s.bundle_id_key}),e.jsx(re,{tone:s.platform==="ios"?"ios":s.platform==="android"?"android":void 0,variant:s.platform==="both"?"secondary":void 0,className:"capitalize",children:s.platform})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(h,{size:"sm",variant:"outline",disabled:U[s.id],onClick:()=>K(s.id),children:U[s.id]?"Saving…":"Save"}),e.jsxs(te,{children:[e.jsx(oe,{asChild:!0,children:e.jsx(h,{size:"sm",variant:"destructive",disabled:R[s.id],children:R[s.id]?"Deleting…":"Delete"})}),e.jsxs(ne,{children:[e.jsxs(ie,{children:[e.jsx(le,{children:"Delete app?"}),e.jsxs(ce,{children:["This will permanently delete ",e.jsx("strong",{children:s.name})," and all its builds. This action cannot be undone."]})]}),e.jsxs(de,{children:[e.jsx(me,{className:"w-24",children:"Cancel"}),e.jsx(ue,{className:se(ae({variant:"destructive"}),"w-24"),onClick:()=>G(s.id),children:"Delete"})]})]})]})]})]})]},s.id))})})]})]})}export{we as DefaultSettings};
|
|
1
|
+
import{ap as X,ab as Z,a7 as i,ai as S,aa as y,ao as I,a4 as e,C as g,d as j,e as v,b as w,L as m,I as u,S as M,i as O,a9 as n,B as h,G as ee,K as se,J as ae,a5 as A,_ as $,a8 as p}from"./index-Dfs85Uiw.js";import{B as re}from"./badge-Cx2-XXcg.js";import{A as te,h as oe,c as ne,f as ie,g as le,d as ce,e as de,b as me,a as ue}from"./alert-dialog-qlHDtr4B.js";import{P as W}from"./pencil-CrO7Me4O.js";const he=A({teamName:p().min(1),logo:$(File).nullable().optional()}),pe=A({displayName:p().min(1),avatar:$(File).nullable().optional()}),fe=A({currentPassword:p().min(1),newPassword:p().min(8),confirmPassword:p()}).refine(f=>f.newPassword===f.confirmPassword,{message:"Passwords do not match",path:["confirmPassword"]});function we(){const{resolvedTheme:f}=X(),J=f==="dark"?"/logo-dark.svg":"/logo.svg",{user:o}=Z(),b=(o==null?void 0:o.role)==="Admin",N=(o==null?void 0:o.role)==="Admin"||(o==null?void 0:o.role)==="Developer",[V,P]=i.useState(null),C=i.useRef(null),d=S({resolver:y(he),mode:"onBlur",defaultValues:{teamName:"",logo:null}});i.useEffect(()=>{b&&fetch("/api/v1/settings",{credentials:"include"}).then(s=>s.ok?s.json():null).then(s=>{s&&(d.reset({teamName:s.team_name,logo:null}),P(s.logo_url))})},[b]);async function G(s){const a=new FormData;a.append("team_name",s.teamName),s.logo&&a.append("logo",s.logo);try{if(!(await fetch("/api/v1/settings",{method:"PATCH",credentials:"include",body:a})).ok){n.error("Failed to update workspace");return}n.success("Workspace updated")}catch{n.error("Failed to update workspace")}}const[k,F]=i.useState(null),D=i.useRef(null),c=S({resolver:y(pe),mode:"onBlur",defaultValues:{displayName:"",avatar:null}});i.useEffect(()=>{o&&(c.reset({displayName:o.displayName??"",avatar:null}),F(o.avatarUrl??null))},[o]);async function K(s){const a=new FormData;a.append("display_name",s.displayName),s.avatar&&a.append("avatar",s.avatar);try{if(!(await fetch("/api/v1/profile",{method:"PATCH",credentials:"include",body:a})).ok){n.error("Failed to update profile");return}n.success("Profile updated")}catch{n.error("Failed to update profile")}}const t=S({resolver:y(fe),mode:"onBlur"});async function Q(s){try{const a=await fetch("/api/v1/auth/change-password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:s.currentPassword,newPassword:s.newPassword})});if(!a.ok){const r=await a.json();t.setError("root",{message:r.error??"Failed to change password"});return}t.reset(),n.success("Password changed")}catch{t.setError("root",{message:"Network error"})}}const[T,E]=i.useState([]),[B,L]=i.useState({}),[U,z]=i.useState({}),[R,_]=i.useState({});i.useEffect(()=>{N&&fetch("/api/v1/apps",{credentials:"include"}).then(s=>s.ok?s.json():null).then(s=>{if(!s)return;E(s.items);const a={};s.items.forEach(r=>{a[r.id]=r.name}),L(a)})},[N]);async function Y(s){_(a=>({...a,[s]:!0}));try{if(!(await fetch(`/api/v1/apps/${s}`,{method:"DELETE",credentials:"include"})).ok){n.error("Failed to delete app");return}E(r=>r.filter(l=>l.id!==s)),n.success("App deleted")}catch{n.error("Failed to delete app")}finally{_(a=>({...a,[s]:!1}))}}async function q(s){z(a=>({...a,[s]:!0}));try{if(!(await fetch(`/api/v1/apps/${s}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B[s]})})).ok){n.error("Failed to update app");return}n.success("App updated")}catch{n.error("Failed to update app")}finally{z(a=>({...a,[s]:!1}))}}const x=I({control:c.control,name:"displayName"});return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[900px] mx-auto w-full p-6",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-display-sm",children:"Settings"}),b&&e.jsxs(g,{children:[e.jsx(j,{children:e.jsx(v,{children:"Workspace"})}),e.jsx(w,{children:e.jsxs("form",{onSubmit:d.handleSubmit(G),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"team-name",children:"Team name"}),e.jsx(u,{id:"team-name",placeholder:"My QA Team",...d.register("teamName")}),d.formState.errors.teamName&&e.jsx("p",{className:"text-sm text-destructive",children:d.formState.errors.teamName.message})]}),e.jsx(M,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{children:["Logo ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(png · jpg, max 2MB)"})]}),e.jsx(O,{name:"logo",control:d.control,render:({field:s})=>e.jsxs("div",{className:"relative w-16 h-16",children:[e.jsx("img",{src:V??J,alt:"logo",className:"w-16 h-16 rounded-lg object-contain"}),e.jsx("button",{type:"button",onClick:()=>{var a;return(a=C.current)==null?void 0:a.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(W,{className:"w-3 h-3"})}),e.jsx("input",{ref:C,type:"file",accept:".png,.jpg,.jpeg",className:"hidden",onChange:a=>{var l;const r=(l=a.target.files)==null?void 0:l[0];if(r&&r.size>2*1024*1024){n.error("Image must be 2MB or less");return}r&&(s.onChange(r),P(URL.createObjectURL(r)))}})]})})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(h,{type:"submit",size:"sm",disabled:d.formState.isSubmitting,children:d.formState.isSubmitting?"Saving…":"Save changes"})})]})})]}),e.jsxs(g,{children:[e.jsx(j,{children:e.jsx(v,{children:"Profile"})}),e.jsx(w,{children:e.jsxs("form",{onSubmit:c.handleSubmit(K),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"display-name",children:"Nickname"}),e.jsx(u,{id:"display-name",placeholder:"Your name",...c.register("displayName")}),c.formState.errors.displayName&&e.jsx("p",{className:"text-sm text-destructive",children:c.formState.errors.displayName.message})]}),e.jsx(M,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{children:["Avatar ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(png · jpg, max 2MB)"})]}),e.jsx(O,{name:"avatar",control:c.control,render:({field:s})=>{var a;return e.jsxs("div",{className:"relative w-14 h-14",children:[k?e.jsx("img",{src:k,alt:"avatar",className:"w-14 h-14 rounded-full object-cover border"}):e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center text-lg font-medium",style:(()=>{const r=ee(x||(o==null?void 0:o.email)||"");return{backgroundColor:r.bg,color:r.fg}})(),children:((a=x==null?void 0:x[0])==null?void 0:a.toUpperCase())??"?"}),e.jsx("button",{type:"button",onClick:()=>{var r;return(r=D.current)==null?void 0:r.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(W,{className:"w-3 h-3"})}),e.jsx("input",{ref:D,type:"file",accept:".png,.jpg,.jpeg",className:"hidden",onChange:r=>{var H;const l=(H=r.target.files)==null?void 0:H[0];if(l&&l.size>2*1024*1024){n.error("Image must be 2MB or less");return}l&&(s.onChange(l),F(URL.createObjectURL(l)))}})]})}})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(h,{type:"submit",size:"sm",disabled:c.formState.isSubmitting,children:c.formState.isSubmitting?"Saving…":"Save changes"})})]})})]}),e.jsxs(g,{children:[e.jsx(j,{children:e.jsx(v,{children:"Password"})}),e.jsx(w,{children:e.jsxs("form",{onSubmit:t.handleSubmit(Q),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"current-password",children:"Current password"}),e.jsx(u,{id:"current-password",type:"password",...t.register("currentPassword")}),t.formState.errors.currentPassword&&e.jsx("p",{className:"text-sm text-destructive",children:t.formState.errors.currentPassword.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"new-password",children:"New password"}),e.jsx(u,{id:"new-password",type:"password",...t.register("newPassword")}),t.formState.errors.newPassword&&e.jsx("p",{className:"text-sm text-destructive",children:t.formState.errors.newPassword.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"confirm-password",children:"Confirm new password"}),e.jsx(u,{id:"confirm-password",type:"password",...t.register("confirmPassword")}),t.formState.errors.confirmPassword&&e.jsx("p",{className:"text-sm text-destructive",children:t.formState.errors.confirmPassword.message})]}),t.formState.errors.root&&e.jsx("p",{className:"text-sm text-destructive",children:t.formState.errors.root.message}),e.jsx("div",{className:"flex justify-end",children:e.jsx(h,{type:"submit",size:"sm",disabled:t.formState.isSubmitting,children:t.formState.isSubmitting?"Saving…":"Change password"})})]})})]}),N&&T.length>0&&e.jsxs(g,{children:[e.jsx(j,{children:e.jsx(v,{children:"Apps"})}),e.jsx(w,{children:e.jsx("div",{className:"flex flex-col divide-y divide-border",children:T.map(s=>e.jsxs("div",{className:"flex flex-col gap-2 py-4 first:pt-0 last:pb-0",children:[e.jsx(m,{htmlFor:`app-${s.id}`,children:"App Name"}),e.jsx(u,{id:`app-${s.id}`,value:B[s.id]??"",onChange:a=>L(r=>({...r,[s.id]:a.target.value}))}),e.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:s.bundle_id_key}),e.jsx(re,{tone:s.platform==="ios"?"ios":s.platform==="android"?"android":void 0,variant:s.platform==="both"?"secondary":void 0,className:"capitalize",children:s.platform})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(h,{size:"sm",variant:"outline",disabled:U[s.id],onClick:()=>q(s.id),children:U[s.id]?"Saving…":"Save"}),e.jsxs(te,{children:[e.jsx(oe,{asChild:!0,children:e.jsx(h,{size:"sm",variant:"destructive",disabled:R[s.id],children:R[s.id]?"Deleting…":"Delete"})}),e.jsxs(ne,{children:[e.jsxs(ie,{children:[e.jsx(le,{children:"Delete app?"}),e.jsxs(ce,{children:["This will permanently delete ",e.jsx("strong",{children:s.name})," and all its builds. This action cannot be undone."]})]}),e.jsxs(de,{children:[e.jsx(me,{className:"w-24",children:"Cancel"}),e.jsx(ue,{className:se(ae({variant:"destructive"}),"w-24"),onClick:()=>Y(s.id),children:"Delete"})]})]})]})]})]})]},s.id))})})]})]})}export{we as DefaultSettings};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{al as E,am as L,a7 as i,ai as A,aa as M,ao as T,a4 as e,C as b,d as y,e as C,c as k,b as U,L as d,I as x,i as _,G as D,S as O,B as Y,a5 as z,a8 as h,_ as G}from"./index-Dfs85Uiw.js";import{P as H}from"./pencil-CrO7Me4O.js";const V=z({displayName:h().optional(),avatar:G(File).nullable().optional(),password:h().min(8),confirm:h()}).refine(o=>o.password===o.confirm,{message:"Passwords do not match",path:["confirm"]});function q(){const o=E(),[S]=L(),c=S.get("token")??"",[f,m]=i.useState("loading"),[P,F]=i.useState(""),[v,R]=i.useState(null),j=i.useRef(null),{register:p,handleSubmit:B,control:g,setError:u,formState:{errors:t,isSubmitting:w}}=A({resolver:M(V),mode:"onBlur",defaultValues:{displayName:"",avatar:null}}),l=T({control:g,name:"displayName"})??"";i.useEffect(()=>{if(!c){m("invalid");return}fetch(`/api/v1/invitations/verify?token=${c}`).then(a=>a.ok?a.json():Promise.reject()).then(a=>{F(a.role),m("valid")}).catch(()=>m("invalid"))},[c]);async function I(a){var r;try{const s=new FormData;if(s.append("token",c),s.append("password",a.password),(r=a.displayName)!=null&&r.trim()&&s.append("display_name",a.displayName.trim()),a.avatar&&s.append("avatar",a.avatar),!(await fetch("/api/v1/invitations/accept",{method:"POST",body:s})).ok){u("root",{message:"Failed to accept invitation"});return}o("/app-center",{replace:!0})}catch{u("root",{message:"Network error. Please try again."})}}return f==="loading"?e.jsx("div",{className:"flex min-h-svh items-center justify-center"}):f==="invalid"?e.jsx("div",{className:"bg-mesh-gradient flex min-h-svh items-center justify-center overflow-hidden p-4",children:e.jsx(b,{level:4,className:"w-full max-w-sm text-center",children:e.jsxs(y,{children:[e.jsx(C,{children:"Invitation expired"}),e.jsx(k,{children:"This invite link is invalid or has expired. Ask your admin for a new one."})]})})}):e.jsx("div",{className:"bg-mesh-gradient flex min-h-svh items-center justify-center overflow-hidden p-4",children:e.jsxs(b,{level:4,className:"w-full max-w-sm",children:[e.jsxs(y,{className:"text-center",children:[e.jsx(C,{children:"Set up your account"}),e.jsxs(k,{children:["You're joining as ",e.jsx("strong",{children:P})]})]}),e.jsx(U,{children:e.jsxs("form",{onSubmit:B(I),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(d,{htmlFor:"display-name",children:["Nickname ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),e.jsx(x,{id:"display-name",placeholder:"Your name",...p("displayName")})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(d,{children:["Avatar ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional, png · jpg, max 2MB)"})]}),e.jsx(_,{name:"avatar",control:g,render:({field:a})=>{var r;return e.jsxs("div",{className:"relative w-14 h-14",children:[v?e.jsx("img",{src:v,alt:"avatar",className:"w-14 h-14 rounded-full object-cover border"}):e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center text-lg font-medium",style:(()=>{const s=D(l);return{backgroundColor:s.bg,color:s.fg}})(),children:((r=l==null?void 0:l[0])==null?void 0:r.toUpperCase())??"?"}),e.jsx("button",{type:"button",onClick:()=>{var s;return(s=j.current)==null?void 0:s.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(H,{className:"w-3 h-3"})}),e.jsx("input",{ref:j,type:"file",accept:"image/png,image/jpeg",className:"hidden",onChange:s=>{var N;const n=(N=s.target.files)==null?void 0:N[0];if(n){if(n.size>2*1024*1024){u("avatar",{message:"Max 2MB for avatar"});return}a.onChange(n),R(URL.createObjectURL(n))}}})]})}}),t.avatar&&e.jsx("p",{className:"text-sm text-destructive",children:t.avatar.message})]}),e.jsx(O,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(d,{htmlFor:"password",children:"Password"}),e.jsx(x,{id:"password",type:"password",...p("password")}),t.password&&e.jsx("p",{className:"text-sm text-destructive",children:t.password.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(d,{htmlFor:"confirm",children:"Confirm password"}),e.jsx(x,{id:"confirm",type:"password",...p("confirm")}),t.confirm&&e.jsx("p",{className:"text-sm text-destructive",children:t.confirm.message})]}),t.root&&e.jsx("p",{className:"text-sm text-destructive",children:t.root.message}),e.jsx(Y,{type:"submit",disabled:w,className:"w-full",children:w?"Creating account…":"Create account"})]})})]})})}export{q as Invite};
|
|
Binary file
|