forked from naskya/firefish
feat: emoji moderators (close #56)
This commit is contained in:
parent
1d29ca3609
commit
d9927c027e
30 changed files with 412 additions and 40 deletions
|
@ -10,6 +10,13 @@
|
||||||
|
|
||||||
## 主要な変更点
|
## 主要な変更点
|
||||||
|
|
||||||
|
- モデレーターでない一般ユーザーにもカスタム絵文字の管理権を与えられるように
|
||||||
|
- カスタム絵文字の管理が大変なサーバー管理者さんがたくさんいらっしゃったのでこの機能を追加するべきではないか他の開発者に訊いたところロール機能の実装を待つべきだと言われてしまったが、Firefish のロール機能は現状では仕様がまだ固まっておらず実装までに時間が掛かると考えられるため
|
||||||
|
- 以下の権限を与えられます
|
||||||
|
- 不許可: 絵文字の管理を許可しない
|
||||||
|
- 追加: 新しい絵文字の追加のみを許可する
|
||||||
|
- 追加と変更: 「追加」に加え、既存のカスタム絵文字の名前・カテゴリ・タグ・ライセンスの編集を許可する
|
||||||
|
- 全て許可:「追加と変更」に加え、既存のカスタム絵文字の削除を許可する
|
||||||
- UI 用の言語とは別に、投稿翻訳に使用する言語を設定可能に
|
- UI 用の言語とは別に、投稿翻訳に使用する言語を設定可能に
|
||||||
- 投稿言語を自動検出して外国語の投稿に翻訳ボタンを表示する設定を追加
|
- 投稿言語を自動検出して外国語の投稿に翻訳ボタンを表示する設定を追加
|
||||||
- モバイル表示の下部のウィジェットボタンを再読み込みボタンに変更可能に
|
- モバイル表示の下部のウィジェットボタンを再読み込みボタンに変更可能に
|
||||||
|
|
|
@ -2133,3 +2133,10 @@ _feeds:
|
||||||
rss: "RSS"
|
rss: "RSS"
|
||||||
atom: "Atom"
|
atom: "Atom"
|
||||||
jsonFeed: "JSON feed"
|
jsonFeed: "JSON feed"
|
||||||
|
emojiModPerm: "Custom emoji management"
|
||||||
|
emojiModPermDescription: "Add: Allow this user to add new custom emojis and to set tag/category/license to newly added custom emojis.\nAdd and Edit: \"Add\" Permission + Allow this user to edit the name/category/tag/license of the existing custom emojis.\nAllow All: \"Add and Edit\" Permission + Allow this user to delete existing custom emojis."
|
||||||
|
_emojiModPerm:
|
||||||
|
none: "Deny All"
|
||||||
|
add: "Add"
|
||||||
|
mod: "Add and Edit"
|
||||||
|
full: "Allow All"
|
||||||
|
|
|
@ -1989,3 +1989,10 @@ delete2faConfirm: これで、このアカウントの2要素認証は完全に
|
||||||
inputNotMatch: 入力が一致しません
|
inputNotMatch: 入力が一致しません
|
||||||
deletePasskeysConfirm: これで、このアカウントのパスキーは完全に削除されます。続行しますか?
|
deletePasskeysConfirm: これで、このアカウントのパスキーは完全に削除されます。続行しますか?
|
||||||
confirm: "確認"
|
confirm: "確認"
|
||||||
|
emojiModPerm: "カスタム絵文字の管理"
|
||||||
|
emojiModPermDescription: "追加: カスタム絵文字の新規追加と新規追加されたカスタム絵文字(正確には、タグとカテゴリとライセンスが設定されていないカスタム絵文字)へのタグとカテゴリとライセンスの設定を許可します。\n追加と変更:「追加」の権限に加え、既存の絵文字の名前・カテゴリ・タグ・ライセンスの変更を許可します。\n全て許可:「追加と変更」の権限に加え、既存のカスタム絵文字の削除を許可します。\nこの設定にかかわらず、サーバーの管理者およびモデレーターには「全て許可」の権限が与えられます。"
|
||||||
|
_emojiModPerm:
|
||||||
|
none: "不許可"
|
||||||
|
add: "追加"
|
||||||
|
mod: "追加と変更"
|
||||||
|
full: "全て許可"
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
export class EmojiModerator1692825433698 {
|
||||||
|
name = "EmojiModerator1692825433698";
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE TYPE "public"."user_emojimodperm_enum" AS ENUM('none', 'add', 'mod', 'full')`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "user" ADD "emojiModPerm" "public"."user_emojimodperm_enum" NOT NULL DEFAULT 'none'`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "emojiModPerm"`);
|
||||||
|
await queryRunner.query(`DROP TYPE "public"."user_emojimodperm_enum"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -168,6 +168,23 @@ pub enum RelayStatusEnum {
|
||||||
Requesting,
|
Requesting,
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||||
|
#[sea_orm(
|
||||||
|
rs_type = "String",
|
||||||
|
db_type = "Enum",
|
||||||
|
enum_name = "user_emojimodperm_enum"
|
||||||
|
)]
|
||||||
|
pub enum UserEmojimodpermEnum {
|
||||||
|
#[sea_orm(string_value = "add")]
|
||||||
|
Add,
|
||||||
|
#[sea_orm(string_value = "full")]
|
||||||
|
Full,
|
||||||
|
#[sea_orm(string_value = "mod")]
|
||||||
|
Mod,
|
||||||
|
#[default]
|
||||||
|
#[sea_orm(string_value = "none")]
|
||||||
|
None,
|
||||||
|
}
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Default)]
|
||||||
#[sea_orm(
|
#[sea_orm(
|
||||||
rs_type = "String",
|
rs_type = "String",
|
||||||
db_type = "Enum",
|
db_type = "Enum",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||||||
|
|
||||||
|
use super::sea_orm_active_enums::UserEmojimodpermEnum;
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
|
|
||||||
use super::newtype::StringVec;
|
use super::newtype::StringVec;
|
||||||
|
@ -40,6 +41,8 @@ pub struct Model {
|
||||||
pub is_bot: bool,
|
pub is_bot: bool,
|
||||||
#[sea_orm(column_name = "isCat")]
|
#[sea_orm(column_name = "isCat")]
|
||||||
pub is_cat: bool,
|
pub is_cat: bool,
|
||||||
|
#[sea_orm(column_name = "emojiModPerm")]
|
||||||
|
pub emoji_mod_perm: UserEmojimodpermEnum,
|
||||||
#[sea_orm(column_name = "isAdmin")]
|
#[sea_orm(column_name = "isAdmin")]
|
||||||
pub is_admin: bool,
|
pub is_admin: bool,
|
||||||
#[sea_orm(column_name = "isModerator")]
|
#[sea_orm(column_name = "isModerator")]
|
||||||
|
|
|
@ -11,5 +11,5 @@ export default new DataSource({
|
||||||
database: config.db.db,
|
database: config.db.db,
|
||||||
extra: config.db.extra,
|
extra: config.db.extra,
|
||||||
entities: entities,
|
entities: entities,
|
||||||
migrations: ["migration/*.js"],
|
migrations: ["migration/*.js", "migration-neko/*.js"],
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,12 @@ import {
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
import { DriveFile } from "./drive-file.js";
|
import { DriveFile } from "./drive-file.js";
|
||||||
|
|
||||||
|
// none: no permission
|
||||||
|
// add: add custom emojis to the server
|
||||||
|
// mod: add permission + modify {category, tags, license} of existing custom emojis
|
||||||
|
// full: mod permission + {rename, delete} existing custom emojis
|
||||||
|
export type EmojiModPerm = "none" | "add" | "mod" | "full";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@Index(["usernameLower", "host"], { unique: true })
|
@Index(["usernameLower", "host"], { unique: true })
|
||||||
export class User {
|
export class User {
|
||||||
|
@ -178,6 +184,13 @@ export class User {
|
||||||
})
|
})
|
||||||
public isModerator: boolean;
|
public isModerator: boolean;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: "enum",
|
||||||
|
enum: ["none", "add", "mod", "full"],
|
||||||
|
default: "none",
|
||||||
|
})
|
||||||
|
public emojiModPerm: EmojiModPerm;
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column("boolean", {
|
@Column("boolean", {
|
||||||
default: true,
|
default: true,
|
||||||
|
|
|
@ -450,6 +450,7 @@ export const UserRepository = db.getRepository(User).extend({
|
||||||
avatarUrl: this.getAvatarUrlSync(user),
|
avatarUrl: this.getAvatarUrlSync(user),
|
||||||
avatarBlurhash: user.avatar?.blurhash || null,
|
avatarBlurhash: user.avatar?.blurhash || null,
|
||||||
avatarColor: null, // 後方互換性のため
|
avatarColor: null, // 後方互換性のため
|
||||||
|
emojiModPerm: user.emojiModPerm ?? "none",
|
||||||
isAdmin: user.isAdmin || falsy,
|
isAdmin: user.isAdmin || falsy,
|
||||||
isModerator: user.isModerator || falsy,
|
isModerator: user.isModerator || falsy,
|
||||||
isBot: user.isBot || falsy,
|
isBot: user.isBot || falsy,
|
||||||
|
|
|
@ -55,6 +55,7 @@ import * as ep___admin_search_indexAll from "./endpoints/admin/search/index-all.
|
||||||
import * as ep___admin_sendEmail from "./endpoints/admin/send-email.js";
|
import * as ep___admin_sendEmail from "./endpoints/admin/send-email.js";
|
||||||
import * as ep___admin_sendModMail from "./endpoints/admin/send-mod-mail.js";
|
import * as ep___admin_sendModMail from "./endpoints/admin/send-mod-mail.js";
|
||||||
import * as ep___admin_serverInfo from "./endpoints/admin/server-info.js";
|
import * as ep___admin_serverInfo from "./endpoints/admin/server-info.js";
|
||||||
|
import * as ep___admin_setEmojiModerator from "./endpoints/admin/set-emoji-moderator.js";
|
||||||
import * as ep___admin_showModerationLogs from "./endpoints/admin/show-moderation-logs.js";
|
import * as ep___admin_showModerationLogs from "./endpoints/admin/show-moderation-logs.js";
|
||||||
import * as ep___admin_showUser from "./endpoints/admin/show-user.js";
|
import * as ep___admin_showUser from "./endpoints/admin/show-user.js";
|
||||||
import * as ep___admin_showUsers from "./endpoints/admin/show-users.js";
|
import * as ep___admin_showUsers from "./endpoints/admin/show-users.js";
|
||||||
|
@ -410,6 +411,7 @@ const eps = [
|
||||||
["admin/send-email", ep___admin_sendEmail],
|
["admin/send-email", ep___admin_sendEmail],
|
||||||
["admin/send-mod-mail", ep___admin_sendModMail],
|
["admin/send-mod-mail", ep___admin_sendModMail],
|
||||||
["admin/server-info", ep___admin_serverInfo],
|
["admin/server-info", ep___admin_serverInfo],
|
||||||
|
["admin/set-emoji-moderator", ep___admin_setEmojiModerator],
|
||||||
["admin/show-moderation-logs", ep___admin_showModerationLogs],
|
["admin/show-moderation-logs", ep___admin_showModerationLogs],
|
||||||
["admin/show-user", ep___admin_showUser],
|
["admin/show-user", ep___admin_showUser],
|
||||||
["admin/show-users", ep___admin_showUsers],
|
["admin/show-users", ep___admin_showUsers],
|
||||||
|
|
|
@ -5,10 +5,18 @@ import { ApiError } from "../../../error.js";
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -31,11 +39,21 @@ export const paramDef = {
|
||||||
required: ["ids", "aliases"],
|
required: ["ids", "aliases"],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji mod permission (or add permission if there is no alias)
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const emojis = await Emojis.findBy({
|
const emojis = await Emojis.findBy({
|
||||||
id: In(ps.ids),
|
id: In(ps.ids),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (me.emojiModPerm === "add") {
|
||||||
|
for (const emoji of emojis)
|
||||||
|
if (emoji.aliases.length > 0)
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
}
|
||||||
|
|
||||||
for (const emoji of emojis) {
|
for (const emoji of emojis) {
|
||||||
await Emojis.update(emoji.id, {
|
await Emojis.update(emoji.id, {
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
|
|
|
@ -9,10 +9,10 @@ import { db } from "@/db/postgre.js";
|
||||||
import { getEmojiSize } from "@/misc/emoji-meta.js";
|
import { getEmojiSize } from "@/misc/emoji-meta.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
noSuchFile: {
|
noSuchFile: {
|
||||||
|
@ -20,6 +20,11 @@ export const meta = {
|
||||||
code: "MO_SUCH_FILE",
|
code: "MO_SUCH_FILE",
|
||||||
id: "fc46b5a4-6b92-4c33-ac66-b806659bb5cf",
|
id: "fc46b5a4-6b92-4c33-ac66-b806659bb5cf",
|
||||||
},
|
},
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -32,6 +37,10 @@ export const paramDef = {
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji add permission
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const file = await DriveFiles.findOneBy({ id: ps.fileId });
|
const file = await DriveFiles.findOneBy({ id: ps.fileId });
|
||||||
|
|
||||||
if (file == null) throw new ApiError(meta.errors.noSuchFile);
|
if (file == null) throw new ApiError(meta.errors.noSuchFile);
|
||||||
|
|
|
@ -9,10 +9,10 @@ import { db } from "@/db/postgre.js";
|
||||||
import { getEmojiSize } from "@/misc/emoji-meta.js";
|
import { getEmojiSize } from "@/misc/emoji-meta.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
noSuchEmoji: {
|
noSuchEmoji: {
|
||||||
|
@ -20,6 +20,11 @@ export const meta = {
|
||||||
code: "NO_SUCH_EMOJI",
|
code: "NO_SUCH_EMOJI",
|
||||||
id: "e2785b66-dca3-4087-9cac-b93c541cc425",
|
id: "e2785b66-dca3-4087-9cac-b93c541cc425",
|
||||||
},
|
},
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
|
@ -46,6 +51,12 @@ export const paramDef = {
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji mod permission
|
||||||
|
if (
|
||||||
|
!(me.isAdmin || me.isModerator || ["mod", "full"].includes(me.emojiModPerm))
|
||||||
|
)
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const emoji = await Emojis.findOneBy({ id: ps.emojiId });
|
const emoji = await Emojis.findOneBy({ id: ps.emojiId });
|
||||||
|
|
||||||
if (emoji == null) {
|
if (emoji == null) {
|
||||||
|
|
|
@ -6,10 +6,18 @@ import { ApiError } from "../../../error.js";
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -27,6 +35,10 @@ export const paramDef = {
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji full permission
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "full"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const emojis = await Emojis.findBy({
|
const emojis = await Emojis.findBy({
|
||||||
id: In(ps.ids),
|
id: In(ps.ids),
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,10 +5,10 @@ import { ApiError } from "../../../error.js";
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
noSuchEmoji: {
|
noSuchEmoji: {
|
||||||
|
@ -16,6 +16,11 @@ export const meta = {
|
||||||
code: "NO_SUCH_EMOJI",
|
code: "NO_SUCH_EMOJI",
|
||||||
id: "be83669b-773a-44b7-b1f8-e5e5170ac3c2",
|
id: "be83669b-773a-44b7-b1f8-e5e5170ac3c2",
|
||||||
},
|
},
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -28,6 +33,10 @@ export const paramDef = {
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji full permission
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "full"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const emoji = await Emojis.findOneBy({ id: ps.id });
|
const emoji = await Emojis.findOneBy({ id: ps.id });
|
||||||
|
|
||||||
if (emoji == null) throw new ApiError(meta.errors.noSuchEmoji);
|
if (emoji == null) throw new ApiError(meta.errors.noSuchEmoji);
|
||||||
|
|
|
@ -1,11 +1,22 @@
|
||||||
import define from "../../../define.js";
|
import define from "../../../define.js";
|
||||||
import { createImportCustomEmojisJob } from "@/queue/index.js";
|
import { createImportCustomEmojisJob } from "@/queue/index.js";
|
||||||
|
import { ApiError } from "../../../error.js";
|
||||||
import ms from "ms";
|
import ms from "ms";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
secure: true,
|
secure: true,
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -17,5 +28,9 @@ export const paramDef = {
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
export default define(meta, paramDef, async (ps, user) => {
|
||||||
|
// require emoji add permission
|
||||||
|
if (!(user.isAdmin || user.isModerator || user.emojiModPerm !== "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
createImportCustomEmojisJob(user, ps.fileId);
|
createImportCustomEmojisJob(user, ps.fileId);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,12 +3,13 @@ import { Emojis } from "@/models/index.js";
|
||||||
import { toPuny } from "@/misc/convert-host.js";
|
import { toPuny } from "@/misc/convert-host.js";
|
||||||
import { makePaginationQuery } from "../../../common/make-pagination-query.js";
|
import { makePaginationQuery } from "../../../common/make-pagination-query.js";
|
||||||
import { sqlLikeEscape } from "@/misc/sql-like-escape.js";
|
import { sqlLikeEscape } from "@/misc/sql-like-escape.js";
|
||||||
|
import { ApiError } from "../../../error.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
type: "array",
|
type: "array",
|
||||||
|
@ -74,6 +75,14 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -93,7 +102,11 @@ export const paramDef = {
|
||||||
required: [],
|
required: [],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji add permission
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const q = makePaginationQuery(
|
const q = makePaginationQuery(
|
||||||
Emojis.createQueryBuilder("emoji"),
|
Emojis.createQueryBuilder("emoji"),
|
||||||
ps.sinceId,
|
ps.sinceId,
|
||||||
|
|
|
@ -3,12 +3,13 @@ import { Emojis } from "@/models/index.js";
|
||||||
import { makePaginationQuery } from "../../../common/make-pagination-query.js";
|
import { makePaginationQuery } from "../../../common/make-pagination-query.js";
|
||||||
import type { Emoji } from "@/models/entities/emoji.js";
|
import type { Emoji } from "@/models/entities/emoji.js";
|
||||||
//import { sqlLikeEscape } from "@/misc/sql-like-escape.js";
|
//import { sqlLikeEscape } from "@/misc/sql-like-escape.js";
|
||||||
|
import { ApiError } from "../../../error.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
type: "array",
|
type: "array",
|
||||||
|
@ -74,6 +75,14 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -87,7 +96,11 @@ export const paramDef = {
|
||||||
required: [],
|
required: [],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji add permission
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const q = makePaginationQuery(
|
const q = makePaginationQuery(
|
||||||
Emojis.createQueryBuilder("emoji"),
|
Emojis.createQueryBuilder("emoji"),
|
||||||
ps.sinceId,
|
ps.sinceId,
|
||||||
|
|
|
@ -8,7 +8,15 @@ export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -31,7 +39,13 @@ export const paramDef = {
|
||||||
required: ["ids", "aliases"],
|
required: ["ids", "aliases"],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji mod permission
|
||||||
|
if (
|
||||||
|
!(me.isAdmin || me.isModerator || ["mod", "full"].includes(me.emojiModPerm))
|
||||||
|
)
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const emojis = await Emojis.findBy({
|
const emojis = await Emojis.findBy({
|
||||||
id: In(ps.ids),
|
id: In(ps.ids),
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,10 +5,18 @@ import { ApiError } from "../../../error.js";
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -31,7 +39,21 @@ export const paramDef = {
|
||||||
required: ["ids", "aliases"],
|
required: ["ids", "aliases"],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji mod permission (or add permission if there is no alias)
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
|
const emojis = await Emojis.findBy({
|
||||||
|
id: In(ps.ids),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (me.emojiModPerm === "add") {
|
||||||
|
for (const emoji of emojis)
|
||||||
|
if (emoji.aliases.length > 0)
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
}
|
||||||
|
|
||||||
await Emojis.update(
|
await Emojis.update(
|
||||||
{
|
{
|
||||||
id: In(ps.ids),
|
id: In(ps.ids),
|
||||||
|
|
|
@ -5,10 +5,18 @@ import { ApiError } from "../../../error.js";
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -30,7 +38,20 @@ export const paramDef = {
|
||||||
required: ["ids"],
|
required: ["ids"],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji mod permission (or add permission if there is no category)
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
|
const emojis = await Emojis.findBy({
|
||||||
|
id: In(ps.ids),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (me.emojiModPerm === "add") {
|
||||||
|
for (const emoji of emojis)
|
||||||
|
if (emoji.category != null) throw new ApiError(meta.errors.accessDenied);
|
||||||
|
}
|
||||||
|
|
||||||
await Emojis.update(
|
await Emojis.update(
|
||||||
{
|
{
|
||||||
id: In(ps.ids),
|
id: In(ps.ids),
|
||||||
|
|
|
@ -5,10 +5,18 @@ import { ApiError } from "../../../error.js";
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -30,7 +38,20 @@ export const paramDef = {
|
||||||
required: ["ids"],
|
required: ["ids"],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji mod permission (or add permission if there is no license)
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm === "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
|
const emojis = await Emojis.findBy({
|
||||||
|
id: In(ps.ids),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (me.emojiModPerm === "add") {
|
||||||
|
for (const emoji of emojis)
|
||||||
|
if (emoji.license != null) throw new ApiError(meta.errors.accessDenied);
|
||||||
|
}
|
||||||
|
|
||||||
await Emojis.update(
|
await Emojis.update(
|
||||||
{
|
{
|
||||||
id: In(ps.ids),
|
id: In(ps.ids),
|
||||||
|
|
|
@ -4,10 +4,10 @@ import { ApiError } from "../../../error.js";
|
||||||
import { db } from "@/db/postgre.js";
|
import { db } from "@/db/postgre.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["admin"],
|
tags: ["admin", "emoji"],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
requireModerator: true,
|
requireModerator: false,
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
noSuchEmoji: {
|
noSuchEmoji: {
|
||||||
|
@ -15,6 +15,11 @@ export const meta = {
|
||||||
code: "NO_SUCH_EMOJI",
|
code: "NO_SUCH_EMOJI",
|
||||||
id: "684dec9d-a8c2-4364-9aa8-456c49cb1dc8",
|
id: "684dec9d-a8c2-4364-9aa8-456c49cb1dc8",
|
||||||
},
|
},
|
||||||
|
accessDenied: {
|
||||||
|
message: "Access denied.",
|
||||||
|
code: "ACCESS_DENIED",
|
||||||
|
id: "fe8d7103-0ea8-4ec3-814d-f8b401dc69e9",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -42,10 +47,22 @@ export const paramDef = {
|
||||||
required: ["id", "name", "aliases"],
|
required: ["id", "name", "aliases"],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps, me) => {
|
||||||
|
// require emoji mod permission (or add permission if there is no category/alias/license)
|
||||||
|
if (!(me.isAdmin || me.isModerator || me.emojiModPerm !== "none"))
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
|
||||||
const emoji = await Emojis.findOneBy({ id: ps.id });
|
const emoji = await Emojis.findOneBy({ id: ps.id });
|
||||||
|
|
||||||
if (emoji == null) throw new ApiError(meta.errors.noSuchEmoji);
|
if (emoji == null) throw new ApiError(meta.errors.noSuchEmoji);
|
||||||
|
if (me.emojiModPerm === "add") {
|
||||||
|
if (
|
||||||
|
emoji.category != null ||
|
||||||
|
emoji.aliases.length > 0 ||
|
||||||
|
emoji.license != null
|
||||||
|
)
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
}
|
||||||
|
|
||||||
await Emojis.update(emoji.id, {
|
await Emojis.update(emoji.id, {
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
import define from "../../define.js";
|
||||||
|
import { Users } from "@/models/index.js";
|
||||||
|
import { publishInternalEvent } from "@/services/stream.js";
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
tags: ["admin"],
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
requireModerator: true,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const paramDef = {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
userId: { type: "string", format: "misskey:id" },
|
||||||
|
emojiModPerm: { type: "string" },
|
||||||
|
},
|
||||||
|
required: ["userId", "emojiModPerm"],
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export default define(meta, paramDef, async (ps) => {
|
||||||
|
const user = await Users.findOneBy({ id: ps.userId });
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
throw new Error("user not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!["none", "add", "mod", "full"].includes(ps.emojiModPerm)) {
|
||||||
|
throw new Error("emojiModPerm must be 'none', 'add', 'mod', or 'full'");
|
||||||
|
}
|
||||||
|
|
||||||
|
const _emojiModPerm =
|
||||||
|
(ps.emojiModPerm as "none" | "add" | "mod" | "full") ?? "none";
|
||||||
|
|
||||||
|
await Users.update(user.id, {
|
||||||
|
emojiModPerm: _emojiModPerm,
|
||||||
|
});
|
||||||
|
|
||||||
|
publishInternalEvent("userChangeModeratorState", {
|
||||||
|
id: user.id,
|
||||||
|
isModerator: true,
|
||||||
|
});
|
||||||
|
});
|
|
@ -73,6 +73,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||||
isModerator: user.isModerator,
|
isModerator: user.isModerator,
|
||||||
isSilenced: user.isSilenced,
|
isSilenced: user.isSilenced,
|
||||||
isSuspended: user.isSuspended,
|
isSuspended: user.isSuspended,
|
||||||
|
emojiModPerm: user.emojiModPerm,
|
||||||
lastActiveDate: user.lastActiveDate,
|
lastActiveDate: user.lastActiveDate,
|
||||||
moderationNote: profile.moderationNote,
|
moderationNote: profile.moderationNote,
|
||||||
signins,
|
signins,
|
||||||
|
|
|
@ -19,6 +19,7 @@ export const $i = accountData
|
||||||
|
|
||||||
export const iAmModerator = $i != null && ($i.isAdmin || $i.isModerator);
|
export const iAmModerator = $i != null && ($i.isAdmin || $i.isModerator);
|
||||||
export const iAmAdmin = $i?.isAdmin;
|
export const iAmAdmin = $i?.isAdmin;
|
||||||
|
export const iAmEmojiMod = iAmModerator || $i?.emojiModPerm !== "none";
|
||||||
|
|
||||||
export async function signout() {
|
export async function signout() {
|
||||||
waiting();
|
waiting();
|
||||||
|
|
|
@ -178,6 +178,29 @@
|
||||||
</FormSection>
|
</FormSection>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="tab === 'moderation'" class="_formRoot">
|
<div v-else-if="tab === 'moderation'" class="_formRoot">
|
||||||
|
<FormSelect
|
||||||
|
v-model="emojiModPerm"
|
||||||
|
class="_formBlock"
|
||||||
|
@update:modelValue="setEmojiMod"
|
||||||
|
>
|
||||||
|
<template #label>{{ i18n.ts.emojiModPerm }}</template>
|
||||||
|
<option value="none">
|
||||||
|
{{ i18n.ts._emojiModPerm.none }}
|
||||||
|
</option>
|
||||||
|
<option value="add">
|
||||||
|
{{ i18n.ts._emojiModPerm.add }}
|
||||||
|
</option>
|
||||||
|
<option value="mod">
|
||||||
|
{{ i18n.ts._emojiModPerm.mod }}
|
||||||
|
</option>
|
||||||
|
<option value="full">
|
||||||
|
{{ i18n.ts._emojiModPerm.full }}
|
||||||
|
</option>
|
||||||
|
</FormSelect>
|
||||||
|
<MkInfo class="_formBlock"
|
||||||
|
>{{ i18n.ts.emojiModPermDescription }}</MkInfo
|
||||||
|
>
|
||||||
|
|
||||||
<FormSwitch
|
<FormSwitch
|
||||||
v-if="
|
v-if="
|
||||||
user.host == null &&
|
user.host == null &&
|
||||||
|
@ -369,6 +392,7 @@ import FormButton from "@/components/MkButton.vue";
|
||||||
import FormInput from "@/components/form/input.vue";
|
import FormInput from "@/components/form/input.vue";
|
||||||
import FormSplit from "@/components/form/split.vue";
|
import FormSplit from "@/components/form/split.vue";
|
||||||
import FormFolder from "@/components/form/folder.vue";
|
import FormFolder from "@/components/form/folder.vue";
|
||||||
|
import FormSelect from "@/components/form/select.vue";
|
||||||
import MkKeyValue from "@/components/MkKeyValue.vue";
|
import MkKeyValue from "@/components/MkKeyValue.vue";
|
||||||
import MkSelect from "@/components/form/select.vue";
|
import MkSelect from "@/components/form/select.vue";
|
||||||
import FormSuspense from "@/components/form/suspense.vue";
|
import FormSuspense from "@/components/form/suspense.vue";
|
||||||
|
@ -398,6 +422,7 @@ let ap = $ref(null);
|
||||||
let moderator = $ref(false);
|
let moderator = $ref(false);
|
||||||
let silenced = $ref(false);
|
let silenced = $ref(false);
|
||||||
let suspended = $ref(false);
|
let suspended = $ref(false);
|
||||||
|
let emojiModPerm = $ref("");
|
||||||
let driveCapacityOverrideMb: number | null = $ref(0);
|
let driveCapacityOverrideMb: number | null = $ref(0);
|
||||||
let moderationNote = $ref("");
|
let moderationNote = $ref("");
|
||||||
const filesPagination = {
|
const filesPagination = {
|
||||||
|
@ -430,6 +455,7 @@ function createFetcher() {
|
||||||
moderator = info.isModerator;
|
moderator = info.isModerator;
|
||||||
silenced = info.isSilenced;
|
silenced = info.isSilenced;
|
||||||
suspended = info.isSuspended;
|
suspended = info.isSuspended;
|
||||||
|
emojiModPerm = info.emojiModPerm;
|
||||||
driveCapacityOverrideMb = user.driveCapacityOverrideMb;
|
driveCapacityOverrideMb = user.driveCapacityOverrideMb;
|
||||||
moderationNote = info.moderationNote;
|
moderationNote = info.moderationNote;
|
||||||
|
|
||||||
|
@ -512,6 +538,14 @@ async function toggleModerator(v) {
|
||||||
await refreshUser();
|
await refreshUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setEmojiMod() {
|
||||||
|
await os.api("admin/set-emoji-moderator", {
|
||||||
|
userId: user.id,
|
||||||
|
emojiModPerm: emojiModPerm,
|
||||||
|
});
|
||||||
|
await refreshUser();
|
||||||
|
}
|
||||||
|
|
||||||
async function sendModMail() {
|
async function sendModMail() {
|
||||||
const { canceled, result } = await os.inputParagraph({
|
const { canceled, result } = await os.inputParagraph({
|
||||||
title: "Moderation Notice",
|
title: "Moderation Notice",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { AsyncComponentLoader, defineAsyncComponent, inject } from "vue";
|
import { AsyncComponentLoader, defineAsyncComponent, inject } from "vue";
|
||||||
import { Router } from "@/nirax";
|
import { Router } from "@/nirax";
|
||||||
import { $i, iAmModerator } from "@/account";
|
import { $i, iAmModerator, iAmEmojiMod } from "@/account";
|
||||||
import MkLoading from "@/pages/_loading_.vue";
|
import MkLoading from "@/pages/_loading_.vue";
|
||||||
import MkError from "@/pages/_error_.vue";
|
import MkError from "@/pages/_error_.vue";
|
||||||
import { api } from "@/os";
|
import { api } from "@/os";
|
||||||
|
@ -438,6 +438,13 @@ export const routes = [
|
||||||
? page(() => import("./pages/admin-file.vue"))
|
? page(() => import("./pages/admin-file.vue"))
|
||||||
: page(() => import("./pages/not-found.vue")),
|
: page(() => import("./pages/not-found.vue")),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/emojis",
|
||||||
|
name: "emojis",
|
||||||
|
component: iAmEmojiMod
|
||||||
|
? page(() => import("./pages/admin/emojis.vue"))
|
||||||
|
: page(() => import("./pages/not-found.vue")),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/admin",
|
path: "/admin",
|
||||||
component: iAmModerator
|
component: iAmModerator
|
||||||
|
@ -459,11 +466,6 @@ export const routes = [
|
||||||
name: "hashtags",
|
name: "hashtags",
|
||||||
component: page(() => import("./pages/admin/hashtags.vue")),
|
component: page(() => import("./pages/admin/hashtags.vue")),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "/emojis",
|
|
||||||
name: "emojis",
|
|
||||||
component: page(() => import("./pages/admin/emojis.vue")),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/federation",
|
path: "/federation",
|
||||||
name: "federation",
|
name: "federation",
|
||||||
|
|
|
@ -80,6 +80,17 @@
|
||||||
<i class="icon ph-door ph-bold ph-lg ph-fw ph-lg"></i
|
<i class="icon ph-door ph-bold ph-lg ph-fw ph-lg"></i
|
||||||
><span class="text">{{ i18n.ts.controlPanel }}</span>
|
><span class="text">{{ i18n.ts.controlPanel }}</span>
|
||||||
</MkA>
|
</MkA>
|
||||||
|
<MkA
|
||||||
|
v-else-if="$i.emojiModPerm !== 'none'"
|
||||||
|
v-click-anime
|
||||||
|
v-tooltip.noDelay.right="i18n.ts.customEmojis"
|
||||||
|
class="item _button"
|
||||||
|
active-class="active"
|
||||||
|
to="/admin/emojis"
|
||||||
|
>
|
||||||
|
<i class="icon ph-smiley ph-bold ph-fw ph-lg"></i
|
||||||
|
><span class="text">{{ i18n.ts.customEmojis }}</span>
|
||||||
|
</MkA>
|
||||||
<button v-click-anime class="item _button" @click="more">
|
<button v-click-anime class="item _button" @click="more">
|
||||||
<i
|
<i
|
||||||
class="icon ph-dots-three-outline ph-bold ph-lg ph-fw ph-lg"
|
class="icon ph-dots-three-outline ph-bold ph-lg ph-fw ph-lg"
|
||||||
|
@ -134,7 +145,7 @@ import {
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { navbarItemDef } from "@/navbar";
|
import { navbarItemDef } from "@/navbar";
|
||||||
import { openAccountMenu as openAccountMenu_ } from "@/account";
|
import { $i, openAccountMenu as openAccountMenu_ } from "@/account";
|
||||||
import { openHelpMenu_ } from "@/scripts/helpMenu";
|
import { openHelpMenu_ } from "@/scripts/helpMenu";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
|
|
@ -92,6 +92,17 @@
|
||||||
><i class="icon ph-door ph-bold ph-fw ph-lg"></i
|
><i class="icon ph-door ph-bold ph-fw ph-lg"></i
|
||||||
><span class="text">{{ i18n.ts.controlPanel }}</span>
|
><span class="text">{{ i18n.ts.controlPanel }}</span>
|
||||||
</MkA>
|
</MkA>
|
||||||
|
<MkA
|
||||||
|
v-else-if="$i.emojiModPerm !== 'none'"
|
||||||
|
v-click-anime
|
||||||
|
v-tooltip.noDelay.right="i18n.ts.customEmojis"
|
||||||
|
class="item _button"
|
||||||
|
active-class="active"
|
||||||
|
to="/admin/emojis"
|
||||||
|
>
|
||||||
|
<i class="icon ph-smiley ph-bold ph-fw ph-lg"></i
|
||||||
|
><span class="text">{{ i18n.ts.customEmojis }}</span>
|
||||||
|
</MkA>
|
||||||
<button
|
<button
|
||||||
v-click-anime
|
v-click-anime
|
||||||
v-tooltip.noDelay.right="i18n.ts.more"
|
v-tooltip.noDelay.right="i18n.ts.more"
|
||||||
|
|
Loading…
Reference in a new issue