admin

package
v0.33.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

auth.go 认证职责簇:管理员登录凭据校验与 JWT 签发(GenerateTokenForAdmin 属认证职责,单独成文件)。

config.go 站点配置的门面(facade):类型别名 + 委派方法。

2026-10-10 配置中心独立为 app/config 域(全站配置的唯一写者),本文件只留 admin 管理面 API 的委派层——gen/handler/admin、gen/handler/setup、 transport admin_manage 等既有消费方零改动。新代码请直接消费 app/config (装配层先例:bootstrap 已直指 config.Default())。

files.go 文件/分享治理簇:列表/详情/恢复/彻底删除/管控状态/删除/延期与批量操作。

janitor.go 存储对账与日志保留(治理 2026-10-03)。

此前代码注释多次声称"孤儿文件由清理任务兜底"但该任务并不存在: 物理文件在 DB 无引用(写库失败/分片中断/老 bug 遗留)时永不回收。 本文件补上两个低频后台任务:

  • ReconcileOrphans:物理文件 vs DB 引用差集清理。local 后端真删除; 远端后端(s3/webdav/多云)只统计报告不删除(远端误删代价不对称, 且全量 List 成本高,等真实需求出现再做远端对账)。
  • CleanupLogs:transfer_log / admin_operation_log 按保留天数清理 (此前审计表无限膨胀)。

maintenance.go 维护清理簇:过期文件清理/未完成上传清理/数据库优化。

service.go Service 骨架与接线:结构体定义/构造/注入 Setter/审计入口/包级单例。

2026-10-10 站点配置中心独立为 app/config 域:本域只保留治理职责 (用户/文件/统计/维护/认证/审计)与管理面 API 的配置门面委派(config.go)。

stats.go 统计簇:Dashboard 统计/富指标/趋势序列/传输日志查询。

system.go 系统信息/日志簇:运行时信息/存储状态/系统日志查询。

users.go 用户管理簇:用户列表/筛选/删除/密码重置/状态变更。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Audit

func Audit(ctx context.Context, action, target string, success bool)

Audit 管理端操作审计的统一入口(transport 侧审计写入收口到此,消除与 service 层的孪生实现;经全站唯一 Default() 实例落库)。

func InitDefault added in v0.16.0

func InitDefault(gormDB *gorm.DB)

InitDefault 注册全站 admin 单例(bootstrap 在 config.InitDefault 之后调用;幂等)。 全站单例改绑配置中心单例:admin.Default() 与 config.Default() 共享 同一份配置内存缓存与 DB 写通道(单行读改写约束,见 app/config 包注释)。

Types

type AdminStats

type AdminStats struct {
	TotalUsers     int64 `json:"total_users"`
	TotalFiles     int64 `json:"total_files"`
	TotalSize      int64 `json:"total_size"`
	TodayUploads   int64 `json:"today_uploads"`
	TodayDownloads int64 `json:"today_downloads"`
	ExpiredFiles   int64 `json:"expired_files"`
	AnonymousFiles int64 `json:"anonymous_files"`
	UserFiles      int64 `json:"user_files"`
	// 文件健康洞察维度(2026-10-07;IDL AdminStatsData 同步暴露)
	ActiveFiles       int64 `json:"active_files"`
	ExpiringSoonFiles int64 `json:"expiring_soon_files"`
	NeverPickedFiles  int64 `json:"never_picked_files"`
	ForeverFiles      int64 `json:"forever_files"`
}

type BaseConfig added in v0.18.0

type BaseConfig = appconfig.BaseConfig

类型别名:管理面 handler 构造/消费的类型不变(JSON 形状同源于 config 域)。

type EnhancedStats

