Skip to main content

Module settings

Module settings 

Source
Expand description

回收站与站点配置接口。 回收站、自动备份、素材上传与站点配置接口。

按子域拆分为目录模块:trash(回收站)、backup(自动备份)、security (安全)、image_cache(图片磁盘缓存)、asset_purge(孤儿素材清理)、 rate_limit(限流)、upload(素材上传)、site(站点公开配置)、 system(系统启动信息)、webp(WebP 编码)、image_limit(图片尺寸限制)、 runner(代码运行器)、ssr_cache(SSR 页面缓存)。全部公开项经本模块 pub use 聚合, crate::api::settings::xxx 路径保持不变,外部调用零改动。

  • 回收站配置:读取与更新自动清理设置,需要 admin 权限。
  • 自动备份配置:读取与更新定时备份设置(含上次结果/下次执行时间),需要 admin。 load_backup_settings / save_last_backup_run 同时供备份核心与调度任务复用。 同名 BACKUP_* 环境变量仅在对应 settings 键缺失时播种初始值(首次部署), 之后以面板写入的 DB 值为准。
  • 素材上传配置:读取与更新上传弹窗并发数,需要 admin。UPLOAD_CONCURRENCY 环境变量播种语义与 BACKUP_* 一致(仅键缺失时生效)。
  • 站点公开配置:页脚 GitHub 链接等,get_site_settings 公开读取(前台页脚 SSR), update_site_settings 仅 admin。配置持久化到 settings 键值表。 Leptos server function,注册在 /api 路径下。

Modules§

asset_purge 🔒
backup 🔒
image_cache 🔒
image_limit 🔒
rate_limit 🔒
runner 🔒
security 🔒
site 🔒
ssr_cache 🔒
system 🔒
trash 🔒
upload 🔒
webp 🔒

Structs§

GetAssetPurgeSettings
Serialized arguments for the get_asset_purge_settings server function.
GetBackupSettings
Serialized arguments for the get_backup_settings server function.
GetImageCacheSettings
Serialized arguments for the get_image_cache_settings server function.
GetImageLimitSettings
Serialized arguments for the get_image_limit_settings server function.
GetRateLimitSettings
Serialized arguments for the get_rate_limit_settings server function.
GetRunnerSettings
Serialized arguments for the get_runner_settings server function.
GetSecuritySettings
Serialized arguments for the get_security_settings server function.
GetSiteCard
Serialized arguments for the get_site_card server function.
GetSiteSettings
Serialized arguments for the get_site_settings server function.
GetSsrCacheSettings
Serialized arguments for the get_ssr_cache_settings server function.
GetSystemInfo
Serialized arguments for the get_system_info server function.
GetTrashSettings
Serialized arguments for the get_trash_settings server function.
GetUploadSettings
Serialized arguments for the get_upload_settings server function.
GetWebpSettings
Serialized arguments for the get_webp_settings server function.
SiteCard
友链页「交换友链」展示的本站信息。
UpdateAssetPurgeSettings
Serialized arguments for the update_asset_purge_settings server function.
UpdateBackupSettings
Serialized arguments for the update_backup_settings server function.
UpdateImageCacheSettings
Serialized arguments for the update_image_cache_settings server function.
UpdateImageLimitSettings
Serialized arguments for the update_image_limit_settings server function.
UpdateRateLimitSettings
Serialized arguments for the update_rate_limit_settings server function.
UpdateRunnerSettings
Serialized arguments for the update_runner_settings server function.
UpdateSecuritySettings
Serialized arguments for the update_security_settings server function.
UpdateSiteSettings
Serialized arguments for the update_site_settings server function.
UpdateSsrCacheSettings
Serialized arguments for the update_ssr_cache_settings server function.
UpdateTrashSettings
Serialized arguments for the update_trash_settings server function.
UpdateUploadSettings
Serialized arguments for the update_upload_settings server function.
UpdateWebpSettings
Serialized arguments for the update_webp_settings server function.

Functions§

bootstrap_startup_settings 🔒
Seed all first-boot settings and bake Tier-B settings into process config.
get_asset_purge_settings
读取孤儿素材清理配置(面板用)。
get_backup_settings
读取自动备份配置(面板用)。
get_image_cache_settings
读取图片磁盘缓存配置(面板用)。
get_image_limit_settings
读取图片尺寸限制配置(面板用)。
get_rate_limit_settings
读取限流配置(面板用)。
get_runner_settings
读取代码运行器配置(面板用)。
get_security_settings
读取安全配置(面板用)。
get_site_card
读取友链交换信息:站名、站点地址与简介。公开接口。
get_site_settings
读取站点公开配置。
get_ssr_cache_settings
读取 SSR 页面缓存配置(面板用)。
get_system_info
读取系统启动配置的只读快照(面板展示用)。
get_trash_settings
读取回收站配置。
get_upload_settings
读取素材上传配置(上传弹窗并发数)。
get_webp_settings
读取 WebP 配置(面板用)。
insert_env_seeds 🔒
Batch-insert first-boot environment seeds.
load_setting_values 🔒
Load a settings group with one indexed query.
update_asset_purge_settings
更新孤儿素材清理配置。
update_backup_settings
更新自动备份配置。
update_image_cache_settings
更新图片磁盘缓存配置。
update_image_limit_settings
更新图片尺寸限制配置。
update_rate_limit_settings
更新限流配置。
update_runner_settings
更新代码运行器配置。
update_security_settings
更新安全配置。
update_site_settings
更新站点公开配置。
update_ssr_cache_settings
更新 SSR 页面缓存配置。
update_trash_settings
更新回收站配置。
update_upload_settings
更新素材上传配置。
update_webp_settings
更新 WebP 配置。
upsert_setting 🔒
写入(或覆盖)单个 settings 键,同时刷新 updated_at。
upsert_settings 🔒
一条语句写入(或覆盖)多个 settings 键,同时刷新 updated_at。