mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
change web pages
This commit is contained in:
42
build_web.go
Normal file
42
build_web.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fs, _ := ioutil.ReadDir("web")
|
||||||
|
for _, f := range fs {
|
||||||
|
if strings.HasSuffix(f.Name(), ".html") {
|
||||||
|
name := filenameWithoutExtension(f.Name())
|
||||||
|
out, err := os.Create("src/server/web/pages/template/" + name + "_html.go")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error create file", err)
|
||||||
|
os.Exit(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
out.Write([]byte("package template \n\nvar " + strings.Title(name) + "Html = []byte{"))
|
||||||
|
buf, err := ioutil.ReadFile("web/" + f.Name())
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error read file", err)
|
||||||
|
os.Exit(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, b := range buf {
|
||||||
|
out.Write([]byte(strconv.Itoa(int(b)) + ", "))
|
||||||
|
}
|
||||||
|
out.Write([]byte("}"))
|
||||||
|
out.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func filenameWithoutExtension(fn string) string {
|
||||||
|
return strings.TrimSuffix(filepath.Base(fn), path.Ext(fn))
|
||||||
|
}
|
||||||
@@ -6,5 +6,5 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func mainPage(c *gin.Context) {
|
func mainPage(c *gin.Context) {
|
||||||
c.Data(200, "text/html; charset=utf-8", []byte(template.MainPage))
|
c.Data(200, "text/html; charset=utf-8", template.IndexHtml)
|
||||||
}
|
}
|
||||||
|
|||||||
3
src/server/web/pages/template/index_html.go
Normal file
3
src/server/web/pages/template/index_html.go
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
web/index.html
Normal file
2
web/index.html
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user