type EnhancedStats struct {
	TodayUploads     int64             `json:"today_uploads"`
	YesterdayUploads int64             `json:"yesterday_uploads"`
	TotalDownloads   int64             `json:"total_downloads"`
	ExpiredFiles     int64             `json:"expired_files"`
	AnonymousFiles   int64             `json:"anonymous_files"`
	PresignFiles     int64             `json:"presign_files"`
	TopSuffixes      []*dao.SuffixStat `json:"top_suffixes"`
	// 站点级存储配额(storage.quota,0=不限)与当前用量(存活 file_codes 合计)
	StorageUsed  int64 `json:"storage_used"`
	StorageQuota int64 `json:"storage_quota"`
}

EnhancedStats Dashboard 富指标(昨日对比/下载总量/类型分布)。

type FederationNotifier

type FederationNotifier interface {
	ShareDeleted(code string)
}

FederationNotifier P2P 联邦撤销钩子(窄接口,实现在 app/federation; bootstrap 注入。admin 删除路径独立于 share 域,须单独挂钩——否则管理端 删除的分享在联邦里残留到公告 TTL 过期)。

type Janitor

type Janitor struct {
	// contains filtered or unexported fields
}

Janitor 存储对账 + 日志保留。svc 为 nil 或非 local 时对账自动跳过。

func NewJanitor

func NewJanitor(gormDB *gorm.DB, svc StorageProvider, retentionDays int) *Janitor

NewJanitor 创建 janitor。

func (*Janitor) CleanRemotePresignOrphans

func (j *Janitor) CleanRemotePresignOrphans(ctx context.Context, olderThan time.Duration) (int, error)

CleanRemotePresignOrphans 清理远端后端的 presign 孤儿对象: Init 后未 Complete 的直传残留(对象 key 形如 uploads/日期/up_<uuid>.ext, basename up_ 前缀与普通上传的 uuid 名可区分),无 DB 引用且超过宽限期的删除。 远端后端此前完全不对账(ReconcileOrphans 对远端只报告),孤儿只增不减—— 且匿名 presign Init 可被滥用为免费网盘(2026-10-06 审计确认),此方法为其兜底。 本地后端不适用(ReconcileOrphans 磁盘对账已覆盖)。

func (*Janitor) CleanupLogs

func (j *Janitor) CleanupLogs(ctx context.Context) (int64, error)

CleanupLogs 按保留天数清理传输日志与审计日志。返回删除行数。

func (*Janitor) CleanupPickupCharges added in v0.32.0

func (j *Janitor) CleanupPickupCharges(ctx context.Context, retentionDays int) (int64, error)

CleanupPickupCharges 清理取件记录(2026-10-24)。

这张表有两个角色:**去重键**(同一令牌不重复计次,令牌过期后即可丢)与 **owner 侧取件历史的逐条明细**(IP/时间/交付面,要留很久)。 ⇒ 清理窗口**必须按明细的留存需求**给(默认 30 天),不能跟着令牌 TTL 走 (此前取 TTL+1h ⇒ owner 看到的明细最多存在 1 小时 ⇒ 逐条历史形同虚设)。

retentionDays = 0 ⇒ 永久保留(不按时间删)。

另清「孤儿」:分享被硬删后其明细没有主人可看 ⇒ 一并删除(软删/回收站不算)。

func (*Janitor) CleanupStaleUploads

func (j *Janitor) CleanupStaleUploads(ctx context.Context, maxAge time.Duration) (dirsRemoved int, err error)

CleanupStaleUploads 清理弃管的分片会话(治理 2026-10-03): init 后永不 complete 的会话此前永久滞留(目录 + DB 行),且唯一的 手动清理在非 SQLite 库上直接 SQL 报错。incomplete 超龄 → 删目录 + 删行; 已完成会话旧行单独清理(防 upload_chunks 表无限膨胀)。

func (*Janitor) CountRemotePresignOrphans added in v0.14.9

func (j *Janitor) CountRemotePresignOrphans(ctx context.Context, olderThan time.Duration) (int, error)

CountRemotePresignOrphans 只读统计:当前满足清理判定的 presign 孤儿数 (存储洞察 /admin/storage/insights 用,不删除任何对象)。

