Drop the domain from public AI prompt URLs.
Copied links now use business name and prompt name only; old host-prefixed URLs still resolve. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
73588db1c6
commit
dcf8b6423a
@@ -101,19 +101,19 @@ export class AiPromptsController {
|
|||||||
|
|
||||||
@Get('public/ai-prompts/:host/:name/:prompt/:publicId')
|
@Get('public/ai-prompts/:host/:name/:prompt/:publicId')
|
||||||
@Header('Content-Type', 'text/plain; charset=utf-8')
|
@Header('Content-Type', 'text/plain; charset=utf-8')
|
||||||
getPublicFull(@Param('publicId') publicId: string) {
|
getPublicLegacyHost(@Param('publicId') publicId: string) {
|
||||||
return this.service.getPublicText(publicId);
|
return this.service.getPublicText(publicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('public/ai-prompts/:host/:name/:publicId')
|
@Get('public/ai-prompts/:name/:prompt/:publicId')
|
||||||
@Header('Content-Type', 'text/plain; charset=utf-8')
|
@Header('Content-Type', 'text/plain; charset=utf-8')
|
||||||
getPublicLabeled(@Param('publicId') publicId: string) {
|
getPublicLabeled(@Param('publicId') publicId: string) {
|
||||||
return this.service.getPublicText(publicId);
|
return this.service.getPublicText(publicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('public/ai-prompts/:host/:publicId')
|
@Get('public/ai-prompts/:name/:publicId')
|
||||||
@Header('Content-Type', 'text/plain; charset=utf-8')
|
@Header('Content-Type', 'text/plain; charset=utf-8')
|
||||||
getPublicHost(@Param('publicId') publicId: string) {
|
getPublicNamed(@Param('publicId') publicId: string) {
|
||||||
return this.service.getPublicText(publicId);
|
return this.service.getPublicText(publicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ export class AiPromptsService {
|
|||||||
private publicUrl(
|
private publicUrl(
|
||||||
publicId: string,
|
publicId: string,
|
||||||
labels?: {
|
labels?: {
|
||||||
host?: string | null;
|
|
||||||
name?: string | null;
|
name?: string | null;
|
||||||
promptName?: string | null;
|
promptName?: string | null;
|
||||||
},
|
},
|
||||||
@@ -63,7 +62,6 @@ export class AiPromptsService {
|
|||||||
const base =
|
const base =
|
||||||
this.config.get<string>('API_PUBLIC_BASE_URL')?.replace(/\/$/, '') ||
|
this.config.get<string>('API_PUBLIC_BASE_URL')?.replace(/\/$/, '') ||
|
||||||
'https://api.meshkee.com';
|
'https://api.meshkee.com';
|
||||||
const host = labels?.host?.trim().toLowerCase();
|
|
||||||
const nameSlug = labels?.name?.trim()
|
const nameSlug = labels?.name?.trim()
|
||||||
? this.slugSegment(labels.name)
|
? this.slugSegment(labels.name)
|
||||||
: '';
|
: '';
|
||||||
@@ -71,7 +69,6 @@ export class AiPromptsService {
|
|||||||
? this.slugSegment(labels.promptName)
|
? this.slugSegment(labels.promptName)
|
||||||
: '';
|
: '';
|
||||||
const parts = [
|
const parts = [
|
||||||
host ? encodeURIComponent(host) : '',
|
|
||||||
nameSlug ? encodeURIComponent(nameSlug) : '',
|
nameSlug ? encodeURIComponent(nameSlug) : '',
|
||||||
promptSlug ? encodeURIComponent(promptSlug) : '',
|
promptSlug ? encodeURIComponent(promptSlug) : '',
|
||||||
publicId,
|
publicId,
|
||||||
@@ -120,7 +117,6 @@ export class AiPromptsService {
|
|||||||
body: row.body,
|
body: row.body,
|
||||||
publicId: row.publicId,
|
publicId: row.publicId,
|
||||||
publicUrl: this.publicUrl(row.publicId, {
|
publicUrl: this.publicUrl(row.publicId, {
|
||||||
host: labels?.host,
|
|
||||||
name: labels?.name,
|
name: labels?.name,
|
||||||
promptName: row.name,
|
promptName: row.name,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user