forked from cloudreve/Cloudreve
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
80 additions
and
7 deletions.
There are no files selected for viewing
Submodule assets
updated
from 589cb9 to 266083
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ func Init(path string) { | |
aria2.Init(false) | ||
email.Init() | ||
crontab.Init() | ||
InitStatic() | ||
} | ||
auth.Init() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package bootstrap | ||
|
||
import ( | ||
"github.com/HFO4/cloudreve/pkg/util" | ||
_ "github.com/HFO4/cloudreve/statik" | ||
"github.com/rakyll/statik/fs" | ||
"net/http" | ||
) | ||
|
||
type GinFS struct { | ||
FS http.FileSystem | ||
} | ||
|
||
// StaticFS 内置静态文件资源 | ||
var StaticFS = &GinFS{} | ||
|
||
// Open 打开文件 | ||
func (b *GinFS) Open(name string) (http.File, error) { | ||
return b.FS.Open(name) | ||
} | ||
|
||
// Exists 文件是否存在 | ||
func (b *GinFS) Exists(prefix string, filepath string) bool { | ||
|
||
if _, err := b.FS.Open(filepath); err != nil { | ||
return false | ||
} | ||
return true | ||
|
||
} | ||
|
||
// InitStatic 初始化静态资源文件 | ||
func InitStatic() { | ||
var err error | ||
StaticFS.FS, err = fs.New() | ||
if err != nil { | ||
util.Log().Panic("无法初始化静态资源, %s", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
statik -src=assets/build/ -include=*.html,*.js,*.json,*.css,*.png,*.svg,*.ico -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters