Skip to content

Commit f669fbf

Browse files
committed
feat: 静态资源本地化
1 parent 8657a63 commit f669fbf

File tree

15 files changed

+86635
-8
lines changed

15 files changed

+86635
-8
lines changed

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ require (
1515
github.com/go-playground/validator/v10 v10.26.0 // indirect
1616
github.com/goccy/go-json v0.10.5 // indirect
1717
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
18+
github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15 // indirect
1819
github.com/json-iterator/go v1.1.12 // indirect
1920
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
2021
github.com/leodido/go-urn v1.4.0 // indirect
2122
github.com/mattn/go-isatty v0.0.20 // indirect
2223
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2324
github.com/modern-go/reflect2 v1.0.2 // indirect
2425
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
26+
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
27+
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92 // indirect
2528
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
2629
github.com/ugorji/go/codec v1.2.14 // indirect
2730
golang.org/x/arch v0.17.0 // indirect

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PU
2626
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
2727
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
2828
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
29+
github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15 h1:cW/amwGEJK5MSKntPXRjX4dxs/nGxGT8gXKIsKFmHGc=
30+
github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15/go.mod h1:Fdm/oWRW+CH8PRbLntksCNtmcCBximKPkVQYvmMl80k=
2931
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
3032
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
3133
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
@@ -44,6 +46,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
4446
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
4547
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
4648
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
49+
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c h1:aqg5Vm5dwtvL+YgDpBcK1ITf3o96N/K7/wsRXQnUTEs=
50+
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c/go.mod h1:owqhoLW1qZoYLZzLnBw+QkPP9WZnjlSWihhxAJC1+/M=
51+
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92 h1:OfRzdxCzDhp+rsKWXuOO2I/quKMJ/+TQwVbIP/gltZg=
52+
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92/go.mod h1:7/OT02F6S6I7v6WXb+IjhMuZEYfH/RJ5RwEWnEo5BMg=
4753
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
4854
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
4955
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=

router/route.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/gin-gonic/gin"
1111
"github.com/lovebai/toalist/conf"
1212
"github.com/lovebai/toalist/controller"
13+
"github.com/lovebai/toalist/src"
1314
)
1415

1516
// 检查端口是否可用
@@ -71,8 +72,10 @@ func InitRouter(views embed.FS) {
7172

7273
if conf.GlobalConfig.Base.Mode == "debug" {
7374
router.LoadHTMLGlob("views/**")
75+
router.Static("/static", "./static")
7476
} else {
7577
router.SetHTMLTemplate(tmpl)
78+
router.StaticFS("/static", src.Assets)
7679
}
7780

7881
if conf.GlobalConfig.Upload.Method == "local" {

static/css/bootstrap-icons.css

Lines changed: 1556 additions & 0 deletions
Large diffs are not rendered by default.

static/css/bootstrap.min.css

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
120 KB
Binary file not shown.
89.9 KB
Binary file not shown.

static/css/index.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/bootstrap.bundle.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)