feat: add new color themes and styles for rose, violet, and yellow

- Introduced new CSS files for rose, violet, and yellow themes with custom color variables.
- Implemented dark mode styles for each theme.
- Created a color data structure to manage theme colors in the console settings.

feat: implement image cropper component

- Added an image cropper component for user profile picture editing.
- Integrated the image cropper into the user profile page.

feat: enhance console sidebar with user permissions

- Defined sidebar items with permission checks for admin and editor roles.
- Updated user center navigation to reflect user permissions.

feat: add user profile and security settings

- Developed user profile page with avatar upload and editing functionality.
- Implemented user security settings for password and email verification.

feat: create reusable dialog and OTP input components

- Built a dialog component for modal interactions.
- Developed an OTP input component for email verification.

fix: improve file handling utilities

- Added utility functions for file URI generation.
- Implemented permission checks for user roles in the common utilities.
This commit is contained in:
2025-09-20 12:45:10 +08:00
parent f8e4a84d53
commit 709aa82337
62 changed files with 1844 additions and 487 deletions

View File

@ -2,10 +2,13 @@ package filedriver
import (
"fmt"
"github.com/LiteyukiStudio/spage/pkg/constants"
"github.com/cloudwego/hertz/pkg/app"
"io"
"os"
"github.com/cloudwego/hertz/pkg/app"
"github.com/snowykami/neo-blog/pkg/constant"
"github.com/snowykami/neo-blog/pkg/utils"
)
type FileDriver interface {
@ -18,19 +21,30 @@ type FileDriver interface {
}
type DriverConfig struct {
Type string `mapstructure:"file.driver.type"`
BasePath string `mapstructure:"file.driver.base_path"`
WebDavUrl string `mapstructure:"file.driver.webdav.url"`
WebDavUser string `mapstructure:"file.driver.webdav.user"`
WebDavPassword string `mapstructure:"file.driver.webdav.password"`
WebDavPolicy string `mapstructure:"file.driver.webdav.policy"` // proxy|redirect
Type string
BasePath string
WebDavUrl string
WebDavUser string
WebDavPassword string
WebDavPolicy string
}
func GetWebdavDriverConfig() *DriverConfig {
return &DriverConfig{
Type: utils.Env.Get(constant.EnvKeyFileDriverType, constant.FileDriverTypeLocal),
BasePath: utils.Env.Get(constant.EnvKeyFileBasepath, constant.DefaultFileBasePath),
WebDavUrl: utils.Env.Get(constant.EnvKeyFileWebdavUrl),
WebDavUser: utils.Env.Get(constant.EnvKeyFileWebdavUser),
WebDavPassword: utils.Env.Get(constant.EnvKeyFileWebdavPassword),
WebDavPolicy: utils.Env.Get(constant.EnvKeyFileWebdavPolicy),
}
}
func GetFileDriver(driverConfig *DriverConfig) (FileDriver, error) {
switch driverConfig.Type {
case constants.FileDriverLocal:
case constant.FileDriverTypeLocal:
return NewLocalDriver(driverConfig), nil
case constants.FileDriverWebdav:
case constant.FileDriverTypeWebdav:
return NewWebDAVClientDriver(driverConfig), nil
default:
return nil, fmt.Errorf("unsupported file driver type: %s", driverConfig.Type)