mirror of
https://git.fightbot.fun/hxuanyu/BingPaper.git
synced 2026-02-15 07:29:33 +08:00
支持嵌入式静态资源服务,移除 web 包,调整路由逻辑
This commit is contained in:
12
main.go
12
main.go
@@ -1,7 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"mime"
|
||||
|
||||
"BingPaper/internal/bootstrap"
|
||||
"BingPaper/internal/config"
|
||||
@@ -10,6 +12,9 @@ import (
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
//go:embed all:web
|
||||
var webFS embed.FS
|
||||
|
||||
// @title BingPaper API
|
||||
// @version 1.0
|
||||
// @description 必应每日一图抓取、存储、管理与公共 API 服务。
|
||||
@@ -21,8 +26,13 @@ import (
|
||||
// @name Authorization
|
||||
|
||||
func main() {
|
||||
// 注册常用 MIME 类型,确保嵌入式资源能被正确识别
|
||||
mime.AddExtensionType(".js", "application/javascript")
|
||||
mime.AddExtensionType(".css", "text/css")
|
||||
mime.AddExtensionType(".svg", "image/svg+xml")
|
||||
|
||||
// 1. 初始化
|
||||
r := bootstrap.Init()
|
||||
r := bootstrap.Init(webFS)
|
||||
|
||||
// 2. 输出欢迎信息
|
||||
bootstrap.LogWelcomeInfo()
|
||||
|
||||
Reference in New Issue
Block a user