precompress embedded frontend. import mholt/archiver.

This commit is contained in:
Weidi Deng
2022-04-20 19:56:00 +08:00
parent d34cb3e5d3
commit 7a3d44451b
7 changed files with 60 additions and 11 deletions

View File

@@ -1,7 +1,6 @@
package bootstrap
import (
"embed"
model "github.com/cloudreve/Cloudreve/v3/models"
"github.com/cloudreve/Cloudreve/v3/models/scripts"
"github.com/cloudreve/Cloudreve/v3/pkg/aria2"
@@ -14,10 +13,11 @@ import (
"github.com/cloudreve/Cloudreve/v3/pkg/mq"
"github.com/cloudreve/Cloudreve/v3/pkg/task"
"github.com/gin-gonic/gin"
"io/fs"
)
// Init 初始化启动
func Init(path string, statics embed.FS) {
func Init(path string, statics fs.FS) {
InitApplication()
conf.Init(path)
// Debug 关闭时,切换为生产模式

View File

@@ -2,7 +2,6 @@ package bootstrap
import (
"bufio"
"embed"
"encoding/json"
"io"
"io/fs"
@@ -45,7 +44,7 @@ func (b *GinFS) Exists(prefix string, filepath string) bool {
}
// InitStatic 初始化静态资源文件
func InitStatic(statics embed.FS) {
func InitStatic(statics fs.FS) {
if util.Exists(util.RelativePath(StaticFolder)) {
util.Log().Info("检测到 statics 目录存在,将使用此目录下的静态资源文件")
StaticFS = static.LocalFile(util.RelativePath("statics"), false)
@@ -96,7 +95,7 @@ func InitStatic(statics embed.FS) {
}
// Eject 抽离内置静态资源
func Eject(statics embed.FS) {
func Eject(statics fs.FS) {
// 初始化静态资源
embedFS, err := fs.Sub(statics, "assets/build")
if err != nil {