Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import define from "../../define.js";
|
||||
import { AccessTokens } from "../../../../models/index.js";
|
||||
import { publishUserEvent } from "../../../../services/stream.js";
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
secure: true
|
||||
};
|
||||
export const paramDef = {
|
||||
type: "object",
|
||||
properties: {
|
||||
tokenId: {
|
||||
type: "string",
|
||||
format: "misskey:id"
|
||||
}
|
||||
},
|
||||
required: [
|
||||
"tokenId"
|
||||
]
|
||||
};
|
||||
export default define(meta, paramDef, async (ps, user)=>{
|
||||
const exist = await AccessTokens.exist({
|
||||
where: {
|
||||
id: ps.tokenId
|
||||
}
|
||||
});
|
||||
if (exist) {
|
||||
await AccessTokens.delete({
|
||||
id: ps.tokenId,
|
||||
userId: user.id
|
||||
});
|
||||
// Terminate streaming
|
||||
publishUserEvent(user.id, "terminate");
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user