Compare commits

...

3 Commits

Author SHA1 Message Date
eball
fc62d8280a feat: enhance user login background handling with style support (#2462) 2026-01-30 22:56:08 +08:00
hys
b8d6e2f3cc update bfl api image tag to v0.4.39 2026-01-21 19:19:07 +08:00
hys
763c80c5fa fix: myapps api add rawAppName field 2026-01-21 19:19:07 +08:00
8 changed files with 19 additions and 7 deletions

View File

@@ -266,7 +266,7 @@ spec:
containers:
- name: api
image: beclab/bfl:v0.4.38
image: beclab/bfl:v0.4.39
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 1000

View File

@@ -281,7 +281,7 @@ func (h *Handler) handleTerminusInfo(req *restful.Request, resp *restful.Respons
tInfo.TailScaleEnable = denyAll == 1
}
tInfo.LoginBackground = userOp.GetLoginBackground(user)
tInfo.LoginBackground, tInfo.Style = userOp.GetLoginBackground(user)
tInfo.Avatar = userOp.GetAvatar(user)
tInfo.UserDID = userOp.GetUserDID(user)
@@ -347,7 +347,7 @@ func (h *Handler) handleOlaresInfo(req *restful.Request, resp *restful.Response)
tInfo.TailScaleEnable = denyAll == 1
}
tInfo.LoginBackground = userOp.GetLoginBackground(user)
tInfo.LoginBackground, tInfo.Style = userOp.GetLoginBackground(user)
tInfo.Avatar = userOp.GetAvatar(user)
tInfo.UserDID = userOp.GetUserDID(user)

View File

@@ -40,6 +40,7 @@ type TerminusInfo struct {
UserDID string `json:"did"`
ReverseProxy string `json:"reverseProxy"`
Terminusd string `json:"terminusd"`
Style string `json:"style"`
}
type OlaresInfo struct {
@@ -53,6 +54,7 @@ type OlaresInfo struct {
ID string `json:"id"`
UserDID string `json:"did"`
Olaresd string `json:"olaresd"`
Style string `json:"style"`
}
type MyAppsParam struct {

View File

@@ -127,13 +127,18 @@ func (o *UserOperator) GetReverseProxyType() (string, error) {
return o.GetUserAnnotation(user, constants.UserAnnotationReverseProxyType), nil
}
func (o *UserOperator) GetLoginBackground(user *iamV1alpha2.User) string {
func (o *UserOperator) GetLoginBackground(user *iamV1alpha2.User) (string, string) {
b := o.GetUserAnnotation(user, constants.UserLoginBackground)
s := o.GetUserAnnotation(user, constants.UserLoginBackgroundStyle)
if b == "" {
return "/bg/0.jpg"
b = "/bg/0.jpg"
}
return b
if s == "" {
s = "fill"
}
return b, s
}
func (o *UserOperator) GetAvatar(user *iamV1alpha2.User) string {

View File

@@ -612,6 +612,7 @@ func (h *Handler) handleUpdateLocale(req *restful.Request, resp *restful.Respons
func (h *Handler) handlerUpdateUserLoginBackground(req *restful.Request, resp *restful.Response) {
var background struct {
Background string `json:"background"`
Style string `json:"style"`
}
err := req.ReadEntity(&background)
@@ -636,6 +637,7 @@ func (h *Handler) handlerUpdateUserLoginBackground(req *restful.Request, resp *r
err = userOp.UpdateUser(user, []func(*iamV1alpha2.User){
func(u *iamV1alpha2.User) {
u.Annotations[constants.UserLoginBackground] = background.Background
u.Annotations[constants.UserLoginBackgroundStyle] = background.Style
},
})

View File

@@ -240,6 +240,7 @@ func (c *Client) getAppListFromData(apps []map[string]interface{}) ([]*AppInfo,
res = append(res, &AppInfo{
ID: genAppID(appSpec),
Name: stringOrEmpty(appSpec["name"]),
RawAppName: stringOrEmpty(appSpec["rawAppName"]),
Namespace: stringOrEmpty(appSpec["namespace"]),
DeploymentName: stringOrEmpty(appSpec["deployment"]),
Owner: stringOrEmpty(appSpec["owner"]),

View File

@@ -11,6 +11,7 @@ import (
type AppInfo struct {
ID string `json:"id"`
Name string `json:"name"`
RawAppName string `json:"rawAppName"`
Namespace string `json:"namespace"`
DeploymentName string `json:"deployment"`
Owner string `json:"owner"`

View File

@@ -175,7 +175,8 @@ var (
UserAvatar = fmt.Sprintf("%s/avatar", AnnotationGroup)
UserLoginBackground = fmt.Sprintf("%s/login-background", AnnotationGroup)
UserLoginBackground = fmt.Sprintf("%s/login-background", AnnotationGroup)
UserLoginBackgroundStyle = fmt.Sprintf("%s/login-background-style", AnnotationGroup)
)
var (