From 282f55c7a3c55c9a73a29c364b26b06dc81da271 Mon Sep 17 00:00:00 2001 From: RockYang Date: Mon, 15 Jul 2024 18:44:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=89=88=E6=9D=83=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91=EF=BC=8C=E5=85=81=E8=AE=B8=E6=BF=80?= =?UTF-8?q?=E6=B4=BB=E7=94=A8=E6=88=B7=E6=9B=B4=E6=94=B9=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=89=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/config.sample.toml | 2 +- api/core/types/config.go | 1 + api/handler/admin/config_handler.go | 7 ++++++ deploy/conf/config.toml | 2 +- web/.env.development | 2 +- web/.env.production | 3 +-- web/src/components/FooterBar.vue | 35 +++++++++++++++++++++++------ web/src/components/LoginDialog.vue | 5 ++++- web/src/router.js | 14 +----------- web/src/utils/http.js | 6 ++++- web/src/views/Index.vue | 10 ++++----- web/src/views/Login.vue | 6 ++--- web/src/views/MarkMap.vue | 32 +++++++++++++++----------- web/src/views/admin/SysConfig.vue | 10 +++++++-- 14 files changed, 83 insertions(+), 52 deletions(-) diff --git a/api/config.sample.toml b/api/config.sample.toml index 4f2819a6..eb33a5d7 100644 --- a/api/config.sample.toml +++ b/api/config.sample.toml @@ -18,7 +18,7 @@ TikaHost = "http://tika:9998" DB = 0 [ApiConfig] # 微博热搜,今日头条等函数服务 API 配置,此为第三方插件服务,如需使用请联系作者开通 - ApiURL = "" + ApiURL = "https://sapi.geekai.me" AppId = "" Token = "" diff --git a/api/core/types/config.go b/api/core/types/config.go index a31be482..1158b684 100644 --- a/api/core/types/config.go +++ b/api/core/types/config.go @@ -228,4 +228,5 @@ type SystemConfig struct { SdNegPrompt string `json:"sd_neg_prompt"` // SD 默认反向提示词 IndexBgURL string `json:"index_bg_url"` // 前端首页背景图片 + Copyright string `json:"copyright"` // 版权信息 } diff --git a/api/handler/admin/config_handler.go b/api/handler/admin/config_handler.go index 584b026b..66ee2a27 100644 --- a/api/handler/admin/config_handler.go +++ b/api/handler/admin/config_handler.go @@ -50,6 +50,7 @@ func (h *ConfigHandler) Update(c *gin.Context) { Content string `json:"content,omitempty"` Updated bool `json:"updated,omitempty"` } `json:"config"` + ConfigBak types.SystemConfig `json:"config_bak,omitempty"` } if err := c.ShouldBindJSON(&data); err != nil { @@ -57,6 +58,12 @@ func (h *ConfigHandler) Update(c *gin.Context) { return } + // ONLY authorized user can change the copyright + if (data.Key == "system" && data.Config.Copyright != data.ConfigBak.Copyright) && !h.licenseService.GetLicense().Configs.DeCopy { + resp.ERROR(c, "您无权修改版权信息,请先联系作者获取授权") + return + } + value := utils.JsonEncode(&data.Config) config := model.Config{Key: data.Key, Config: value} res := h.DB.FirstOrCreate(&config, model.Config{Key: data.Key}) diff --git a/deploy/conf/config.toml b/deploy/conf/config.toml index fee98bc8..2b834a43 100644 --- a/deploy/conf/config.toml +++ b/deploy/conf/config.toml @@ -21,7 +21,7 @@ TikaHost = "http://tika:9998" DB = 0 [ApiConfig] - ApiURL = "http://service.r9it.com:9001" + ApiURL = "http://sapi.geekai.me" AppId = "" Token = "" diff --git a/web/.env.development b/web/.env.development index 23f5535c..ba889b03 100644 --- a/web/.env.development +++ b/web/.env.development @@ -6,6 +6,6 @@ VUE_APP_ADMIN_USER=admin VUE_APP_ADMIN_PASS=admin123 VUE_APP_KEY_PREFIX=ChatPLUS_DEV_ VUE_APP_TITLE="Geek-AI 创作系统" -VUE_APP_VERSION=v4.1.0 +VUE_APP_VERSION=v4.1.1 VUE_APP_DOCS_URL=https://docs.geekai.me VUE_APP_GIT_URL=https://github.com/yangjian102621/geekai diff --git a/web/.env.production b/web/.env.production index 6a07e76e..6e3a7049 100644 --- a/web/.env.production +++ b/web/.env.production @@ -1,7 +1,6 @@ VUE_APP_API_HOST= VUE_APP_WS_HOST= VUE_APP_KEY_PREFIX=ChatPLUS_ -VUE_APP_TITLE="Geek-AI 创作系统" -VUE_APP_VERSION=v4.1.0 +VUE_APP_VERSION=v4.1.1 VUE_APP_DOCS_URL=https://docs.geekai.me VUE_APP_GIT_URL=https://github.com/yangjian102621/geekai diff --git a/web/src/components/FooterBar.vue b/web/src/components/FooterBar.vue index f2e106a5..671adf31 100644 --- a/web/src/components/FooterBar.vue +++ b/web/src/components/FooterBar.vue @@ -1,22 +1,43 @@