fix: demo page inlanding
This commit is contained in:
parent
bfff9b49ec
commit
97502ddae1
|
|
@ -89,35 +89,14 @@ export const createApp = (): Application => {
|
||||||
const apiKey = await apiKeyService.validateKey(providedKey);
|
const apiKey = await apiKeyService.validateKey(providedKey);
|
||||||
|
|
||||||
if (apiKey) {
|
if (apiKey) {
|
||||||
// Query org and project names
|
// Use slugs from validated API key (already fetched via LEFT JOIN)
|
||||||
let organizationName = apiKey.organizationId;
|
|
||||||
let projectName = apiKey.projectId;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const { db } = await import('./db');
|
|
||||||
const { organizations, projects } = await import('@banatie/database');
|
|
||||||
const { eq } = await import('drizzle-orm');
|
|
||||||
|
|
||||||
if (apiKey.organizationId) {
|
|
||||||
const org = await db.select().from(organizations).where(eq(organizations.id, apiKey.organizationId)).limit(1);
|
|
||||||
if (org.length > 0) organizationName = org[0].name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (apiKey.projectId) {
|
|
||||||
const proj = await db.select().from(projects).where(eq(projects.id, apiKey.projectId)).limit(1);
|
|
||||||
if (proj.length > 0) projectName = proj[0].name;
|
|
||||||
}
|
|
||||||
} catch (dbError) {
|
|
||||||
// Fallback to IDs if DB query fails
|
|
||||||
}
|
|
||||||
|
|
||||||
info.authenticated = true;
|
info.authenticated = true;
|
||||||
info.keyInfo = {
|
info.keyInfo = {
|
||||||
type: apiKey.keyType,
|
type: apiKey.keyType,
|
||||||
organizationId: apiKey.organizationId,
|
organizationId: apiKey.organizationId,
|
||||||
organizationName,
|
organizationSlug: apiKey.organizationSlug,
|
||||||
projectId: apiKey.projectId,
|
projectId: apiKey.projectId,
|
||||||
projectName,
|
projectSlug: apiKey.projectSlug,
|
||||||
expiresAt: apiKey.expiresAt
|
expiresAt: apiKey.expiresAt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ interface GenerationResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ApiKeyInfo {
|
interface ApiKeyInfo {
|
||||||
organizationName?: string;
|
organizationSlug?: string;
|
||||||
projectName?: string;
|
projectSlug?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function DemoTTIPage() {
|
export default function DemoTTIPage() {
|
||||||
|
|
@ -74,13 +74,13 @@ export default function DemoTTIPage() {
|
||||||
// Extract org/project info from API response
|
// Extract org/project info from API response
|
||||||
if (data.keyInfo) {
|
if (data.keyInfo) {
|
||||||
setApiKeyInfo({
|
setApiKeyInfo({
|
||||||
organizationName: data.keyInfo.organizationName || data.keyInfo.organizationId,
|
organizationSlug: data.keyInfo.organizationSlug || data.keyInfo.organizationId,
|
||||||
projectName: data.keyInfo.projectName || data.keyInfo.projectId,
|
projectSlug: data.keyInfo.projectSlug || data.keyInfo.projectId,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setApiKeyInfo({
|
setApiKeyInfo({
|
||||||
organizationName: 'Unknown',
|
organizationSlug: 'Unknown',
|
||||||
projectName: 'Unknown',
|
projectSlug: 'Unknown',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
|
|
@ -264,7 +264,7 @@ export default function DemoTTIPage() {
|
||||||
|
|
||||||
{apiKeyValidated && apiKeyInfo && (
|
{apiKeyValidated && apiKeyInfo && (
|
||||||
<div className="mt-3 text-sm text-green-400">
|
<div className="mt-3 text-sm text-green-400">
|
||||||
✓ Validated • {apiKeyInfo.organizationName} / {apiKeyInfo.projectName}
|
✓ Validated • {apiKeyInfo.organizationSlug} / {apiKeyInfo.projectSlug}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"kill-port": "^2.0.1",
|
||||||
"typescript": "^5.9.2"
|
"typescript": "^5.9.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,9 @@ importers:
|
||||||
|
|
||||||
.:
|
.:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
kill-port:
|
||||||
|
specifier: ^2.0.1
|
||||||
|
version: 2.0.1
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.9.2
|
specifier: ^5.9.2
|
||||||
version: 5.9.2
|
version: 5.9.2
|
||||||
|
|
@ -163,6 +166,9 @@ importers:
|
||||||
|
|
||||||
apps/landing:
|
apps/landing:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@banatie/database':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../../packages/database
|
||||||
next:
|
next:
|
||||||
specifier: 15.5.4
|
specifier: 15.5.4
|
||||||
version: 15.5.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
version: 15.5.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||||
|
|
@ -2997,6 +3003,9 @@ packages:
|
||||||
resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==}
|
resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
|
get-them-args@1.3.2:
|
||||||
|
resolution: {integrity: sha512-LRn8Jlk+DwZE4GTlDbT3Hikd1wSHgLMme/+7ddlqKd7ldwR6LjJgTVWzBnR01wnYGe4KgrXjg287RaI22UHmAw==}
|
||||||
|
|
||||||
get-tsconfig@4.10.1:
|
get-tsconfig@4.10.1:
|
||||||
resolution: {integrity: sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==}
|
resolution: {integrity: sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==}
|
||||||
|
|
||||||
|
|
@ -3535,6 +3544,10 @@ packages:
|
||||||
keyv@4.5.4:
|
keyv@4.5.4:
|
||||||
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
|
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
|
||||||
|
|
||||||
|
kill-port@2.0.1:
|
||||||
|
resolution: {integrity: sha512-e0SVOV5jFo0mx8r7bS29maVWp17qGqLBZ5ricNSajON6//kmb7qqqNnml4twNE8Dtj97UQD+gNFOaipS/q1zzQ==}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
kleur@3.0.3:
|
kleur@3.0.3:
|
||||||
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
|
|
@ -4312,6 +4325,9 @@ packages:
|
||||||
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
|
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
|
shell-exec@1.0.2:
|
||||||
|
resolution: {integrity: sha512-jyVd+kU2X+mWKMmGhx4fpWbPsjvD53k9ivqetutVW/BQ+WIZoDoP4d8vUMGezV6saZsiNoW2f9GIhg9Dondohg==}
|
||||||
|
|
||||||
side-channel-list@1.0.0:
|
side-channel-list@1.0.0:
|
||||||
resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
|
resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
@ -7263,7 +7279,7 @@ snapshots:
|
||||||
eslint: 8.57.1
|
eslint: 8.57.1
|
||||||
eslint-import-resolver-node: 0.3.9
|
eslint-import-resolver-node: 0.3.9
|
||||||
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint@8.57.1))(eslint@8.57.1)
|
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint@8.57.1))(eslint@8.57.1)
|
||||||
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
|
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1)
|
||||||
eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1)
|
eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1)
|
||||||
eslint-plugin-react: 7.37.5(eslint@8.57.1)
|
eslint-plugin-react: 7.37.5(eslint@8.57.1)
|
||||||
eslint-plugin-react-hooks: 5.0.0-canary-7118f5dd7-20230705(eslint@8.57.1)
|
eslint-plugin-react-hooks: 5.0.0-canary-7118f5dd7-20230705(eslint@8.57.1)
|
||||||
|
|
@ -7297,7 +7313,7 @@ snapshots:
|
||||||
tinyglobby: 0.2.15
|
tinyglobby: 0.2.15
|
||||||
unrs-resolver: 1.11.1
|
unrs-resolver: 1.11.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
|
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
|
@ -7312,7 +7328,7 @@ snapshots:
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1):
|
eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.44.0(eslint@8.57.1)(typescript@5.9.2))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@rtsao/scc': 1.1.0
|
'@rtsao/scc': 1.1.0
|
||||||
array-includes: 3.1.9
|
array-includes: 3.1.9
|
||||||
|
|
@ -7778,6 +7794,8 @@ snapshots:
|
||||||
es-errors: 1.3.0
|
es-errors: 1.3.0
|
||||||
get-intrinsic: 1.3.0
|
get-intrinsic: 1.3.0
|
||||||
|
|
||||||
|
get-them-args@1.3.2: {}
|
||||||
|
|
||||||
get-tsconfig@4.10.1:
|
get-tsconfig@4.10.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
resolve-pkg-maps: 1.0.0
|
resolve-pkg-maps: 1.0.0
|
||||||
|
|
@ -8551,6 +8569,11 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
json-buffer: 3.0.1
|
json-buffer: 3.0.1
|
||||||
|
|
||||||
|
kill-port@2.0.1:
|
||||||
|
dependencies:
|
||||||
|
get-them-args: 1.3.2
|
||||||
|
shell-exec: 1.0.2
|
||||||
|
|
||||||
kleur@3.0.3: {}
|
kleur@3.0.3: {}
|
||||||
|
|
||||||
kuler@2.0.0: {}
|
kuler@2.0.0: {}
|
||||||
|
|
@ -9355,6 +9378,8 @@ snapshots:
|
||||||
|
|
||||||
shebang-regex@3.0.0: {}
|
shebang-regex@3.0.0: {}
|
||||||
|
|
||||||
|
shell-exec@1.0.2: {}
|
||||||
|
|
||||||
side-channel-list@1.0.0:
|
side-channel-list@1.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
es-errors: 1.3.0
|
es-errors: 1.3.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue