From 5b25ef9c194dc0112cd10250c04344dd6f57be27 Mon Sep 17 00:00:00 2001 From: Sun <95302870@qq.com> Date: Wed, 24 Jan 2024 12:38:48 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=A1=8C=E6=89=80=E6=9C=89=E7=9A=84=E8=BE=93=E5=87=BA=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/initialize/A_ENTER.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/service/initialize/A_ENTER.go b/service/initialize/A_ENTER.go index 78abfd7..02f9d63 100644 --- a/service/initialize/A_ENTER.go +++ b/service/initialize/A_ENTER.go @@ -35,7 +35,7 @@ func InitApp() error { // 日志 if logger, err := runlog.InitRunlog(global.RUNCODE, "running.log"); err != nil { - log.Panicln("日志初始化错误", err) + log.Panicln("Log initialization error", err) panic(err) } else { global.Logger = logger @@ -47,7 +47,7 @@ func InitApp() error { // 配置初始化 { if config, err := config.ConfigInit(); err != nil { - global.Logger.Errorln("配置初始化错误", err) + global.Logger.Errorln("Configuration initialization error", err) return err } else { global.Config = config @@ -74,7 +74,7 @@ func InitApp() error { }) if err != nil { - log.Panicln("Redis初始化错误", err) + log.Panicln("Redis initialization error", err) panic(err) // return err } @@ -114,7 +114,7 @@ func DatabaseConnect() { } if db, err := database.DbInit(dbClientInfo); err != nil { - log.Panicln("数据库初始化错误", err) + log.Panicln("Database initialization error", err) panic(err) } else { global.Db = db @@ -133,17 +133,17 @@ func CommandRun() { pwd bool ) - flag.BoolVar(&cfg, "config", false, "生成配置文件") - flag.BoolVar(&pwd, "password-reset", false, "重置第一个用户的密码") + flag.BoolVar(&cfg, "config", false, "Generate configuration file") + flag.BoolVar(&pwd, "password-reset", false, "Reset the password of the first user") flag.Parse() if cfg { // 生成配置文件 - fmt.Println("正在生成配置文件") + fmt.Println("Generating configuration file") cmn.AssetsTakeFileToPath("conf.example.ini", "conf/conf.example.ini") cmn.AssetsTakeFileToPath("conf.example.ini", "conf/conf.ini") - fmt.Println("配置文件已经创建 conf/conf.ini ", "请按照自己的需求修改") + fmt.Println("The configuration file has been created conf/conf.ini ", "Please modify according to your own needs") os.Exit(0) // 务必退出 } else if pwd { // 重置密码 @@ -171,9 +171,9 @@ func CommandRun() { os.Exit(0) // 务必退出 } - fmt.Println("密码已经重置成功,以下是账号信息") - fmt.Println("用户名 ", userInfo.Username) - fmt.Println("密码 ", newPassword) + fmt.Println("The password has been successfully reset. Here is the account information") + fmt.Println("Username ", userInfo.Username) + fmt.Println("Password ", newPassword) os.Exit(0) // 务必退出 } else { return From 863cdf0fc1fc406304784d4304ba6be31e5133ff Mon Sep 17 00:00:00 2001 From: Sun <95302870@qq.com> Date: Wed, 24 Jan 2024 12:54:55 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E5=A3=B0=E6=98=8E=E6=9A=B4=E9=9C=B2?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 5e63063..4e6ea91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,6 +55,8 @@ COPY --from=server_image /build/sun-panel /app/sun-panel # 中国国内源 # RUN sed -i "s@dl-cdn.alpinelinux.org@mirrors.aliyun.com@g" /etc/apk/repositories +EXPOSE 3002 + RUN apk add --no-cache bash ca-certificates su-exec tzdata \ && chmod +x ./sun-panel \ && ./sun-panel -config From e0dcc49f5b23618103c5ee15e13758164d2eddf2 Mon Sep 17 00:00:00 2001 From: Sun <95302870@qq.com> Date: Wed, 24 Jan 2024 13:55:28 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/api/api_v1/common/apiReturn/ErrorCode.go | 5 ++++- service/api/api_v1/panel/itemIcon.go | 3 ++- service/api/api_v1/system/user.go | 2 +- src/components/apps/UserInfo/index.vue | 8 -------- src/locales/en-US.json | 1 + src/locales/zh-CN.json | 3 ++- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/service/api/api_v1/common/apiReturn/ErrorCode.go b/service/api/api_v1/common/apiReturn/ErrorCode.go index fb61e08..185fb34 100644 --- a/service/api/api_v1/common/apiReturn/ErrorCode.go +++ b/service/api/api_v1/common/apiReturn/ErrorCode.go @@ -1,12 +1,15 @@ package apiReturn var ErrorCodeMap = map[int]string{ - // -1:操作失败 + // -1:操作失败(前端会自动弹窗) + // 100: "operation failed", + 1000: "Not logged in yet", // 还未登录 1003: "Incorrect username or password", // 用户名或密码错误 1004: "Account disabled or not activated", // 账号已停用或未激活 1005: "No current permission for operation", // 当前无权限操作 1006: "Account does not exist", // 账号不存在 + 1007: "Old password error", // 旧密码不正确 // 数据类 1200: "Database error", // 数据库错误 diff --git a/service/api/api_v1/panel/itemIcon.go b/service/api/api_v1/panel/itemIcon.go index b00c92a..4b7bf07 100644 --- a/service/api/api_v1/panel/itemIcon.go +++ b/service/api/api_v1/panel/itemIcon.go @@ -28,7 +28,8 @@ func (a *ItemIcon) Edit(c *gin.Context) { } if req.ItemIconGroupId == 0 { - apiReturn.Error(c, "Group is mandatory") + // apiReturn.Error(c, "Group is mandatory") + apiReturn.ErrorParamFomat(c, "Group is mandatory") return } diff --git a/service/api/api_v1/system/user.go b/service/api/api_v1/system/user.go index 9594929..bafe228 100644 --- a/service/api/api_v1/system/user.go +++ b/service/api/api_v1/system/user.go @@ -97,7 +97,7 @@ func (a *UserApi) UpdatePasssword(c *gin.Context) { } else { if v.Password != cmn.PasswordEncryption(params.OldPassword) { // 旧密码不正确 - apiReturn.Error(c, global.Lang.Get("user.api_old_pass_error")) + apiReturn.ErrorByCode(c, 1007) return } } diff --git a/src/components/apps/UserInfo/index.vue b/src/components/apps/UserInfo/index.vue index 94ce97a..8d65fdb 100644 --- a/src/components/apps/UserInfo/index.vue +++ b/src/components/apps/UserInfo/index.vue @@ -104,14 +104,6 @@ function handleUpdatePassword(e: MouseEvent) { updatePasswordModalState.value.show = false ms.success(t('common.success')) } - else if (code === 0) { - // 旧密码错误 - - } - else { - // 其他错误 - ms.error(`${t('common.failed')}:${msg}`) - } }).finally(() => { updatePasswordModalState.value.loading = false }).catch(() => { diff --git a/src/locales/en-US.json b/src/locales/en-US.json index aab014a..4b31a96 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -25,6 +25,7 @@ "1004": "Account has been deactivated or inactivated", "1005": "Currently no permission to operate", "1006": "Account does not exist", + "1007": "Old password error", "1200": "database error", "1201": "Please keep at least one", "1202": "Data record not found", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index b9008d4..e5036fe 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -25,6 +25,7 @@ "1004": "账号已停用或未激活", "1005": "当前无权限操作", "1006": "账号不存在", + "1007": "旧密码错误", "1200": "数据库出错", "1201": "请至少保留一个", "1202": "未找到数据记录", @@ -55,7 +56,7 @@ "configFailed": "配置保存失败,{message}", "configSaved": "配置已保存", "contentArea": "内容区域", - "customFooter": "自定义footer", + "customFooter": "自定义页脚", "customImageAddress": "展开图片链接输入框", "detailIcon": "详情图标", "hideDescription": "隐藏描述信息", From fceacf58b87b988827f0baa6086e8296c843c495 Mon Sep 17 00:00:00 2001 From: Sun <95302870@qq.com> Date: Wed, 24 Jan 2024 14:54:37 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E6=A8=A1=E5=BC=8F=E5=88=87=E6=8D=A2=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/apps/Style/index.vue | 7 ++++++ src/locales/en-US.json | 1 + src/locales/zh-CN.json | 1 + src/store/modules/panel/helper.ts | 1 + src/store/modules/panel/index.ts | 2 +- src/typings/panel.d.ts | 1 + src/views/home/index.vue | 37 +++++++++++++++-------------- 7 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/components/apps/Style/index.vue b/src/components/apps/Style/index.vue index 96c0fff..07abccb 100644 --- a/src/components/apps/Style/index.vue +++ b/src/components/apps/Style/index.vue @@ -237,6 +237,13 @@ function resetPanelConfig() { + +
+ {{ $t('apps.baseSettings.netModeChangeButtonShow') }} + +
+
+
{{ $t('apps.baseSettings.maxWidth') }} diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 4b31a96..92b4a1e 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -64,6 +64,7 @@ "leftRightMargin": "Left-right margin", "mask": "Mask", "maxWidth": "Max width", + "netModeChangeButtonShow": "Show network mode switch button", "publicVisitModeShow": "Allow public mode display", "resetWarnText": "Are you sure you want to reset these styles?", "searchBar": "Search bar component", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index e5036fe..3744072 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -64,6 +64,7 @@ "leftRightMargin": "左右边距", "mask": "遮罩", "maxWidth": "最大宽度", + "netModeChangeButtonShow": "显示网络模式切换按钮", "publicVisitModeShow": "公开模式允许显示", "resetWarnText": "确定要重置这些样式吗?", "searchBar": "搜索栏组件", diff --git a/src/store/modules/panel/helper.ts b/src/store/modules/panel/helper.ts index 934e186..f2039dd 100644 --- a/src/store/modules/panel/helper.ts +++ b/src/store/modules/panel/helper.ts @@ -28,6 +28,7 @@ export function defaultStatePanelConfig(): Panel.panelConfig { systemMonitorShow: false, systemMonitorShowTitle: true, systemMonitorPublicVisitModeShow: false, + netModeChangeButtonShow: true, } } diff --git a/src/store/modules/panel/index.ts b/src/store/modules/panel/index.ts index 7814b88..579850e 100644 --- a/src/store/modules/panel/index.ts +++ b/src/store/modules/panel/index.ts @@ -26,7 +26,7 @@ export const usePanelState = defineStore('panel', { this.recordState() }, - // 获取云端的面板配置 + // 获取云端(搭建的服务器)的面板配置 updatePanelConfigByCloud() { getUserConfig().then((res) => { if (res.code === 0) diff --git a/src/typings/panel.d.ts b/src/typings/panel.d.ts index 384d76a..362bf3f 100644 --- a/src/typings/panel.d.ts +++ b/src/typings/panel.d.ts @@ -59,6 +59,7 @@ declare namespace Panel { systemMonitorShow?:boolean systemMonitorShowTitle?:boolean systemMonitorPublicVisitModeShow?:boolean + netModeChangeButtonShow?:boolean } interface userConfig{ diff --git a/src/views/home/index.vue b/src/views/home/index.vue index cb08be5..e225b5a 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -503,10 +503,11 @@ function handleAddItem(itemIconGroupId?: number) { /> -
+
+