feat(users): support avatar, email and bgColor in fe

This commit is contained in:
hexxa 2022-03-20 17:47:15 +08:00 committed by Hexxa
parent 817ced61de
commit 95e5be092a
12 changed files with 36 additions and 3 deletions

View file

@ -20,6 +20,7 @@ export interface BgConfig {
repeat: string; repeat: string;
position: string; position: string;
align: string; align: string;
bgColor: string;
} }
export interface Preferences { export interface Preferences {
@ -28,6 +29,8 @@ export interface Preferences {
lanPackURL: string; lanPackURL: string;
lan: string; lan: string;
theme: string; theme: string;
avatar: string;
email: string;
} }
export interface User { export interface User {

View file

@ -17,11 +17,13 @@ export const resps = {
data: { data: {
siteName: "", siteName: "",
siteDesc: "", siteDesc: "",
captchaEnabled: true,
bg: { bg: {
url: "clientCfg_bg_url", url: "clientCfg_bg_url",
repeat: "clientCfg_bg_repeat", repeat: "clientCfg_bg_repeat",
position: "clientCfg_bg_position", position: "clientCfg_bg_position",
align: "clientCfg_bg_align", align: "clientCfg_bg_align",
bgColor: "clientCfg_bg_bg_Color"
}, },
}, },
}, },

View file

@ -89,11 +89,14 @@ export const resps = {
repeat: "bgRepeat", repeat: "bgRepeat",
position: "bgPosition", position: "bgPosition",
align: "bgAlign", align: "bgAlign",
bgColor: "bgColor",
}, },
cssURL: "cssURL", cssURL: "cssURL",
lanPackURL: "lanPackURL", lanPackURL: "lanPackURL",
lan: "en_US", lan: "en_US",
theme: "light", theme: "light",
avatar: "avatar",
email: "email",
}, },
}, },
}, },

View file

@ -93,11 +93,14 @@ describe("Login", () => {
repeat: "bgRepeat", repeat: "bgRepeat",
position: "bgPosition", position: "bgPosition",
align: "bgAlign", align: "bgAlign",
bgColor: "bgColor",
}, },
cssURL: "cssURL", cssURL: "cssURL",
lanPackURL: "lanPackURL", lanPackURL: "lanPackURL",
lan: "en_US", lan: "en_US",
theme: "light", theme: "light",
avatar: "avatar",
email: "email",
}, },
}); });
@ -122,11 +125,13 @@ describe("Login", () => {
isVertical: false, isVertical: false,
siteName: "", siteName: "",
siteDesc: "", siteDesc: "",
captchaEnabled: true,
bg: { bg: {
url: "clientCfg_bg_url", url: "clientCfg_bg_url",
repeat: "clientCfg_bg_repeat", repeat: "clientCfg_bg_repeat",
position: "clientCfg_bg_position", position: "clientCfg_bg_position",
align: "clientCfg_bg_align", align: "clientCfg_bg_align",
bgColor: "clientCfg_bg_bg_Color",
}, },
control: { control: {
controls: Map<string, string>({ controls: Map<string, string>({

View file

@ -109,11 +109,14 @@ describe("State Manager", () => {
repeat: "bgRepeat", repeat: "bgRepeat",
position: "bgPosition", position: "bgPosition",
align: "bgAlign", align: "bgAlign",
bgColor: "bgColor",
}, },
cssURL: "cssURL", cssURL: "cssURL",
lanPackURL: "lanPackURL", lanPackURL: "lanPackURL",
lan: "en_US", lan: "en_US",
theme: "light", theme: "light",
avatar: "avatar",
email: "email",
}, },
}); });
@ -326,11 +329,14 @@ describe("State Manager", () => {
repeat: "", repeat: "",
position: "", position: "",
align: "", align: "",
bgColor: "",
}, },
cssURL: "", cssURL: "",
lanPackURL: "", lanPackURL: "",
lan: "en_US", lan: "en_US",
theme: "light", theme: "light",
avatar: "",
email: "",
}, },
}); });
@ -351,6 +357,7 @@ describe("State Manager", () => {
position: "clientCfg_bg_position", position: "clientCfg_bg_position",
repeat: "clientCfg_bg_repeat", repeat: "clientCfg_bg_repeat",
url: "clientCfg_bg_url", url: "clientCfg_bg_url",
bgColor: "clientCfg_bg_bg_Color",
}); });
}); });
}); });

View file

@ -139,11 +139,14 @@ describe("TopBar", () => {
repeat: "", repeat: "",
position: "", position: "",
align: "", align: "",
bgColor: "",
}, },
cssURL: "", cssURL: "",
lanPackURL: "", lanPackURL: "",
lan: "en_US", lan: "en_US",
theme: "light", theme: "light",
avatar: "",
email: "",
}, },
}); });

View file

@ -34,6 +34,7 @@ export interface UIProps {
repeat: string; repeat: string;
position: string; position: string;
align: string; align: string;
bgColor: string;
}; };
control: { control: {
controls: Map<string, string>; controls: Map<string, string>;
@ -103,11 +104,14 @@ export function initState(): ICoreState {
repeat: "", repeat: "",
position: "", position: "",
align: "", align: "",
bgColor: "",
}, },
cssURL: "", cssURL: "",
lanPackURL: "", lanPackURL: "",
lan: "en_US", lan: "en_US",
theme: "light", theme: "light",
avatar: "",
email: "",
}, },
}, },
msg: { msg: {
@ -123,6 +127,7 @@ export function initState(): ICoreState {
repeat: "", repeat: "",
position: "", position: "",
align: "", align: "",
bgColor: "",
}, },
captchaEnabled: true, captchaEnabled: true,
control: { control: {

View file

@ -830,6 +830,7 @@ export class BgCfg extends React.Component<BgProps, BgState, {}> {
repeat: "repeat", repeat: "repeat",
position: "center", position: "center",
align: "fixed", align: "fixed",
bgColor: "",
}, },
}); });
this.props.update(updater().updateUI); this.props.update(updater().updateUI);

View file

@ -618,11 +618,14 @@ export class Updater {
repeat: "", repeat: "",
position: "", position: "",
align: "", align: "",
bgColor: "",
}, },
cssURL: "", cssURL: "",
lanPackURL: "", lanPackURL: "",
lan: "en_US", lan: "en_US",
theme: "light", theme: "light",
avatar: "",
email: "",
}; };
}; };

View file

@ -80,9 +80,6 @@ func NewFileInfoStore(store kvstore.IKVStore) (*FileInfoStore, error) {
boltdb: boltdb, boltdb: boltdb,
mtx: &sync.RWMutex{}, mtx: &sync.RWMutex{},
} }
if err = migrate(fi); err != nil {
return nil, err
}
return fi, nil return fi, nil
} }

View file

@ -457,6 +457,8 @@ func TestUsersHandlers(t *testing.T) {
}, },
CSSURL: "/cssurl", CSSURL: "/cssurl",
LanPackURL: "/lanpack", LanPackURL: "/lanpack",
Avatar: "a1",
Email: "email1",
}, },
&db.Preferences{ &db.Preferences{
Bg: &sitestore.BgConfig{ Bg: &sitestore.BgConfig{
@ -468,6 +470,8 @@ func TestUsersHandlers(t *testing.T) {
}, },
CSSURL: "/cssurl2", CSSURL: "/cssurl2",
LanPackURL: "/lanpack2", LanPackURL: "/lanpack2",
Avatar: "a2",
Email: "email2",
}, },
} }
for _, prefer := range prefers { for _, prefer := range prefers {

Binary file not shown.