mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-03 06:56:33 +09:00
@ -0,0 +1,11 @@
|
||||
export class addPropsForCustomEmoji1678945242650 {
|
||||
name = 'addPropsForCustomEmoji1678945242650'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "emoji" ADD "license" character varying(1024)`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "emoji" DROP COLUMN "license"`);
|
||||
}
|
||||
}
|
@ -44,6 +44,7 @@ export class CustomEmojiService {
|
||||
category: string | null;
|
||||
aliases: string[];
|
||||
host: string | null;
|
||||
license: string | null;
|
||||
}): Promise<Emoji> {
|
||||
const emoji = await this.emojisRepository.insert({
|
||||
id: this.idService.genId(),
|
||||
@ -55,6 +56,7 @@ export class CustomEmojiService {
|
||||
originalUrl: data.driveFile.url,
|
||||
publicUrl: data.driveFile.webpublicUrl ?? data.driveFile.url,
|
||||
type: data.driveFile.webpublicType ?? data.driveFile.type,
|
||||
license: data.license,
|
||||
}).then(x => this.emojisRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
if (data.host == null) {
|
||||
|
@ -50,6 +50,7 @@ export class EmojiEntityService {
|
||||
host: emoji.host,
|
||||
// || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ)
|
||||
url: emoji.publicUrl || emoji.originalUrl,
|
||||
license: emoji.license,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -55,4 +55,9 @@ export class Emoji {
|
||||
array: true, length: 128, default: '{}',
|
||||
})
|
||||
public aliases: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024, nullable: true,
|
||||
})
|
||||
public license: string | null;
|
||||
}
|
||||
|
@ -59,5 +59,9 @@ export const packedEmojiDetailedSchema = {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
license: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
@ -102,6 +102,7 @@ export class ImportCustomEmojisProcessorService {
|
||||
host: null,
|
||||
aliases: emojiInfo.aliases,
|
||||
driveFile,
|
||||
license: emojiInfo.license,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
category: null,
|
||||
aliases: [],
|
||||
host: null,
|
||||
license: null,
|
||||
});
|
||||
|
||||
this.moderationLogService.insertModerationLog(me, 'addEmoji', {
|
||||
|
@ -87,6 +87,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
originalUrl: driveFile.url,
|
||||
publicUrl: driveFile.webpublicUrl ?? driveFile.url,
|
||||
type: driveFile.webpublicType ?? driveFile.type,
|
||||
license: emoji.license,
|
||||
}).then(x => this.emojisRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
await this.db.queryResultCache?.remove(['meta_emojis']);
|
||||
|
@ -35,6 +35,7 @@ export const paramDef = {
|
||||
aliases: { type: 'array', items: {
|
||||
type: 'string',
|
||||
} },
|
||||
license: { type: 'string', nullable: true },
|
||||
},
|
||||
required: ['id', 'name', 'aliases'],
|
||||
} as const;
|
||||
@ -64,6 +65,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
name: ps.name,
|
||||
category: ps.category,
|
||||
aliases: ps.aliases,
|
||||
license: ps.license,
|
||||
});
|
||||
|
||||
await this.db.queryResultCache?.remove(['meta_emojis']);
|
||||
|
Reference in New Issue
Block a user