mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-01-24 15:14:01 +08:00
refactor: server profile editor
This commit is contained in:
parent
1fef03da48
commit
3deabd1707
3
frontend/components.d.ts
vendored
3
frontend/components.d.ts
vendored
@ -7,7 +7,6 @@ export {}
|
||||
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
||||
ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb']
|
||||
ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem']
|
||||
AButton: typeof import('ant-design-vue/es')['Button']
|
||||
@ -64,9 +63,9 @@ declare module 'vue' {
|
||||
CardError: typeof import('./src/components/CardError.vue')['default']
|
||||
CardOperator: typeof import('./src/components/CardOperator.vue')['default']
|
||||
CardPanel: typeof import('./src/components/CardPanel.vue')['default']
|
||||
copy: typeof import('./src/components/mc_process_config/server.properties copy.vue')['default']
|
||||
CopyButton: typeof import('./src/components/CopyButton.vue')['default']
|
||||
DataStatistic: typeof import('./src/components/DataStatistic.vue')['default']
|
||||
Default: typeof import('./src/components/mc_process_config/default.vue')['default']
|
||||
Editor: typeof import('./src/components/Editor.vue')['default']
|
||||
'Eula.txt': typeof import('./src/components/mc_process_config/eula.txt.vue')['default']
|
||||
FadeUpAnimation: typeof import('./src/components/FadeUpAnimation.vue')['default']
|
||||
|
65
frontend/src/components/mc_process_config/data.ts
Normal file
65
frontend/src/components/mc_process_config/data.ts
Normal file
@ -0,0 +1,65 @@
|
||||
import { t } from "@/lang/i18n";
|
||||
|
||||
export const configData: {
|
||||
[key: string]: {
|
||||
desc: string;
|
||||
config: object;
|
||||
};
|
||||
} = {
|
||||
"bungeecord/config.yml": {
|
||||
desc: t(
|
||||
"此配置适用于 BungeeCord 群组服务端软件,但由于此配置文件略微有些复杂,大部分配置只能进行简单修改,建议您使用文件在线管理功能编辑此文件。"
|
||||
),
|
||||
config: {
|
||||
prevent_proxy_connections: t(
|
||||
"是否向 Mojang 发送玩家 IP 数据以阻止使用了代理的玩家进入服务器"
|
||||
),
|
||||
listeners: [
|
||||
{
|
||||
query_port: t("UDP查询端口"),
|
||||
motd: t(
|
||||
"当仅有一个默认服务器时,服务器将会显示给玩家的 Motd。当 ping_passthrough 被开启时,此项无效"
|
||||
),
|
||||
tab_list: t("连接到服务器的玩家的 TAB 列表所显示的内容格式"),
|
||||
query_enabled: t("是否开启 UDP 查询"),
|
||||
proxy_protocol: t("是否开启对 HAProxy 的支持"),
|
||||
forced_hosts: t("端口转发设置"),
|
||||
ping_passthrough: t("是否开启 ping 穿透"),
|
||||
priorities: t("优先级设置"),
|
||||
bind_local_address: t("是否显示 BungeeCord 正在监听的 IP 地址"),
|
||||
host: t("监听的 IP 地址和端口"),
|
||||
max_players: t(
|
||||
"玩家客户端将会显示的最大玩家数,默认值为 1。此项只作为装饰,并未真实的最大玩家数设置"
|
||||
),
|
||||
tab_size: t("显示在 TAB 列表上的最大玩家数量"),
|
||||
force_default_server: t("每次玩家进入服务器时,是否强制将玩家传送到默认服务器中")
|
||||
}
|
||||
],
|
||||
remote_ping_cache: t(
|
||||
"BungeeCord 应在多长时间内以毫秒为单位使用服务器Ping的缓存结果而不是手动Ping它们以获取玩家数量,输入 -1 禁用"
|
||||
),
|
||||
network_compression_threshold: "",
|
||||
permissions: {
|
||||
default: t("默认用户组权限"),
|
||||
admin: t("管理员用户组权限")
|
||||
},
|
||||
log_pings: t("是否在控制台记录玩家客户端向 BungeeCord 发起 ping 请求的记录"),
|
||||
connection_throttle: t("断开时间"),
|
||||
connection_throttle_limit: t("断开次数"),
|
||||
server_connect_timeout: t("连接超时时间"),
|
||||
timeout: t("超时时间"),
|
||||
player_limit: t("整个 BungeeCord 实例能够接受的最大玩家数量,默认值为 -1,即不限数量"),
|
||||
ip_forward: t("是否启用 IP 追踪"),
|
||||
groups: t("权限组设置"),
|
||||
remote_ping_timeout: t(
|
||||
"BungeeCord 将在多长时间内以毫秒为单位尝试对服务器进行Ping以获取玩家数量,然后取消连接"
|
||||
),
|
||||
log_commands: t("是否在控制台记录玩家输入的指令(仅记录 BungeeCord 指令)"),
|
||||
stats: t("用于统计目的,请不要更改或删除"),
|
||||
online_mode: t("正版验证"),
|
||||
forge_support: t("是否启用对 Forge 的支持"),
|
||||
disabled_commands: t("禁用的指令"),
|
||||
servers: t("下游服务端设置,只有在此处设置过的下游服务器才可被连接")
|
||||
}
|
||||
}
|
||||
};
|
62
frontend/src/components/mc_process_config/default.vue
Normal file
62
frontend/src/components/mc_process_config/default.vue
Normal file
@ -0,0 +1,62 @@
|
||||
<script setup lang="ts">
|
||||
import { t } from "@/lang/i18n";
|
||||
import LineOption from "@/components/LineOption.vue";
|
||||
import { getDescriptionByTitle } from "@/tools/common";
|
||||
import { jsonToMap } from "@/tools/common";
|
||||
|
||||
import { configData } from "@/components/mc_process_config/data";
|
||||
|
||||
const props = defineProps<{
|
||||
config: Record<string, any>;
|
||||
configName: string;
|
||||
}>();
|
||||
|
||||
const data:
|
||||
| {
|
||||
desc: string;
|
||||
config: Record<string, any>;
|
||||
}
|
||||
| undefined = configData[props.configName];
|
||||
|
||||
const description = data?.config || {};
|
||||
|
||||
const parsedConfig = jsonToMap(props.config);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-col :span="24">
|
||||
<CardPanel style="height: 100%">
|
||||
<template #body>
|
||||
<a-typography>
|
||||
<a-typography-title :level="5">
|
||||
{{ data ? t("关于配置文件") : t("未知配置文件") }}
|
||||
</a-typography-title>
|
||||
<a-typography-paragraph v-if="data">
|
||||
{{ data?.desc }}
|
||||
</a-typography-paragraph>
|
||||
<a-typography-paragraph v-else>
|
||||
{{ t("我们将很快支持该文件,敬请期待") }}
|
||||
<br />
|
||||
{{ t("您可前往") }}
|
||||
<a href="https://github.com/MCSManager/MCSManager" target="_blank">
|
||||
https://github.com/MCSManager/MCSManager
|
||||
</a>
|
||||
{{ t("提交反馈") }}
|
||||
</a-typography-paragraph>
|
||||
</a-typography>
|
||||
</template>
|
||||
</CardPanel>
|
||||
</a-col>
|
||||
<a-col v-if="data" :span="24">
|
||||
<CardPanel style="height: 100%">
|
||||
<template #body>
|
||||
<div v-for="(item, index) in parsedConfig" :key="index">
|
||||
<LineOption :option-value="parsedConfig" :option-key="index">
|
||||
<template #title>{{ index }}</template>
|
||||
<template #info>{{ getDescriptionByTitle(description, index) }}</template>
|
||||
</LineOption>
|
||||
</div>
|
||||
</template>
|
||||
</CardPanel>
|
||||
</a-col>
|
||||
</template>
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, type Component } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { t } from "@/lang/i18n";
|
||||
import type { LayoutCard } from "@/types";
|
||||
import { useScreen } from "@/hooks/useScreen";
|
||||
@ -10,11 +10,13 @@ import { useAppRouters } from "@/hooks/useAppRouters";
|
||||
import { toUnicode } from "@/tools/common";
|
||||
import Loading from "@/components/Loading.vue";
|
||||
|
||||
import eulaTxt from "@/components/mc_process_config/eula.txt.vue";
|
||||
import serverProperties from "@/components/mc_process_config/server.properties.vue";
|
||||
import bukkitYml from "@/components/mc_process_config/bukkit.yml.vue";
|
||||
import bungeecordConfigYml from "@/components/mc_process_config/bungeecord.config.yml.vue";
|
||||
import bdsServerProperties from "@/components/mc_process_config/bds_server.properties.vue";
|
||||
// import eulaTxt from "@/components/mc_process_config/eula.txt.vue";
|
||||
// import serverProperties from "@/components/mc_process_config/server.properties.vue";
|
||||
// import bukkitYml from "@/components/mc_process_config/bukkit.yml.vue";
|
||||
// import bungeecordConfigYml from "@/components/mc_process_config/bungeecord.config.yml.vue";
|
||||
// import bdsServerProperties from "@/components/mc_process_config/bds_server.properties.vue";
|
||||
|
||||
import configComponent from "@/components/mc_process_config/default.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
card: LayoutCard;
|
||||
@ -29,22 +31,23 @@ const configPath = getMetaOrRouteValue("configPath");
|
||||
const extName = getMetaOrRouteValue("extName");
|
||||
const type = getMetaOrRouteValue("type");
|
||||
|
||||
const component: { [key: string]: Component } = {
|
||||
"common/server.properties": serverProperties,
|
||||
"common/eula.txt": eulaTxt,
|
||||
// "bukkit/spigot.yml": spigotYml,
|
||||
"bukkit/bukkit.yml": bukkitYml,
|
||||
"bungeecord/config.yml": bungeecordConfigYml,
|
||||
"bds/server.properties": bdsServerProperties
|
||||
// "mohist/mohist.yml": mohistYml,
|
||||
// "paper/paper.yml": paperYml,
|
||||
// "paper/paper-global.yml": paperGlobalYml,
|
||||
// "paper/paper-world-defaults.yml": paperWorldDefaultsYml,
|
||||
// "geyser/config.yml": geyserYml,
|
||||
// "mcdr/config.yml": mcdrConfigYml,
|
||||
// "mcdr/permission.yml": permissionYml,
|
||||
// "velocity/velocity.toml": velocityToml
|
||||
};
|
||||
// const component: { [key: string]: Component } = {
|
||||
// "common/server.properties": serverProperties,
|
||||
// "common/eula.txt": eulaTxt,
|
||||
// // "bukkit/spigot.yml": spigotYml,
|
||||
// "bukkit/bukkit.yml": bukkitYml,
|
||||
// "bungeecord/config.yml": bungeecordConfigYml,
|
||||
// "bds/server.properties": bdsServerProperties
|
||||
// // "mohist/mohist.yml": mohistYml,
|
||||
// // "paper/paper.yml": paperYml,
|
||||
// // "paper/paper-global.yml": paperGlobalYml,
|
||||
// // "paper/paper-world-defaults.yml": paperWorldDefaultsYml,
|
||||
// // "geyser/config.yml": geyserYml,
|
||||
// // "mcdr/config.yml": mcdrConfigYml,
|
||||
// // "mcdr/permission.yml": permissionYml,
|
||||
// // "velocity/velocity.toml": velocityToml
|
||||
// };
|
||||
|
||||
const isFailure = ref(false);
|
||||
const { toPage } = useAppRouters();
|
||||
const toConfigOverview = () => {
|
||||
@ -105,7 +108,7 @@ const save = async () => {
|
||||
data: config_
|
||||
});
|
||||
if (isOK.value) {
|
||||
message.success("保存成功");
|
||||
message.success(t("保存成功"));
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
@ -115,7 +118,7 @@ const save = async () => {
|
||||
|
||||
const refresh = async () => {
|
||||
await render();
|
||||
message.success("刷新成功");
|
||||
message.success(t("刷新成功"));
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
@ -163,16 +166,22 @@ onMounted(async () => {
|
||||
</BetweenMenus>
|
||||
</a-col>
|
||||
|
||||
<component :is="component[configName]" v-if="configName && isReady" :config="configFile" />
|
||||
<!-- <component :is="component[configName]" v-if="configName && isReady" :config="configFile" /> -->
|
||||
|
||||
<configComponent
|
||||
v-if="configName && isReady"
|
||||
:config="configFile"
|
||||
:config-name="configName"
|
||||
/>
|
||||
|
||||
<a-col v-else :span="24">
|
||||
<Loading />
|
||||
<Loading v-if="!isFailure" />
|
||||
</a-col>
|
||||
<a-col v-if="isFailure" :span="24">
|
||||
<a-result
|
||||
status="error"
|
||||
:title="t('错误')"
|
||||
:sub-title="'文件不存在或权限不正确,无法查看此文件的具体配置,您也许可以尝试到 “文件管理”功能在线编辑此文件,或尝试重启实例刷新此文件。'"
|
||||
:title="t('暂不支持编辑此文件')"
|
||||
:sub-title="t('可能是由于文件为空或权限不足。可尝试使用 “文件管理” 对本文件进行编辑。')"
|
||||
>
|
||||
<template #extra>
|
||||
<a-button type="primary" @click="toConfigOverview">
|
||||
|
Loading…
Reference in New Issue
Block a user