fix: 补全NapCat WebUI会话展示元数据
This commit is contained in:
parent
f16dd0050c
commit
52d96294ed
@ -36,7 +36,7 @@ export class InternalSessionController {
|
||||
* Creates a Gateway session and returns only browser-safe bootstrap metadata.
|
||||
* @param secret - Shared API-to-Gateway secret header.
|
||||
* @param body - Internal create-session payload from the API service.
|
||||
* @returns Browser-safe session id, expiry, and relative iframe URL.
|
||||
* @returns Browser-safe session id, expiry, relative iframe URL, and display metadata.
|
||||
*/
|
||||
@Post('sessions')
|
||||
async createSession(
|
||||
@ -48,6 +48,13 @@ export class InternalSessionController {
|
||||
const ticket = await this.ticketService.issue(session.sessionId);
|
||||
|
||||
return {
|
||||
account: {
|
||||
accountId: session.accountId,
|
||||
selfId: session.selfId,
|
||||
},
|
||||
container: {
|
||||
containerName: session.containerName,
|
||||
},
|
||||
expiresAt: session.expiresAt,
|
||||
iframeUrl: `${this.config.publicSessionPrefix()}/${
|
||||
session.sessionId
|
||||
|
||||
@ -812,6 +812,13 @@ describe('InternalSessionController', () => {
|
||||
.expect(HttpStatus.CREATED);
|
||||
|
||||
expect(response.body).toEqual({
|
||||
account: {
|
||||
accountId: 'account-1',
|
||||
selfId: '1914728559',
|
||||
},
|
||||
container: {
|
||||
containerName: 'kt-qqbot-napcat-1914728559',
|
||||
},
|
||||
expiresAt: 61_000,
|
||||
iframeUrl: expect.stringMatching(
|
||||
/^\/napcat-webui\/session\/[0-9a-f-]+\/bootstrap\?ticket=[A-Za-z0-9_-]+$/,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user