emoji
This commit is contained in:
parent
a8c19c624a
commit
4f6b0ccf6b
|
@ -0,0 +1,11 @@
|
|||
export class DiscordWebhookUrl1697641012204 {
|
||||
name = 'DiscordWebhookUrl1697641012204'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" ADD "DiscordWebhookUrl" character varying(1024)`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "DiscordWebhookUrl"`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
export class EmojiBotToken1697642704514 {
|
||||
name = 'EmojiBotToken1697642704514'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" ADD "EmojiBotToken" character varying(1024)`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "EmojiBotToken"`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
export class BaseUrl1697645425687 {
|
||||
name = 'BaseUrl1697645425687'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" ADD "ApiBase" character varying(1024)`);
|
||||
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "preservedUsernames" SET DEFAULT '{ "admin", "administrator", "root", "system", "maintainer", "host", "mod", "moderator", "owner", "superuser", "staff", "auth", "i", "me", "everyone", "all", "mention", "mentions", "example", "user", "users", "account", "accounts", "official", "help", "helps", "support", "supports", "info", "information", "informations", "announce", "announces", "announcement", "announcements", "notice", "notification", "notifications", "dev", "developer", "developers", "tech", "misskey" }'`);
|
||||
await queryRunner.query(`ALTER TABLE "flash" ALTER COLUMN "visibility" SET NOT NULL`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "flash" ALTER COLUMN "visibility" DROP NOT NULL`);
|
||||
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "preservedUsernames" SET DEFAULT '{admin,administrator,root,system,maintainer,host,mod,moderator,owner,superuser,staff,auth,i,me,everyone,all,mention,mentions,example,user,users,account,accounts,official,help,helps,support,supports,info,information,informations,announce,announces,announcement,announcements,notice,notification,notifications,dev,developer,developers,tech,misskey}'`);
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "ApiBase"`);
|
||||
}
|
||||
}
|
|
@ -196,11 +196,26 @@ export class MiMeta {
|
|||
})
|
||||
public enableRecaptcha: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public DiscordWebhookUrl: string | null;
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public EmojiBotToken: string | null;
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public recaptchaSiteKey: string | null;
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public ApiBase: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
|
|
|
@ -5,7 +5,7 @@ import { DI } from '@/di-symbols.js';
|
|||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
export const meta = {
|
||||
tags: ['admin'],
|
||||
|
||||
|
@ -46,12 +46,12 @@ export const paramDef = {
|
|||
// eslint-disable-next-line import/no-default-export
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
constructor(
|
||||
@Inject(DI.driveFilesRepository)
|
||||
private driveFilesRepository: DriveFilesRepository,
|
||||
|
||||
private metaService: MetaService,
|
||||
private customEmojiService: CustomEmojiService,
|
||||
|
||||
private moderationLogService: ModerationLogService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
|
@ -71,6 +71,41 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
localOnly: ps.localOnly ?? false,
|
||||
roleIdsThatCanBeUsedThisEmojiAsReaction: [],
|
||||
});
|
||||
const {ApiBase,EmojiBotToken,DiscordWebhookUrl} = (await this.metaService.fetch())
|
||||
const data_disc = {"username": "絵文字追加通知ちゃん",
|
||||
'content':
|
||||
'絵文字名 : :'+ ps.name +':\n' +
|
||||
'カテゴリ : ' + ps.category + '\n'+
|
||||
'ライセンス : '+ ps.license + '\n'+
|
||||
'タグ : '+ps.aliases+ '\n'+
|
||||
'追加したユーザー : ' + '@'+me.username + '\n'
|
||||
}
|
||||
|
||||
const data_Miss = {
|
||||
'i': EmojiBotToken,
|
||||
'text':
|
||||
'絵文字名 : :' + ps.name + ':\n' +
|
||||
'カテゴリ : ' + ps.category + '\n' +
|
||||
'ライセンス : ' + ps.license + '\n' +
|
||||
'タグ : ' + ps.aliases + '\n' +
|
||||
'追加したユーザー : ' + '@' + me.username + '\n'
|
||||
};
|
||||
|
||||
await fetch(ApiBase+'/notes/create', {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body:JSON.stringify( data_Miss)
|
||||
})
|
||||
|
||||
await fetch(DiscordWebhookUrl, {
|
||||
'method':'post',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data_disc),
|
||||
})
|
||||
|
||||
return {
|
||||
id: emoji.id,
|
||||
|
|
|
@ -311,6 +311,10 @@ export const meta = {
|
|||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
DiscordWebhookUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
@ -424,6 +428,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
perUserHomeTimelineCacheMax: instance.perUserHomeTimelineCacheMax,
|
||||
perUserListTimelineCacheMax: instance.perUserListTimelineCacheMax,
|
||||
notesPerOneAd: instance.notesPerOneAd,
|
||||
DiscordWebhookUrl: instance.DiscordWebhookUrl,
|
||||
EmojiBotToken: instance.EmojiBotToken,
|
||||
ApiBase: instance.ApiBase
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ export const paramDef = {
|
|||
},
|
||||
},
|
||||
summalyProxy: { type: 'string', nullable: true },
|
||||
DiscordWebhookUrl:{ type: 'string', nullable: true},
|
||||
deeplAuthKey: { type: 'string', nullable: true },
|
||||
deeplIsPro: { type: 'boolean' },
|
||||
enableEmail: { type: 'boolean' },
|
||||
|
@ -132,6 +133,8 @@ export const paramDef = {
|
|||
type: 'string',
|
||||
},
|
||||
},
|
||||
EmojiBotToken:{ type: 'string', nullable: true},
|
||||
ApiBase:{ type: 'string',nullable:true}
|
||||
},
|
||||
required: [],
|
||||
} as const;
|
||||
|
@ -175,7 +178,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
if (ps.themeColor !== undefined) {
|
||||
set.themeColor = ps.themeColor;
|
||||
}
|
||||
|
||||
if (ps.DiscordWebhookUrl !== undefined){
|
||||
set.DiscordWebhookUrl = ps.DiscordWebhookUrl
|
||||
}
|
||||
if (ps.EmojiBotToken !== undefined){
|
||||
set.EmojiBotToken = ps.EmojiBotToken
|
||||
}
|
||||
if (ps.ApiBase !== undefined){
|
||||
set.ApiBase = ps.ApiBase
|
||||
}
|
||||
if (ps.mascotImageUrl !== undefined) {
|
||||
set.mascotImageUrl = ps.mascotImageUrl;
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ watch(q, () => {
|
|||
|
||||
const searchCustom = () => {
|
||||
const max = 100;
|
||||
const emojis = customEmojis.value.filter(emoji => !emoji.draft);;
|
||||
const emojis = customEmojis.value.filter(emoji => !emoji.draft);
|
||||
const matches = new Set<Misskey.entities.CustomEmoji>();
|
||||
|
||||
const exactMatch = emojis.find(emoji => emoji.name === newQ);
|
||||
|
|
|
@ -36,6 +36,18 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
|
||||
</MkSwitch>
|
||||
</div>
|
||||
<MkInput v-model="DiscordWebhookUrl" type="password">
|
||||
<template #prefix><i class="ti ti-key"></i></template>
|
||||
<template #label>Discord Webhook URL</template>
|
||||
</MkInput>
|
||||
<MkInput v-model="EmojiBotToken" type="password">
|
||||
<template #prefix><i class="ti ti-key"></i></template>
|
||||
<template #label>EmojiBotToken</template>
|
||||
</MkInput>
|
||||
<MkInput v-model="ApiBase">
|
||||
<template #prefix><i class="ti ti-key"></i></template>
|
||||
<template #label>ApiBase</template>
|
||||
</MkInput>
|
||||
</div>
|
||||
</FormSuspense>
|
||||
</MkSpacer>
|
||||
|
@ -51,18 +63,24 @@ import { fetchInstance } from '@/instance.js';
|
|||
import { i18n } from '@/i18n.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
import MkInput from "@/components/MkInput.vue";
|
||||
|
||||
let enableServerMachineStats: boolean = $ref(false);
|
||||
let enableIdenticonGeneration: boolean = $ref(false);
|
||||
let enableChartsForRemoteUser: boolean = $ref(false);
|
||||
let enableChartsForFederatedInstances: boolean = $ref(false);
|
||||
|
||||
let DiscordWebhookUrl: string | null = $ref(null);
|
||||
let EmojiBotToken: string | null = $ref(null);
|
||||
let ApiBase:string | null = $ref(null)
|
||||
async function init() {
|
||||
const meta = await os.api('admin/meta');
|
||||
enableServerMachineStats = meta.enableServerMachineStats;
|
||||
enableIdenticonGeneration = meta.enableIdenticonGeneration;
|
||||
enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
|
||||
enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
|
||||
DiscordWebhookUrl = meta.DiscordWebhookUrl;
|
||||
EmojiBotToken = meta.EmojiBotToken;
|
||||
ApiBase = meta.ApiBase;
|
||||
}
|
||||
|
||||
function save() {
|
||||
|
@ -71,6 +89,9 @@ function save() {
|
|||
enableIdenticonGeneration,
|
||||
enableChartsForRemoteUser,
|
||||
enableChartsForFederatedInstances,
|
||||
DiscordWebhookUrl,
|
||||
EmojiBotToken,
|
||||
ApiBase
|
||||
}).then(() => {
|
||||
fetchInstance();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue