- 移除 ByteMD CDN 资源和 goldmark 依赖,替换为 Tiptap ESM 模块 - 编辑器从源码编辑模式改为 WYSIWYG 所见即所得 - 移除 /api/posts/preview 预览接口(Tiptap 直接输出 HTML 无需后端渲染) - 保留 UploadImage 图片上传接口和 bluemonday HTML 消毒 - 工具栏支持加粗、斜体、删除线、代码、标题、列表、引用、代码块、分割线、撤销/重做 - 支持图片粘贴/拖拽上传,Ctrl+S 快捷提交,F11 全屏,字数统计 - 优化 common.js:自动 401 拦截 Token 刷新,修复刷新死循环 - 草稿 localStorage 键名更新为 draft_post_body_html
37 lines
1.4 KiB
Go
37 lines
1.4 KiB
Go
package controller
|
||
|
||
import (
|
||
"metazone.cc/metalab/internal/middleware"
|
||
"metazone.cc/metalab/internal/model"
|
||
)
|
||
|
||
// authUseCase AuthController 对 AuthService 的最小依赖(ISP:4 个方法)
|
||
type authUseCase interface {
|
||
Register(req model.RegisterRequest, regIP string) (string, string, *model.User, error)
|
||
Login(req model.LoginRequest, loginIP string) (string, string, *model.User, error)
|
||
ConfirmRestore(req model.LoginRequest, loginIP string) (string, string, *model.User, error)
|
||
CheckEmail(email string) (bool, error)
|
||
}
|
||
|
||
// tokenRefresher AuthController 对 TokenService 的最小依赖(ISP:1 个方法)
|
||
type tokenRefresher interface {
|
||
RefreshAccessToken(refreshTokenStr string) (string, *model.User, error)
|
||
}
|
||
|
||
// rateLimiter AuthController 对 RateLimiter 的最小依赖(ISP:3 个方法)
|
||
type rateLimiter interface {
|
||
AllowAccount(email string) (middleware.RateLimitResult, func())
|
||
AllowIP(ip string) (middleware.RateLimitResult, func())
|
||
Clear(email, ip string)
|
||
}
|
||
|
||
// postUseCase PostController 对 PostService 的最小依赖(ISP:6 个方法)
|
||
type postUseCase interface {
|
||
Create(userID uint, title, body string) (*model.Post, error)
|
||
GetByID(id uint) (*model.Post, error)
|
||
List(keyword string, page, pageSize int) ([]model.Post, int64, error)
|
||
Update(postID uint, title, body string) error
|
||
Delete(postID uint) error
|
||
SubmitForAudit(postID uint) error
|
||
}
|