blob: c69245379406ef6b329d7edcc8aae196c4324c58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import define from '../../define.js';
import { AccessTokens } from '@/models/index.js';
import { publishUserEvent } from '@/services/stream.js';
export const meta = {
requireCredential: true,
secure: true,
} as const;
export const paramDef = {
type: 'object',
properties: {
tokenId: { type: 'string', format: 'misskey:id' },
},
required: ['tokenId'],
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps, user) => {
const token = await AccessTokens.findOneBy({ id: ps.tokenId });
if (token) {
await AccessTokens.delete({
id: ps.tokenId,
userId: user.id,
});
// Terminate streaming
publishUserEvent(user.id, 'terminate');
}
});
|