func (*Janitor) ReconcileOrphans

func (j *Janitor) ReconcileOrphans(ctx context.Context) (int, int, error)

ReconcileOrphans 物理文件对账。返回 (扫描文件数, 清理文件数, error)。

func (*Janitor) ScanRemotePresignOrphans added in v0.14.9

func (j *Janitor) ScanRemotePresignOrphans(ctx context.Context, olderThan time.Duration) ([]string, error)

ScanRemotePresignOrphans 列举满足清理判定的远端 presign 孤儿对象 key(只读): up_ 前缀 + 无 DB 引用 + 超过 olderThan 宽限期。本地后端返回空集 (磁盘对账 ReconcileOrphans 已覆盖,无 presign 孤儿语义)。

type LogEntry

type LogEntry struct {
	ID        uint64 `json:"id"`
	Level     string `json:"level"`
	Message   string `json:"message"`
	CreatedAt string `json:"created_at"`
	Module    string `json:"module"`
	UserID    string `json:"user_id"`
}

LogEntry 日志条目

type ReconfigureHooks

type ReconfigureHooks = appconfig.ReconfigureHooks

类型别名:管理面 handler 构造/消费的类型不变(JSON 形状同源于 config 域)。

type Service

type Service struct {
	// contains filtered or unexported fields
}

func Default

func Default() *Service

Default 全站共享的 admin Service 实例(治理面 + 配置门面同一实例; 未 InitDefault 直接取用是装配错误,fail-loud)。

func NewService

func NewService(gormDB *gorm.DB) *Service

func (*Service) BatchDeleteFiles

func (s *Service) BatchDeleteFiles(ctx context.Context, ids []uint) (int, error)

BatchDeleteFiles 批量删除:DB 软删 + 物理文件清理(best-effort,失败不阻断, 孤儿由 janitor 对账)。返回受影响行数。

func (*Service) BatchExtendFiles

func (s *Service) BatchExtendFiles(ctx context.Context, ids []uint, expireAt time.Time) (int, error)

BatchExtendFiles 管理端跨用户批量延期。

func (*Service) ChildFileCounts

func (s *Service) ChildFileCounts(ctx context.Context, ids []uint) map[uint]int64

ChildFileCounts 批量取子文件数(一次 GROUP BY;失败返回 nil 由调用方降级为 0)。

func (*Service) CleanExpiredFiles

func (s *Service) CleanExpiredFiles(ctx context.Context) (int64, int64, error)

CleanExpiredFiles 清理过期文件(DB 记录 + 物理文件)。 物理删除失败不阻断 DB 删除(记日志);DB 删除失败不阻断(下轮重试)。

func (*Service) CleanTempFiles

func (s *Service) CleanTempFiles(ctx context.Context) (int64, int64, error)

CleanTempFiles 清理临时文件

func (*Service) CleanupExpiredFiles

func (s *Service) CleanupExpiredFiles(ctx context.Context) (int, error)

CleanupExpiredFiles 清理过期文件

func (*Service) CleanupIncompleteUploads

func (s *Service) CleanupIncompleteUploads(ctx context.Context, olderThanHours int) (int, error)

CleanupIncompleteUploads 清理未完成的上传

func (*Service) ConfigService added in v0.15.1

func (s *Service) ConfigService() *appconfig.Service

ConfigService 暴露内部配置中心实例(bootstrap 装配/守卫测试用; 管理面 handler 请走下方委派方法)。

func (*Service) DeleteFile

func (s *Service) DeleteFile(ctx context.Context, fileID uint) error

DeleteFile 删除文件(DB 记录 + 物理文件;此前物理删除被注释,造成存储泄漏)

func (*Service) DeleteUser

func (s *Service) DeleteUser(ctx context.Context, userID uint) error

DeleteUser 删除用户(级联软删其全部分享记录;此前"先删用户文件"逻辑被注释)

func (*Service) EnhancedStats

