diff --git a/server/services/openapi/oidc/adapter.ts b/server/services/openapi/oidc/adapter.ts index b1f53d73..e195a6c8 100644 --- a/server/services/openapi/oidc/adapter.ts +++ b/server/services/openapi/oidc/adapter.ts @@ -35,6 +35,14 @@ function uidKeyFor(uid) { return `uid:${uid}`; } +function parseImageUrl(input: string | undefined) { + if (typeof input === 'string') { + return input.replace('{BACKEND}', config.apiUrl); // 因为/open接口是在服务端的,所以该标识直接移除即可 + } + + return input; +} + /** * Reference: https://github.com/panva/node-oidc-provider/blob/main/example/my_adapter.js */ @@ -163,7 +171,7 @@ export class TcOIDCAdapter implements Adapter { }; if (app.appIcon) { - clientPayload.logo_uri = app.appIcon; + clientPayload.logo_uri = parseImageUrl(app.appIcon); } return clientPayload; diff --git a/server/services/openapi/oidc/oidc.service.ts b/server/services/openapi/oidc/oidc.service.ts index bdf10128..f5899e22 100644 --- a/server/services/openapi/oidc/oidc.service.ts +++ b/server/services/openapi/oidc/oidc.service.ts @@ -75,14 +75,6 @@ function readIncomingMessageData(req: IncomingMessage) { }); } -function parseImageUrl(input: string | undefined) { - if (typeof input === 'string') { - return input.replace('{BACKEND}', ''); // 因为/open接口是在服务端的,所以该标识直接移除即可 - } - - return input; -} - class OIDCService extends TcService { provider = this.createOIDCProvider(); @@ -175,7 +167,7 @@ class OIDCService extends TcService { const promptName = prompt.name; const data = { - logoUri: parseImageUrl(client.logoUri), + logoUri: client.logoUri, clientName: client.clientName, uid, details: prompt.details,