mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-11-27 06:59:54 +08:00
Feat: i18n code
This commit is contained in:
parent
c41af91a9f
commit
55d334aa30
@ -104,19 +104,19 @@ const handleTabClick = (value: string) => {
|
||||
</a-typography-title>
|
||||
<a-typography-paragraph>
|
||||
<div>
|
||||
{{ t("权限:") }}
|
||||
{{ t("TXT_CODE_8575f7c") }}
|
||||
<a-tag v-if="card.permission >= ROLE.ADMIN" color="red">
|
||||
{{ t("管理员") }}
|
||||
{{ t("TXT_CODE_cd978243") }}
|
||||
</a-tag>
|
||||
<a-tag v-else-if="card.permission >= ROLE.USER" color="green">
|
||||
{{ t("所有用户") }}
|
||||
{{ t("TXT_CODE_b67197fc") }}
|
||||
</a-tag>
|
||||
<a-tag v-else color="green">
|
||||
{{ t("所有人") }}
|
||||
{{ t("TXT_CODE_b488372f") }}
|
||||
</a-tag>
|
||||
</div>
|
||||
<div>
|
||||
{{ t("描述:") }}
|
||||
{{ t("TXT_CODE_d486a561") }}
|
||||
{{ card.description }}
|
||||
</div>
|
||||
</a-typography-paragraph>
|
||||
|
@ -101,9 +101,9 @@ export function getLayoutCardPool() {
|
||||
permission: ROLE.GUEST,
|
||||
meta: {},
|
||||
type: "TitleCard",
|
||||
title: t("未命名标题栏"),
|
||||
title: t("TXT_CODE_8981d724"),
|
||||
width: 12,
|
||||
description: t("此卡片可用于栏目分段,类似于编写文章中的标题一样,可以用于排版。"),
|
||||
description: t("TXT_CODE_9466852b"),
|
||||
height: LayoutCardHeight.AUTO,
|
||||
category: NEW_CARD_TYPE.COMMON
|
||||
},
|
||||
@ -269,9 +269,9 @@ export function getLayoutCardPool() {
|
||||
permission: ROLE.USER,
|
||||
meta: {},
|
||||
type: "InstanceShortcut",
|
||||
title: t("实例快捷方式"),
|
||||
title: t("TXT_CODE_ea0840c9"),
|
||||
width: 3,
|
||||
description: t("显示实例状态,前提是这个用户有权限能进入这个实例"),
|
||||
description: t("TXT_CODE_3fce7ccb"),
|
||||
height: LayoutCardHeight.SMALL,
|
||||
category: NEW_CARD_TYPE.INSTANCE,
|
||||
params: [
|
||||
@ -297,9 +297,9 @@ export function getLayoutCardPool() {
|
||||
permission: ROLE.USER,
|
||||
meta: {},
|
||||
type: "InstanceFileManager",
|
||||
title: t("实例文件管理"),
|
||||
title: t("TXT_CODE_72cce10b"),
|
||||
width: 12,
|
||||
description: t("用于管理指定应用实例的文件"),
|
||||
description: t("TXT_CODE_f49b2787"),
|
||||
height: LayoutCardHeight.MEDIUM,
|
||||
category: NEW_CARD_TYPE.INSTANCE,
|
||||
params: [
|
||||
@ -325,9 +325,9 @@ export function getLayoutCardPool() {
|
||||
permission: ROLE.USER,
|
||||
meta: {},
|
||||
type: "InstanceBaseInfo",
|
||||
title: t("基本信息"),
|
||||
title: t("TXT_CODE_eadb4f60"),
|
||||
width: 4,
|
||||
description: t("用于展示指定实例的详细信息"),
|
||||
description: t("TXT_CODE_97e5eccb"),
|
||||
height: LayoutCardHeight.SMALL,
|
||||
category: NEW_CARD_TYPE.INSTANCE,
|
||||
params: [
|
||||
@ -355,7 +355,7 @@ export function getLayoutCardPool() {
|
||||
title: t("TXT_CODE_a4037a98"),
|
||||
meta: {},
|
||||
width: 6,
|
||||
description: t("用于分析面板近段时间的趋势图"),
|
||||
description: t("TXT_CODE_6f659da2"),
|
||||
height: LayoutCardHeight.SMALL,
|
||||
category: NEW_CARD_TYPE.DATA
|
||||
},
|
||||
@ -366,7 +366,7 @@ export function getLayoutCardPool() {
|
||||
title: t("TXT_CODE_d6d9c42c"),
|
||||
meta: {},
|
||||
width: 6,
|
||||
description: t("用于分析面板近段时间的趋势图"),
|
||||
description: t("TXT_CODE_6f659da2"),
|
||||
height: LayoutCardHeight.SMALL,
|
||||
category: NEW_CARD_TYPE.DATA
|
||||
},
|
||||
@ -374,10 +374,10 @@ export function getLayoutCardPool() {
|
||||
id: getRandomId(),
|
||||
permission: ROLE.ADMIN,
|
||||
type: "NodeOverview",
|
||||
title: t("所有节点"),
|
||||
title: t("TXT_CODE_4bedec2a"),
|
||||
meta: {},
|
||||
width: 12,
|
||||
description: t("用于查看与面板连接的所有远程节点的状态"),
|
||||
description: t("TXT_CODE_2a8dc13f"),
|
||||
height: LayoutCardHeight.BIG,
|
||||
category: NEW_CARD_TYPE.DATA
|
||||
},
|
||||
@ -385,7 +385,7 @@ export function getLayoutCardPool() {
|
||||
id: getRandomId(),
|
||||
permission: ROLE.ADMIN,
|
||||
type: "DataOverview",
|
||||
title: t("数据总览"),
|
||||
title: t("TXT_CODE_721157a3"),
|
||||
meta: {},
|
||||
width: 8,
|
||||
description: t("TXT_CODE_55ade942"),
|
||||
@ -396,10 +396,10 @@ export function getLayoutCardPool() {
|
||||
id: getRandomId(),
|
||||
permission: ROLE.ADMIN,
|
||||
type: "QuickStart",
|
||||
title: t("快速建立应用实例"),
|
||||
title: t("TXT_CODE_e01539f1"),
|
||||
meta: {},
|
||||
width: 4,
|
||||
description: t("用于快速新建实例"),
|
||||
description: t("TXT_CODE_d628e631"),
|
||||
height: LayoutCardHeight.MEDIUM,
|
||||
category: NEW_CARD_TYPE.INSTANCE
|
||||
},
|
||||
@ -408,9 +408,9 @@ export function getLayoutCardPool() {
|
||||
permission: ROLE.ADMIN,
|
||||
meta: {},
|
||||
type: "NodeItem",
|
||||
title: t("远程节点"),
|
||||
title: t("TXT_CODE_def287e0"),
|
||||
width: 6,
|
||||
description: t("用于展示远程节点的详细信息和状态"),
|
||||
description: t("TXT_CODE_abe0862e"),
|
||||
height: LayoutCardHeight.MEDIUM,
|
||||
category: NEW_CARD_TYPE.INSTANCE,
|
||||
params: [
|
||||
@ -421,7 +421,7 @@ export function getLayoutCardPool() {
|
||||
},
|
||||
{
|
||||
field: "instance",
|
||||
label: t("请选择一个实例让我们获取节点信息"),
|
||||
label: t("TXT_CODE_e7cad65f"),
|
||||
type: "instance"
|
||||
}
|
||||
]
|
||||
@ -431,9 +431,9 @@ export function getLayoutCardPool() {
|
||||
permission: ROLE.ADMIN,
|
||||
meta: {},
|
||||
type: "InstanceManagerBtns",
|
||||
title: t("实例功能组"),
|
||||
title: t("TXT_CODE_d2bbb2f1"),
|
||||
width: 8,
|
||||
description: t("应用实例的配置编辑,终端设置和其他功能的入口功能卡片"),
|
||||
description: t("TXT_CODE_1934114b"),
|
||||
height: LayoutCardHeight.MEDIUM,
|
||||
category: NEW_CARD_TYPE.INSTANCE,
|
||||
params: [
|
||||
|
@ -86,7 +86,7 @@ const instanceOperations = computed(() =>
|
||||
icon: RedoOutlined,
|
||||
click: async () => {
|
||||
await executeRestart(operationConfig);
|
||||
message.success(t("实例正在重启"));
|
||||
message.success(t("TXT_CODE_b11166e7"));
|
||||
},
|
||||
loading: restartLoading.value,
|
||||
disabled: containerState.isDesignMode,
|
||||
@ -117,14 +117,14 @@ const instanceOperations = computed(() =>
|
||||
time: new Date().getTime()
|
||||
}
|
||||
});
|
||||
message.success(t("实例正在更新"));
|
||||
message.success(t("TXT_CODE_b1600db0"));
|
||||
},
|
||||
loading: updateLoading.value,
|
||||
disabled: containerState.isDesignMode,
|
||||
condition: () => isStopped.value
|
||||
},
|
||||
{
|
||||
title: t("终端"),
|
||||
title: t("TXT_CODE_524e3036"),
|
||||
icon: CodeOutlined,
|
||||
click: () => {
|
||||
toPage({
|
||||
|
@ -1487,5 +1487,32 @@
|
||||
"TXT_CODE_20cec54": "回车换行符",
|
||||
"TXT_CODE_b19bf004": "必填,请输入内容",
|
||||
"TXT_CODE_5a09ed37": "中文",
|
||||
"TXT_CODE_e246e5b": "英语"
|
||||
"TXT_CODE_e246e5b": "英语",
|
||||
"TXT_CODE_8575f7c": "权限:",
|
||||
"TXT_CODE_b67197fc": "所有用户",
|
||||
"TXT_CODE_b488372f": "所有人",
|
||||
"TXT_CODE_d486a561": "描述:",
|
||||
"TXT_CODE_8981d724": "未命名标题栏",
|
||||
"TXT_CODE_9466852b": "此卡片可用于栏目分段,类似于编写文章中的标题一样,可以用于排版。",
|
||||
"TXT_CODE_ea0840c9": "实例快捷方式",
|
||||
"TXT_CODE_3fce7ccb": "显示实例状态,前提是这个用户有权限能进入这个实例",
|
||||
"TXT_CODE_72cce10b": "实例文件管理",
|
||||
"TXT_CODE_f49b2787": "用于管理指定应用实例的文件",
|
||||
"TXT_CODE_97e5eccb": "用于展示指定实例的详细信息",
|
||||
"TXT_CODE_6f659da2": "用于分析面板近段时间的趋势图",
|
||||
"TXT_CODE_4bedec2a": "所有节点",
|
||||
"TXT_CODE_2a8dc13f": "用于查看与面板连接的所有远程节点的状态",
|
||||
"TXT_CODE_e01539f1": "快速建立应用实例",
|
||||
"TXT_CODE_d628e631": "用于快速新建实例",
|
||||
"TXT_CODE_def287e0": "远程节点",
|
||||
"TXT_CODE_abe0862e": "用于展示远程节点的详细信息和状态",
|
||||
"TXT_CODE_e7cad65f": "请选择一个实例让我们获取节点信息",
|
||||
"TXT_CODE_d2bbb2f1": "实例功能组",
|
||||
"TXT_CODE_1934114b": "应用实例的配置编辑,终端设置和其他功能的入口功能卡片",
|
||||
"TXT_CODE_b11166e7": "实例正在重启",
|
||||
"TXT_CODE_b1600db0": "实例正在更新",
|
||||
"TXT_CODE_1a499109": "文件不存在",
|
||||
"TXT_CODE_e4d6cc20": "请求体错误",
|
||||
"TXT_CODE_d37f0418": "面板已经安装!",
|
||||
"TXT_CODE_42036f92": "------ 用户登录事件 ------"
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import permission from "../../middleware/permission";
|
||||
import validator from "../../middleware/validator";
|
||||
import { saveSystemConfig, systemConfig } from "../../setting";
|
||||
import { logger } from "../../service/log";
|
||||
import { i18next } from "../../i18n";
|
||||
import { i18next, $t } from "../../i18n";
|
||||
import userSystem from "../../service/system_user";
|
||||
import { v4 } from "uuid";
|
||||
import path from "path";
|
||||
@ -53,7 +53,7 @@ router.put("/setting", validator({ body: {} }), permission({ level: ROLE.ADMIN }
|
||||
ctx.body = "OK";
|
||||
return;
|
||||
}
|
||||
ctx.body = new Error("The body is incorrect");
|
||||
ctx.body = new Error($t("TXT_CODE_e4d6cc20"));
|
||||
});
|
||||
|
||||
// [Public Permission]
|
||||
@ -71,7 +71,7 @@ router.put("/install", async (ctx) => {
|
||||
ctx.body = "OK";
|
||||
return;
|
||||
}
|
||||
ctx.body = new Error("The MCSManager has been installed");
|
||||
ctx.body = new Error($t("TXT_CODE_d37f0418"));
|
||||
});
|
||||
|
||||
// [Public router]
|
||||
@ -98,8 +98,8 @@ router.delete("/layout", permission({ level: ROLE.ADMIN }), async (ctx) => {
|
||||
// Upload file to asserts directory, only administrator can upload
|
||||
router.post("/upload_assets", permission({ level: ROLE.ADMIN }), async (ctx) => {
|
||||
const tmpFiles = ctx.request.files.file;
|
||||
if (!tmpFiles || tmpFiles instanceof Array) throw new Error("The body is incorrect");
|
||||
if (!tmpFiles.path || !fs.existsSync(tmpFiles.path)) throw new Error("The file does not exist");
|
||||
if (!tmpFiles || tmpFiles instanceof Array) throw new Error($t("TXT_CODE_e4d6cc20"));
|
||||
if (!tmpFiles.path || !fs.existsSync(tmpFiles.path)) throw new Error($t("TXT_CODE_1a499109"));
|
||||
const tmpFile = tmpFiles;
|
||||
const newFileName = v4() + path.extname(tmpFile.name);
|
||||
const saveDirPath = path.join(process.cwd(), "public/upload_files/");
|
||||
|
@ -5,6 +5,7 @@ import { GlobalVariable } from "common";
|
||||
import { systemConfig } from "../setting";
|
||||
import { logger } from "./log";
|
||||
import { User } from "../entity/user";
|
||||
import { $t } from "../i18n";
|
||||
|
||||
export const BAN_IP_COUNT = "banip";
|
||||
export const LOGIN_FAILED_KEY = "loginFailed";
|
||||
@ -29,8 +30,10 @@ export function login(ctx: Koa.ParameterizedContext, userName: string, passWord:
|
||||
ctx.session["uuid"] = user.uuid;
|
||||
ctx.session["token"] = timeUuid();
|
||||
ctx.session.save();
|
||||
logger.info($t("TXT_CODE_42036f92"));
|
||||
logger.info(`[LOGIN] IP: ${ip} Login ${userName} successful!`);
|
||||
logger.info(`[LOGIN] Token: ${ctx.session["token"]}`);
|
||||
logger.info($t("TXT_CODE_42036f92"));
|
||||
return ctx.session["token"];
|
||||
} else {
|
||||
// record the number of login failures
|
||||
@ -38,7 +41,7 @@ export function login(ctx: Koa.ParameterizedContext, userName: string, passWord:
|
||||
ctx.session["login"] = null;
|
||||
ctx.session["token"] = null;
|
||||
ctx.session.save();
|
||||
logger.info(`[LOGIN] IP: ${ip} login ${userName} failed!`);
|
||||
logger.info(`[LOGIN] IP: ${ip}, Try login ${userName} failed!`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user