Repository navigation
Scope:
main(0.14.1) →dev/0.15, comprising 47 commits.
Author distribution: keven1024/keven (44), TrapStoner (3).
Added
- Introduced a unified configuration model (
pkg/models/config.go). Configuration settings, previously scattered across various environment variables, have been consolidated into a strongly-typedConfigstruct. This struct is organized into seven groups—share,upload,redis,features,site,about, andsmtp—with all fields annotated usingmapstructuretags. - Configuration loading and validation (
pkg/utils/config.go). Configuration is loaded viaviper, supporting default value merging (usingmergo) and field validation (usinggo-playground/validator). Two custom validation rules have been registered:storage_size(for human-readable storage capacities, e.g.,100GiB) andrequired_en_key_content(ensuring that multi-language content includes an English key). NewGetConfig()andSetConfig()functions have been added; all modules (backend, worker, andpkg) have been migrated fromGetEnv/GetEnvMapto useGetConfig(). - Hot-reloading of configuration.
viperis configured withWatchConfig()andOnConfigChange, allowing for automatic reloading and re-validation whenever the configuration file is modified. Additionally,AutomaticEnvandExperimentalBindStructhave been enabled. - Graceful shutdown. The entry points for both the backend and worker have been refactored into a
run() intpattern. This implementation utilizessignal.NotifyContext(forSIGINT/SIGTERMsignals) in conjunction withecho.StartConfig{GracefulTimeout: 30s}andasynq.Config{ShutdownTimeout: 30s}. Initialization failures now return an exit code of 1 along with an error log, replacing previouspanicorlog.Fatalfcalls. Furthermore, Redis,asynqclients, and the scheduler are now properly shut down usingdefer. - Route and Middleware Registry. Addedinternal/route.go(Route+Routes) andinternal/middleware.go(Middlewares) to the backend; addedinternal/route.goandinternal/middleware.goto the worker. Themainfunction has been updated to iterate through these registries, and route/middleware definitions have been moved from the package root into theinternal/directory. - New Scheduler Registry (
worker/internal/scheduler.go). Scheduled tasks are now declared via a list ofSchedule{Cron, Handle}objects. The file cleanup taskfile:janitor(scheduled for0 3 * * *) has been migrated to this registry. Note that thetext:translateroute is currently commented out in the route table and can be enabled on an as-needed basis. - Enhanced Tiptap Editor Capabilities. Added a drag handle (
DragHandle.vue)—supporting block-level menus (convert, insert below, delete) and language switching for code blocks—as well as Markdown paste confirmation (PasteHandler.ts+isStringMarkdown), mathematical formula support (@tiptap/extension-mathematics+ KaTeX), tables (TableKit), lists (ListKit), images (with proportional scaling enabled), cross-block selection (NodeRange, triggered via Cmd on macOS or Ctrl on Windows), and GFM (GitHub Flavored Markdown) parsing. - Text Statistics. The
countWordsfunction now returns an object{ length, characters }instead of a single number, with added support for counting emojis (including surrogate pairs). The editor status bar now displays both character and word counts. - New Multilingual Keys. Added
page.editor.markdownandpage.editor.tiptapentries across seven languages (en, zh-CN, zh-TW, ja, ko, fr, de), covering Markdown paste confirmation prompts, block types, and programming language names. - Added WebP Icons. -
front/public/logo.webp(replaces the 2.03MBlogo.png; ~156KB, a 92% reduction). The default icon path is now/logo.webp. The Navbar icon now pulls from thesite_iconconfiguration setting, with a fallback tologo.webp.useSeonow generates the appropriate MIME type forog:imagebased on the file extension. (by TrapStoner, 42a5222 / 439a6de) - Real Client IP. The backend is now configured with
e.IPExtractor = echo.ExtractIPFromXFFHeader(echo.TrustLoopback(true)). This prevents the system from incorrectly identifying all clients as127.0.0.1when running behind Caddy (previously, this caused rate-limiting to treat all clients as a single entity). (by TrapStoner, f0ff278) - New Unit Tests. Added
pkg/utils/config_test.go(covering default value merging, overrides, and validation) andpkg/utils/env_test.go. - Added an optional
btnClassproperty toConfirmActionDrawer; the delete button on the share management page now uses the "destructive" style.
Improved
- Removed environment variable-based configuration paths. Deleted
GetEnvMap(),InitTestViper(), andEnvOption.ConfigData. Tests now useSetConfig(models.Config{...})instead; `pkg/utils/test/env_test.gohttps://github.com/TrapStoner)** — 3 commits fix(assets): Converted icons to WebP format (-92% file size) and updated the Navbar to loadsite_iconfrom the configuration (42a5222)chore: Synchronized the default icon path inconfig.example.yaml(439a6de)fix: Reported the actual client IP instead of Caddy’s loopback address, resolving an issue where rate-limiting incorrectly treated all clients as a single entity (f0ff278)
Full Changelog: 0.14.1...0.15.0