d071d18dd7
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
32 lines
708 B
TypeScript
32 lines
708 B
TypeScript
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.findOne(ps.tokenId);
|
|
|
|
if (token) {
|
|
await AccessTokens.delete({
|
|
id: ps.tokenId,
|
|
userId: user.id,
|
|
});
|
|
|
|
// Terminate streaming
|
|
publishUserEvent(user.id, 'terminate');
|
|
}
|
|
});
|