func (s *Service) EnhancedStats(ctx context.Context) (*EnhancedStats, error)

EnhancedStats 汇总富指标。单项统计失败按 0 降级(与历史 handler 行为一致)。

func (*Service) GenerateTokenForAdmin

func (s *Service) GenerateTokenForAdmin(ctx context.Context, username, password string) (string, error)

GenerateTokenForAdmin 生成管理员登录 token

func (*Service) GetConfig

func (s *Service) GetConfig(ctx context.Context) (*SystemConfig, error)

GetConfig 获取系统配置(委派 config 域;首次调用从 DB 懒加载)。

func (*Service) GetFileByCode

func (s *Service) GetFileByCode(ctx context.Context, code string) (*model.FileCode, error)

GetFileByCode 按码获取分享记录(**分享码或 6 位取件码**都认)。

此前只查 code 列(分享码/自定义码)⇒ 管理员手里只有取件码时查不到 (与 MCP 的 resolveFileCode 结论相反 ⇒ 同一输入两个管理面结论相左)。 ⇒ 统一走 dao.ResolveByCode 解析器。

func (*Service) GetFileByID

func (s *Service) GetFileByID(ctx context.Context, id uint) (*model.FileCode, error)

GetFileByID 按主键取分享记录(管理端详情/下载重定向)。

func (*Service) GetFileDetail

func (s *Service) GetFileDetail(ctx context.Context, id uint) (*model.FileCode, []*model.FileCodeFile, error)

GetFileDetail 文件详情:主记录 + 子文件行。 (2026-10-26 订正:旧注释说「旧单文件分享无子行由调用方回退主表合成」——

虚拟行已退役、**没有**这条回退路径;子表是文件清单的唯一真相源,
存量无子行的分享由启动期数据迁移补齐。)

func (*Service) GetFiles

func (s *Service) GetFiles(ctx context.Context, page, pageSize int, search string) ([]*model.FileCode, int64, error)

GetFiles 获取文件列表

func (*Service) GetFilesFiltered

func (s *Service) GetFilesFiltered(ctx context.Context, q model.FileCodeQuery) ([]*model.FileCode, int64, error)

GetFilesFiltered 管理端文件列表组合过滤(治理 2026-10-03: keyword/user/upload_type/owner_ip/status/大小/时间/过期,供 /admin/files/filter)。

2026-10-29:顺带批量补齐上传者用户名 —— 此前只给裸 user_id,管理台「上传者」 列只能渲染 "ID: 1",管理员看不出是谁传的。补齐失败**不阻断**列表返回 (用户名是展示增强,不是查询前提)。

func (*Service) GetStats

func (s *Service) GetStats(ctx context.Context) (*AdminStats, error)

GetStats 获取管理员统计信息

func (*Service) GetStorageStatus

func (s *Service) GetStorageStatus(ctx context.Context) (*StorageStatus, error)

GetStorageStatus 获取存储状态(真实数据)。

  • 后端类型:注入的 *storage.StorageService.EffectiveType()(远端构造失败 降级 local 时如实报 local);未注入/非具体类型时按 local。
  • 容量:仅本地后端有磁盘容量语义(Statfs 实测总/可用);对象存储等远端 后端容量弹性无上限,Total/Free 如实置 0,不虚构数字(此前恒报 local+100GB 假容量,管理面板展示的是虚构信息)。
  • UsedSpace/FileCount:DB 存活分享的尺寸合计/条数(应用层口径,与 站点配额闸同源),本地模式下不等于磁盘已用(磁盘还含分片临时区等)。

func (*Service) GetSystemInfo

func (s *Service) GetSystemInfo(ctx context.Context) (*SystemInfo, error)

GetSystemInfo 获取系统信息。版本/进程启动时刻来自 kit/version(-ldflags 注入,未注入时 version=dev、StartTime=包加载时刻)——此前 Version 硬编码 "1.0.0"、Uptime 用 time.Since(time.Now()) 恒为零,均为假数据。

