2023-07-27 07:31:52 +02:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-08-05 03:33:00 +02:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2023-04-19 01:25:24 +02:00
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
|
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireRolePolicy: 'canManageCustomEmojis',
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export const paramDef = {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
ids: { type: 'array', items: {
|
|
|
|
type: 'string', format: 'misskey:id',
|
|
|
|
} },
|
|
|
|
license: {
|
|
|
|
type: 'string',
|
|
|
|
nullable: true,
|
|
|
|
description: 'Use `null` to reset the license.',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
required: ['ids'],
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
@Injectable()
|
2023-08-17 14:20:58 +02:00
|
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
2023-04-19 01:25:24 +02:00
|
|
|
constructor(
|
|
|
|
private customEmojiService: CustomEmojiService,
|
|
|
|
) {
|
|
|
|
super(meta, paramDef, async (ps, me) => {
|
|
|
|
await this.customEmojiService.setLicenseBulk(ps.ids, ps.license ?? null);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|