22 lines
674 B
TypeScript
22 lines
674 B
TypeScript
/** Details use the member portal's own login; API credentials never enter a URL. */
|
|
export function turkservisComboDetailsUrl(apiUrl: string | undefined, model: string): string | null {
|
|
if (!apiUrl || !model || model.length > 128) {return null}
|
|
|
|
try {
|
|
const endpoint = new URL(apiUrl)
|
|
|
|
if (
|
|
endpoint.protocol !== 'https:' || endpoint.username || endpoint.password || endpoint.port ||
|
|
!['ai.turkservis.online', 'turkservis.online'].includes(endpoint.hostname)
|
|
) {return null}
|
|
|
|
const details = new URL('https://turkservis.online/router')
|
|
|
|
details.searchParams.set('model', model)
|
|
|
|
return details.href
|
|
} catch {
|
|
return null
|
|
}
|
|
}
|