func (*Service) GetSystemLogs

func (s *Service) GetSystemLogs(ctx context.Context, level string, page, pageSize int) ([]*LogEntry, int64, error)

GetSystemLogs 获取系统日志(真实数据):读 pkg/logger 进程内环形缓冲 (Init 时 Tee 进主日志链,容量有界、重启即清——定位是「最近运行日志」 面板;操作审计在 operation_logs 表另有专页)。此处此前是返回模拟数据的桩, 现已改为读环形缓冲的真实日志。level 空=全部,否则精确匹配级别名; 分页窗口按时间序最旧在前。

func (*Service) GetTransferLogs

func (s *Service) GetTransferLogs(ctx context.Context, query model.TransferLogQuery) ([]*model.TransferLog, int64, error)

GetTransferLogs 获取传输日志

func (*Service) GetUsers

func (s *Service) GetUsers(ctx context.Context, page, pageSize int) ([]*model.UserResp, int64, error)

GetUsers 获取用户列表

func (*Service) InvalidateRuntimeConfig

func (s *Service) InvalidateRuntimeConfig()

InvalidateRuntimeConfig 丢弃内存配置缓存(多副本广播接收侧;委派)。

func (*Service) ListAdminOperationLogs added in v0.16.0

func (s *Service) ListAdminOperationLogs(ctx context.Context, query model.AdminOperationLogQuery) ([]*model.AdminOperationLog, int64, error)

ListAdminOperationLogs 查询管理操作审计(gen/handler 消费面收口,handler 不直依 dao)。

func (*Service) ListReferencedObjectPaths added in v0.32.33

func (s *Service) ListReferencedObjectPaths(ctx context.Context) ([]string, error)

ListReferencedObjectPaths 列出被 DB 引用的存储对象路径(存储迁移用)。

与孤儿对账(janitor.ReconcileOrphans)的引用集口径**必须一致**:

· 主表 file_codes(软删也含:软删分享可恢复 ⇒ 对象要一起搬);
· 子表 file_code_files(多文件分享的非首文件只在这里);
· 路径归一(斜杠 + Clean)后去重(同一路径可能被多行引用)。

差异:孤儿对账要的是"哪些**不是**孤儿",这里要的是"哪些**要搬**"—— 引用集相同,用途不同。

func (*Service) ListUsersFiltered

func (s *Service) ListUsersFiltered(ctx context.Context, f UserListFilter) ([]*model.UserResp, int64, error)

ListUsersFiltered 带筛选的用户列表(keyword/status/role + 分页)。

func (*Service) LoadRuntimeStorage

func (s *Service) LoadRuntimeStorage(ctx context.Context) *conf.StorageConfig

LoadRuntimeStorage 读取持久化的运行时存储配置(storage.RuntimePersister 实现,委派)。

func (*Service) LogOperation added in v0.19.0

func (s *Service) LogOperation(ctx context.Context, action, target string, success bool)

LogOperation 管理操作审计公开入口(供 gen handler 等非本域包写审计, 与 logAdminOperation 同表同语义;P2a 设备直传操作页使用)。

func (*Service) OptimizeDatabase

func (s *Service) OptimizeDatabase(ctx context.Context) (string, string, error)

OptimizeDatabase 数据库优化(维护工具「优化数据库」)。 sqlite:VACUUM 回收空间 + ANALYZE 刷新统计(此前前端按钮调用的是 后端从未实现的 /admin/maintenance/optimize,恒 404——2026-10-06 补齐); mysql:ANALYZE 核心表;postgres:VACUUM ANALYZE;其他后端 no-op。 返回 (实际优化的驱动, 执行说明)。

func (*Service) PurgeFiles

func (s *Service) PurgeFiles(ctx context.Context, ids []uint) (int64, error)

PurgeFiles 彻底删除(回收站 → 物理删除):DB 行硬删 + COS/本地对象删除。 对象删除失败不阻断 DB 硬删(孤儿由桶生命周期/对账兜底);返回成功数。

