mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
update
This commit is contained in:
@@ -28,6 +28,7 @@ func GetTorrentDB(hash metainfo.Hash) *Torrent {
|
|||||||
torr.TorrentSpec = db.TorrentSpec
|
torr.TorrentSpec = db.TorrentSpec
|
||||||
torr.Title = db.Title
|
torr.Title = db.Title
|
||||||
torr.Poster = db.Poster
|
torr.Poster = db.Poster
|
||||||
|
torr.Timestamp = db.Timestamp
|
||||||
torr.Stat = state.TorrentInDB
|
torr.Stat = state.TorrentInDB
|
||||||
return torr
|
return torr
|
||||||
}
|
}
|
||||||
@@ -47,6 +48,7 @@ func ListTorrentsDB() map[metainfo.Hash]*Torrent {
|
|||||||
torr.TorrentSpec = db.TorrentSpec
|
torr.TorrentSpec = db.TorrentSpec
|
||||||
torr.Title = db.Title
|
torr.Title = db.Title
|
||||||
torr.Poster = db.Poster
|
torr.Poster = db.Poster
|
||||||
|
torr.Timestamp = db.Timestamp
|
||||||
torr.Stat = state.TorrentInDB
|
torr.Stat = state.TorrentInDB
|
||||||
ret[torr.TorrentSpec.InfoHash] = torr
|
ret[torr.TorrentSpec.InfoHash] = torr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,6 @@ func SetupRoute(route *gin.Engine) {
|
|||||||
temp = template.InitTemplate(route)
|
temp = template.InitTemplate(route)
|
||||||
|
|
||||||
route.GET("/", mainPage)
|
route.GET("/", mainPage)
|
||||||
route.GET("/api.js", apijsPage)
|
// route.GET("/api.js", apijsPage)
|
||||||
route.GET("/main.js", mainjsPage)
|
// route.GET("/main.js", mainjsPage)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,22 +12,8 @@ const mainPage = `
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
` + header + `
|
` + header + `
|
||||||
<body ng-app="app">
|
<body>
|
||||||
<script src="/api.js"></script>
|
<p> TorrServer ` + version.Version + `</p>
|
||||||
<script src="/main.js"></script>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light {{active}}" ng-click="$event.preventDefault()">
|
|
||||||
<div class="navbar-nav">
|
|
||||||
<a href="#" class="nav-item nav-link torrents" ng-click="active='torrents'">Torrents</a>
|
|
||||||
<a href="#" class="nav-item nav-link settings" ng-click="active='settings'">Settings</a>
|
|
||||||
<a href="#" class="nav-item nav-link cache" ng-click="active='cache'">Cache</a>
|
|
||||||
<a href="#" class="nav-item nav-link about" ng-click="active='about'">About</a>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<p ng-hide="active">Please click a menu item</p>
|
|
||||||
<p ng-show="active">You chose <b>{{active}}</b></p>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -8,24 +8,6 @@ import (
|
|||||||
|
|
||||||
var ctx *gin.Engine
|
var ctx *gin.Engine
|
||||||
|
|
||||||
//
|
|
||||||
// func InitTemplate(route *gin.Engine) {
|
|
||||||
// ctx = route
|
|
||||||
//
|
|
||||||
// tmpl := getTemplate("favicon", faviconB64)
|
|
||||||
// tmpl = getTemplate("header", header)
|
|
||||||
//
|
|
||||||
// route.SetHTMLTemplate(tmpl)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// func getTemplate(name, body string) *template.Template {
|
|
||||||
// tmpl, err := template.New(name).ParseFiles(body)
|
|
||||||
// if err != nil {
|
|
||||||
// log.TLogln("error parse template", err)
|
|
||||||
// }
|
|
||||||
// return tmpl
|
|
||||||
// }
|
|
||||||
|
|
||||||
type Template struct {
|
type Template struct {
|
||||||
templates *template.Template
|
templates *template.Template
|
||||||
}
|
}
|
||||||
@@ -34,8 +16,8 @@ func InitTemplate(c *gin.Engine) *Template {
|
|||||||
temp := new(Template)
|
temp := new(Template)
|
||||||
|
|
||||||
temp.parsePage("mainPage", mainPage)
|
temp.parsePage("mainPage", mainPage)
|
||||||
temp.parsePage("apijsPage", apiJS)
|
// temp.parsePage("apijsPage", apiJS)
|
||||||
temp.parsePage("mainjsPage", mainJS)
|
// temp.parsePage("mainjsPage", mainJS)
|
||||||
|
|
||||||
c.SetHTMLTemplate(temp.templates)
|
c.SetHTMLTemplate(temp.templates)
|
||||||
return temp
|
return temp
|
||||||
|
|||||||
Reference in New Issue
Block a user