diff --git a/backend/internal/controllers/config.go b/backend/internal/controllers/config.go index 4e37500..30b3b30 100644 --- a/backend/internal/controllers/config.go +++ b/backend/internal/controllers/config.go @@ -6,10 +6,17 @@ import ( "time" "github.com/labstack/echo/v5" + "github.com/samber/lo" "github.com/spf13/cast" ) func GetConfig(c *echo.Context) error { + featureConfig := u.GetEnvMap("features") + features := lo.FilterMap(lo.Entries(featureConfig), func(e lo.Entry[string, any], _ int) (string, bool) { + node, ok := e.Value.(map[string]any) + return e.Key, ok && cast.ToBool(node["enabled"]) + }) + return utils.HTTPSuccessHandler(c, map[string]any{ "site_title": u.GetEnvMap("site.title"), "site_desc": u.GetEnvMap("site.desc"), @@ -18,5 +25,6 @@ func GetConfig(c *echo.Context) error { "site_bg_url": u.GetEnvWithDefault("site.bg_url", "https://img.fudaoyuan.icu/api/1/random/?scale_min=1.5&webp=true&md=false&format=302"), "version": u.GetEnvWithDefault("VERSION", "dev"), "build_time": cast.ToInt(u.GetEnvWithDefault("BUILD_TIME", cast.ToString(time.Now().Unix()))), + "features": features, }) } diff --git a/front/components/Drawer/FileShareDrawer.vue b/front/components/Drawer/FileShareDrawer.vue index 782576a..9d94864 100644 --- a/front/components/Drawer/FileShareDrawer.vue +++ b/front/components/Drawer/FileShareDrawer.vue @@ -1,23 +1,11 @@