func (*Service) ResetUserPassword

func (s *Service) ResetUserPassword(ctx context.Context, userID uint, passwordHash string) error

ResetUserPassword 管理员重置用户密码(写入已哈希口令)。

func (*Service) RestoreAdminSettings

func (s *Service) RestoreAdminSettings()

RestoreAdminSettings 启动时把持久化配置 overlay 回全局 conf(委派)。

func (*Service) RestoreFiles

func (s *Service) RestoreFiles(ctx context.Context, ids []uint) (int64, error)

RestoreFiles 从回收站恢复(软删 → 存活):deleted_at 置空,COS 对象未动无需处理。 仅恢复"当前处于软删态"的 id,忽略其余;返回实际恢复数。

func (*Service) SaveRuntimeStorage

func (s *Service) SaveRuntimeStorage(ctx context.Context, cfg *conf.StorageConfig) error

SaveRuntimeStorage 持久化运行时存储配置(storage.RuntimePersister 实现,委派)。

func (*Service) SetConfig

func (s *Service) SetConfig(config *SystemConfig)

SetConfig 设置配置(显式注入优先于 DB 持久化配置;委派)。

func (*Service) SetFederationNotifier

func (s *Service) SetFederationNotifier(f FederationNotifier)

SetFederationNotifier 注入联邦撤销钩子(bootstrap 调用;nil = 非联邦。 P1 后台热切换后为运行期写,与删除路径并发——须加锁)

func (*Service) SetFilesStatus

func (s *Service) SetFilesStatus(ctx context.Context, ids []uint, status string) (int64, error)

SetFilesStatus 管理员设置分享管控状态(单个/批量禁用、恢复共用)。 返回受影响行数;审计按动作分别落账(file.block / file.unblock / file.status)。

func (*Service) SetOnConfigPersisted

func (s *Service) SetOnConfigPersisted(fn func())

SetOnConfigPersisted 注入配置持久化广播回调(多副本模式;委派)。

func (*Service) SetReconfigureHooks

func (s *Service) SetReconfigureHooks(h *ReconfigureHooks)

SetReconfigureHooks 注册组件热重建钩子(bootstrap 调用;委派)。

func (*Service) SetStorage

func (s *Service) SetStorage(st storage.StorageInterface)

SetStorage 注入存储服务(用于过期清理删物理文件)

func (*Service) StorageInsight added in v0.16.0

func (s *Service) StorageInsight(ctx context.Context) (total, totalSize, alive, softDeleted int64, err error)

StorageInsight 存储洞察聚合(gen/handler/storage 洞察端点消费面收口)。

func (*Service) TransferTrendByDay added in v0.16.0

func (s *Service) TransferTrendByDay(ctx context.Context, from time.Time, operation string) ([]dao.DayCount, error)

TransferTrendByDay 传输次数按天趋势(gen/handler/storage 今日流量消费面收口; operation 空 = 全部类型)。

func (*Service) TrendSeries

func (s *Service) TrendSeries(ctx context.Context, days int) ([]TrendDay, error)

TrendSeries 连续 N 天的上传/下载趋势(缺失日补 0)。下载日志查询失败不阻断 (表可能尚无数据/旧库未建)——降级为全 0 序列。

func (*Service) UpdateConfig

func (s *Service) UpdateConfig(ctx context.Context, newConfig *SystemConfig) error

UpdateConfig 更新系统配置(委派 config 域;写穿 DB + 全局 conf overlay + 热重建钩子)。

func (*Service) UpdateConfigJSON added in v0.31.3

func (s *Service) UpdateConfigJSON(ctx context.Context, raw []byte) error

UpdateConfigJSON 按**字段级**合并提交的 JSON 到已落库配置后保存(委派 config 域)。

语义与整段替换不同:提交里出现的字段生效(显式 null 视为清空),未提及的 字段保留现状 —— 此前段内未提及字段会被整体清零(改一个 max_file_size 顺手 关掉匿名上传/分块上传/魔数校验,2026-10-23 真机实测)。

