wip
This commit is contained in:
parent
b5852f6053
commit
1e2178b717
2 changed files with 29 additions and 26 deletions
|
@ -7,33 +7,10 @@ import { secureRndstr } from '@/misc/secure-rndstr.js';
|
|||
import { DI } from '@/di-symbols.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['auth'],
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
secure: true,
|
||||
|
||||
errors: {
|
||||
noSuchSession: {
|
||||
message: 'No such session.',
|
||||
code: 'NO_SUCH_SESSION',
|
||||
id: '9c72d8de-391a-43c1-9d06-08d29efde8df',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
token: { type: 'string' },
|
||||
},
|
||||
required: ['token'],
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
export default class extends Endpoint<'auth/accept'> {
|
||||
name = 'auth/accept' as const;
|
||||
constructor(
|
||||
@Inject(DI.appsRepository)
|
||||
private appsRepository: AppsRepository,
|
||||
|
@ -46,7 +23,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
|
||||
private idService: IdService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
super(async (ps, me) => {
|
||||
// Fetch token
|
||||
const session = await this.authSessionsRepository
|
||||
.findOneBy({ token: ps.token });
|
||||
|
|
|
@ -2448,6 +2448,32 @@ export const endpoints = {
|
|||
}
|
||||
}],
|
||||
},
|
||||
'auth/accept': {
|
||||
tags: ['auth'],
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
secure: true,
|
||||
|
||||
errors: {
|
||||
noSuchSession: {
|
||||
message: 'No such session.',
|
||||
code: 'NO_SUCH_SESSION',
|
||||
id: '9c72d8de-391a-43c1-9d06-08d29efde8df',
|
||||
},
|
||||
},
|
||||
|
||||
defines: [{
|
||||
req: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
token: { type: 'string' },
|
||||
},
|
||||
required: ['token'],
|
||||
},
|
||||
res: undefined,
|
||||
}],
|
||||
}
|
||||
//#endregion
|
||||
} as const satisfies { [x: string]: IEndpointMeta; };
|
||||
|
||||
|
|
Loading…
Reference in a new issue