二次开发:补全 PRO 功能 + 优化体验
- 新增站点自定义(标题/Favicon/登录页描述) - 新增在线自定义 CSS/JS 编辑器 - 扩展备份迁移支持面板配置导出导入 - 默认账号改为 admin/1234 - 设置按钮改为橙色更醒目 - 修复登录页误报"登录过期"弹窗 - 修复 i18n 双重 apps 块导致翻译失效 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package system
|
||||
|
||||
type ApiSystem struct {
|
||||
About About
|
||||
LoginApi LoginApi
|
||||
UserApi UserApi
|
||||
FileApi FileApi
|
||||
NoticeApi NoticeApi
|
||||
ModuleConfigApi ModuleConfigApi
|
||||
MonitorApi MonitorApi
|
||||
About About
|
||||
LoginApi LoginApi
|
||||
UserApi UserApi
|
||||
FileApi FileApi
|
||||
NoticeApi NoticeApi
|
||||
ModuleConfigApi ModuleConfigApi
|
||||
MonitorApi MonitorApi
|
||||
SiteCustomizeApi SiteCustomizeApi
|
||||
CustomStyleApi CustomStyleApi
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"sun-panel/api/api_v1/common/apiReturn"
|
||||
"sun-panel/global"
|
||||
"sun-panel/lib/cmn/systemSetting"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
type CustomStyleApi struct{}
|
||||
|
||||
// 获取自定义 CSS/JS(无需登录)
|
||||
func (a *CustomStyleApi) Get(c *gin.Context) {
|
||||
cfg := systemSetting.CustomStyle{}
|
||||
global.SystemSetting.GetValueByInterface(systemSetting.CUSTOM_STYLE, &cfg)
|
||||
apiReturn.SuccessData(c, cfg)
|
||||
}
|
||||
|
||||
// 保存自定义 CSS/JS(管理员)
|
||||
func (a *CustomStyleApi) Set(c *gin.Context) {
|
||||
cfg := systemSetting.CustomStyle{}
|
||||
if err := c.ShouldBindBodyWith(&cfg, binding.JSON); err != nil {
|
||||
apiReturn.ErrorParamFomat(c, err.Error())
|
||||
return
|
||||
}
|
||||
if err := global.SystemSetting.Set(systemSetting.CUSTOM_STYLE, cfg); err != nil {
|
||||
apiReturn.ErrorDatabase(c, err.Error())
|
||||
return
|
||||
}
|
||||
apiReturn.Success(c)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"sun-panel/api/api_v1/common/apiReturn"
|
||||
"sun-panel/global"
|
||||
"sun-panel/lib/cmn/systemSetting"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
type SiteCustomizeApi struct{}
|
||||
|
||||
// 获取站点自定义配置(无需登录,登录页使用)
|
||||
func (a *SiteCustomizeApi) Get(c *gin.Context) {
|
||||
cfg := systemSetting.SiteCustomize{}
|
||||
global.SystemSetting.GetValueByInterface(systemSetting.SITE_CUSTOMIZE, &cfg)
|
||||
apiReturn.SuccessData(c, cfg)
|
||||
}
|
||||
|
||||
// 保存站点自定义配置(管理员)
|
||||
func (a *SiteCustomizeApi) Set(c *gin.Context) {
|
||||
cfg := systemSetting.SiteCustomize{}
|
||||
if err := c.ShouldBindBodyWith(&cfg, binding.JSON); err != nil {
|
||||
apiReturn.ErrorParamFomat(c, err.Error())
|
||||
return
|
||||
}
|
||||
if err := global.SystemSetting.Set(systemSetting.SITE_CUSTOMIZE, cfg); err != nil {
|
||||
apiReturn.ErrorDatabase(c, err.Error())
|
||||
return
|
||||
}
|
||||
apiReturn.Success(c)
|
||||
}
|
||||
Reference in New Issue
Block a user