func (*Service) UpdateFileExpire

func (s *Service) UpdateFileExpire(ctx context.Context, id uint, expireAt *time.Time, expiredCount *int) error

UpdateFileExpire 编辑文件(延期 / 改剩余次数)。

func (*Service) UpdateUserSettings

func (s *Service) UpdateUserSettings(ctx context.Context, u UserSettings) error

UpdateUserSettings 在线更新"用户配置"段(委派 config 域)。

func (*Service) UpdateUserSettingsJSON added in v0.31.4

func (s *Service) UpdateUserSettingsJSON(ctx context.Context, raw []byte) error

UpdateUserSettingsJSON 按**字段级**合并提交的 JSON 到当前用户配置段后保存(委派 config 域)。 语义:部分提交不得把未提及的字段清零(见 config 域同名方法)。

func (*Service) UpdateUserStatus

func (s *Service) UpdateUserStatus(ctx context.Context, userID uint, status string) error

UpdateUserStatus 更新用户状态

type StorageProvider

type StorageProvider interface {
	storage.StorageInterface
	EffectiveType() storage.StorageType
	DataPath() string
	// ListRemoteObjects 远端对象列举(presign 孤儿清理;本地后端返回错误)。
	ListRemoteObjects(ctx context.Context, prefix string) ([]storage.RemoteObjectInfo, error)
}

StorageProvider janitor 所需存储能力:通用操作 + 本地后端判定/根目录。 EffectiveType/DataPath 是 *storage.StorageService 的扩展能力(不在 StorageInterface 内),按消费侧窄接口收窄依赖,bootstrap 传具体实现即可。

type StorageSettings added in v0.18.0

type StorageSettings = appconfig.StorageSettings

类型别名:管理面 handler 构造/消费的类型不变(JSON 形状同源于 config 域)。

type StorageStatus

type StorageStatus struct {
	StorageType  string  `json:"storage_type"`
	TotalSpace   int64   `json:"total_space"`
	UsedSpace    int64   `json:"used_space"`
	FreeSpace    int64   `json:"free_space"`
	FileCount    int64   `json:"file_count"`
	UsagePercent float64 `json:"usage_percent"`
}

StorageStatus 存储状态

type SystemConfig

type SystemConfig = appconfig.SystemConfig

类型别名:管理面 handler 构造/消费的类型不变(JSON 形状同源于 config 域)。

type SystemInfo

type SystemInfo struct {
	Version     string `json:"version"`
	OS          string `json:"os"`
	Arch        string `json:"arch"`
	Uptime      string `json:"uptime"`
	Goroutines  int64  `json:"goroutines"`
	MemoryAlloc int64  `json:"memory_alloc"`
	MemoryTotal int64  `json:"memory_total"`
	MemorySys   int64  `json:"memory_sys"`
}

SystemInfo 系统信息

type TransferSettings added in v0.18.0

type TransferSettings = appconfig.TransferSettings

类型别名:管理面 handler 构造/消费的类型不变(JSON 形状同源于 config 域)。

type TrendDay

type TrendDay struct {
	Date      string `json:"date"`
	Uploads   int64  `json:"uploads"`
	Downloads int64  `json:"downloads"`
}

TrendDay 趋势序列单日点。

type UserListFilter

type UserListFilter struct {
	Keyword  string
	Status   string
	Role     string
	Page     int
	PageSize int
}

UserListFilter 带筛选的用户列表条件(管理端用户管理)。

type UserSettings

type UserSettings = appconfig.UserSettings

类型别名:管理面 handler 构造/消费的类型不变(JSON 形状同源于 config 域)。

func EffectiveUserSettings

func EffectiveUserSettings(ctx context.Context) UserSettings

EffectiveUserSettings 生效的用户设置(委派 config 域包级入口: 持久化值优先,无记录回退 yaml)。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL