From b89b529252823bcecbf86aec749871b67d8d5380 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 11 Dec 2023 14:20:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=B2=E5=AE=89=E8=A3=85=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=BA=94=E7=94=A8=E6=B7=BB=E5=8A=A0=E8=AF=A6=E6=83=85?= =?UTF-8?q?=20(#3264)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs https://github.com/1Panel-dev/1Panel/issues/2957 --- backend/init/router/router.go | 9 +++------ frontend/src/views/app-store/apps/index.vue | 2 +- frontend/src/views/app-store/detail/index.vue | 11 +++++++++-- frontend/src/views/app-store/installed/index.vue | 9 ++++++++- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/backend/init/router/router.go b/backend/init/router/router.go index d980ef6f4..b83726d67 100644 --- a/backend/init/router/router.go +++ b/backend/init/router/router.go @@ -1,11 +1,10 @@ package router import ( + "fmt" + "github.com/gin-contrib/gzip" "html/template" "net/http" - "strings" - - "github.com/gin-contrib/gzip" "github.com/1Panel-dev/1Panel/backend/global" "github.com/1Panel-dev/1Panel/backend/i18n" @@ -22,12 +21,10 @@ import ( func setWebStatic(rootRouter *gin.RouterGroup) { rootRouter.StaticFS("/public", http.FS(web.Favicon)) rootRouter.Use(func(c *gin.Context) { - if strings.HasPrefix(c.Request.URL.Path, "/assets/") { - c.Header("Cache-Control", "max-age=31536000") - } c.Next() }) rootRouter.GET("/assets/*filepath", func(c *gin.Context) { + c.Writer.Header().Set("Cache-Control", fmt.Sprintf("private, max-age=%d", 3600)) staticServer := http.FileServer(http.FS(web.Assets)) staticServer.ServeHTTP(c.Writer, c.Request) }) diff --git a/frontend/src/views/app-store/apps/index.vue b/frontend/src/views/app-store/apps/index.vue index a0a130e15..ebc077feb 100644 --- a/frontend/src/views/app-store/apps/index.vue +++ b/frontend/src/views/app-store/apps/index.vue @@ -256,7 +256,7 @@ const openInstall = (app: App.App) => { }; const openDetail = (key: string) => { - detailRef.value.acceptParams(key); + detailRef.value.acceptParams(key, 'install'); }; const sync = () => { diff --git a/frontend/src/views/app-store/detail/index.vue b/frontend/src/views/app-store/detail/index.vue index 15919c7d0..5e48fb3a5 100644 --- a/frontend/src/views/app-store/detail/index.vue +++ b/frontend/src/views/app-store/detail/index.vue @@ -28,7 +28,12 @@ :closable="false" /> - + {{ $t('app.install') }} @@ -92,9 +97,11 @@ const loadingApp = ref(false); const installRef = ref(); const open = ref(false); const appKey = ref(); +const operate = ref(); -const acceptParams = async (key: string) => { +const acceptParams = async (key: string, op: string) => { appKey.value = key; + operate.value = op; open.value = true; getApp(); }; diff --git a/frontend/src/views/app-store/installed/index.vue b/frontend/src/views/app-store/installed/index.vue index 1f8cf6732..ad525d0e7 100644 --- a/frontend/src/views/app-store/installed/index.vue +++ b/frontend/src/views/app-store/installed/index.vue @@ -108,7 +108,7 @@ -
+
+