Adding admin interface
Also changing year in copyright and fixing search
This commit is contained in:
parent
10360ba95c
commit
62c2481bd3
286
gserver/admin.go
Normal file
286
gserver/admin.go
Normal file
|
@ -0,0 +1,286 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
//"html/template"
|
||||
"strings"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
. "git.1750studios.com/gronkhDE/gogronkh/gserver/utlis"
|
||||
|
||||
"git.1750studios.com/gronkhDE/gogronkh/database"
|
||||
"git.1750studios.com/gronkhDE/gogronkh/image"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GetAdminIndex(c *gin.Context) {
|
||||
var LPs int
|
||||
var LTs int
|
||||
var EPs int
|
||||
var ATs int
|
||||
database.Db.Model(database.LetsPlay{}).Count(&LPs)
|
||||
database.Db.Model(database.LetsTest{}).Count(<s)
|
||||
database.Db.Model(database.Episode{}).Count(&EPs)
|
||||
database.Db.Model(database.Author{}).Count(&ATs)
|
||||
|
||||
c.HTML(200, "admin_index.html", gin.H{
|
||||
"title": "Admin Index",
|
||||
"LPs": LPs,
|
||||
"LTs": LTs,
|
||||
"EPs": EPs,
|
||||
"ATs": ATs,
|
||||
"page": "admin_index",
|
||||
})
|
||||
}
|
||||
|
||||
func GetAdminLetsPlay(c *gin.Context) {
|
||||
if id, ok := CleanParam(c.Param("id")); ok {
|
||||
//LP in URL
|
||||
var LP database.LetsPlay
|
||||
if database.Db.Where(id).First(&LP).Error == nil {
|
||||
//LP found
|
||||
c.HTML(200, "admin_lp.html", gin.H{
|
||||
"title": "Admin Let's Plays",
|
||||
"LP": LP,
|
||||
"page": "admin_lp",
|
||||
})
|
||||
} else {
|
||||
//LP not found
|
||||
c.AbortWithStatus(404)
|
||||
}
|
||||
} else {
|
||||
var LPs []database.LetsPlay
|
||||
database.Db.Order("id asc").Find(&LPs)
|
||||
c.HTML(200, "admin_lps.html", gin.H{
|
||||
"title": "Admin Let's Plays",
|
||||
"LPs": LPs,
|
||||
"page": "admin_lps",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func PostAdminLetsPlay(c *gin.Context) {
|
||||
if id, ok := CleanParam(c.Param("id")); ok {
|
||||
var LP database.LetsPlay
|
||||
database.Db.Where(id).First(&LP)
|
||||
if id, err := strconv.ParseUint(c.PostForm("id"), 10, 0); err == nil {
|
||||
LP.ID = uint(id)
|
||||
}
|
||||
if id, err := strconv.ParseUint(c.PostForm("authorid"), 10, 0); err == nil {
|
||||
LP.AuthorID = uint(id)
|
||||
}
|
||||
LP.Slug.String = c.PostForm("slug")
|
||||
LP.Name.String = c.PostForm("name")
|
||||
if c.PostForm("posters") == "" && !strings.HasPrefix(c.PostForm("posterb"), "/") {
|
||||
LP.PosterS.String, LP.PosterB.String, _ = image.ResizeCover(c.PostForm("posterb"))
|
||||
} else {
|
||||
LP.PosterS.String = c.PostForm("posters")
|
||||
LP.PosterB.String = c.PostForm("posterb")
|
||||
}
|
||||
if t, err := time.Parse("2006-01-02 15:04:05 -0700 MST", c.PostForm("aired")); err == nil {
|
||||
LP.Aired = t
|
||||
}
|
||||
database.Db.Save(&LP);
|
||||
c.Redirect(301, "/admin/lets-play#" + strconv.FormatUint(uint64(LP.ID), 10))
|
||||
} else {
|
||||
c.Redirect(301, "/admin/lets-play")
|
||||
}
|
||||
}
|
||||
|
||||
func GetAdminLetsTest(c *gin.Context) {
|
||||
if id, ok := CleanParam(c.Param("id")); ok {
|
||||
//LT in URL
|
||||
var LT database.LetsTest
|
||||
if database.Db.Where(id).First(<).Error == nil {
|
||||
//LT found
|
||||
c.HTML(200, "admin_lt.html", gin.H{
|
||||
"title": "Admin Let's Tests",
|
||||
"LT": LT,
|
||||
"page": "admin_lt",
|
||||
})
|
||||
} else {
|
||||
//LT not found
|
||||
c.AbortWithStatus(404)
|
||||
}
|
||||
} else {
|
||||
var LTs []database.LetsTest
|
||||
database.Db.Order("id asc").Find(<s)
|
||||
c.HTML(200, "admin_lts.html", gin.H{
|
||||
"title": "Admin Let's Tests",
|
||||
"LTs": LTs,
|
||||
"page": "admin_lts",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func PostAdminLetsTest(c *gin.Context) {
|
||||
if id, ok := CleanParam(c.Param("id")); ok {
|
||||
var LT database.LetsTest
|
||||
database.Db.Where(id).First(<)
|
||||
if id, err := strconv.ParseUint(c.PostForm("id"), 10, 0); err == nil {
|
||||
LT.ID = uint(id)
|
||||
}
|
||||
if id, err := strconv.ParseUint(c.PostForm("authorid"), 10, 0); err == nil {
|
||||
LT.AuthorID = uint(id)
|
||||
}
|
||||
LT.Slug.String = c.PostForm("slug")
|
||||
LT.Name.String = c.PostForm("name")
|
||||
if c.PostForm("posters") == "" && !strings.HasPrefix(c.PostForm("posterb"), "/") {
|
||||
LT.PosterS.String, LT.PosterB.String, _ = image.ResizeCover(c.PostForm("posterb"))
|
||||
} else {
|
||||
LT.PosterS.String = c.PostForm("posters")
|
||||
LT.PosterB.String = c.PostForm("posterb")
|
||||
}
|
||||
if c.PostForm("thumbs") == "" && !strings.HasPrefix(c.PostForm("thumbb"), "/") {
|
||||
LT.ThumbS.String, LT.ThumbB.String, _ = image.ResizeThumb(c.PostForm("thumbb"))
|
||||
} else {
|
||||
LT.ThumbS.String = c.PostForm("thumbs")
|
||||
LT.ThumbB.String = c.PostForm("thumbb")
|
||||
}
|
||||
LT.Youtube.String = c.PostForm("youtube")
|
||||
LT.Descr.String = c.PostForm("descr")
|
||||
if t, err := time.Parse("2006-01-02 15:04:05 -0700 MST", c.PostForm("aired")); err == nil {
|
||||
LT.Aired = t
|
||||
}
|
||||
if ra, err := strconv.ParseFloat(c.PostForm("authorid"), 64); err == nil {
|
||||
LT.Rating.Float64 = ra
|
||||
}
|
||||
if vo, err := strconv.ParseInt(c.PostForm("votes"), 10, 64); err == nil {
|
||||
LT.Votes.Int64 = vo
|
||||
}
|
||||
if du, err := strconv.ParseInt(c.PostForm("duration"), 10, 64); err == nil {
|
||||
LT.Duration.Int64 = du
|
||||
}
|
||||
database.Db.Save(<);
|
||||
c.Redirect(301, "/admin/lets-test#" + strconv.FormatUint(uint64(LT.ID), 10))
|
||||
} else {
|
||||
c.Redirect(301, "/admin/lets-test")
|
||||
}
|
||||
}
|
||||
|
||||
func GetAdminEpisode(c *gin.Context) {
|
||||
if id, ok := CleanParam(c.Param("id")); ok {
|
||||
//EP in URL
|
||||
var EP database.Episode
|
||||
if database.Db.Where(id).First(&EP).Error == nil {
|
||||
//EP found
|
||||
c.HTML(200, "admin_ep.html", gin.H{
|
||||
"title": "Admin Episoden",
|
||||
"EP": EP,
|
||||
"page": "admin_ep",
|
||||
})
|
||||
} else {
|
||||
//EP not found
|
||||
c.AbortWithStatus(404)
|
||||
}
|
||||
} else {
|
||||
var EPs []database.Episode
|
||||
database.Db.Order("id asc").Find(&EPs)
|
||||
c.HTML(200, "admin_eps.html", gin.H{
|
||||
"title": "Admin Episoden",
|
||||
"EPs": EPs,
|
||||
"page": "admin_eps",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func PostAdminEpisode(c *gin.Context) {
|
||||
if id, ok := CleanParam(c.Param("id")); ok {
|
||||
var EP database.Episode
|
||||
database.Db.Where(id).First(&EP)
|
||||
if id, err := strconv.ParseUint(c.PostForm("id"), 10, 0); err == nil {
|
||||
EP.ID = uint(id)
|
||||
}
|
||||
if id, err := strconv.ParseUint(c.PostForm("authorid"), 10, 0); err == nil {
|
||||
EP.AuthorID = uint(id)
|
||||
}
|
||||
if id, err := strconv.ParseUint(c.PostForm("letsplayid"), 10, 0); err == nil {
|
||||
EP.LetsPlayID = uint(id)
|
||||
}
|
||||
EP.Slug.String = c.PostForm("slug")
|
||||
EP.Name.String = c.PostForm("name")
|
||||
if ep, err := strconv.ParseInt(c.PostForm("episode"), 10, 64); err == nil {
|
||||
EP.Episode.Int64 = ep
|
||||
}
|
||||
if c.PostForm("thumbs") == "" && !strings.HasPrefix(c.PostForm("thumbb"), "/") {
|
||||
EP.ThumbS.String, EP.ThumbB.String, _ = image.ResizeThumb(c.PostForm("thumbb"))
|
||||
} else {
|
||||
EP.ThumbS.String = c.PostForm("thumbs")
|
||||
EP.ThumbB.String = c.PostForm("thumbb")
|
||||
}
|
||||
EP.Youtube.String = c.PostForm("youtube")
|
||||
EP.Descr.String = c.PostForm("descr")
|
||||
if t, err := time.Parse("2006-01-02 15:04:05 -0700 MST", c.PostForm("aired")); err == nil {
|
||||
EP.Aired = t
|
||||
}
|
||||
if ra, err := strconv.ParseFloat(c.PostForm("authorid"), 64); err == nil {
|
||||
EP.Rating.Float64 = ra
|
||||
}
|
||||
if vo, err := strconv.ParseInt(c.PostForm("votes"), 10, 64); err == nil {
|
||||
EP.Votes.Int64 = vo
|
||||
}
|
||||
if du, err := strconv.ParseInt(c.PostForm("duration"), 10, 64); err == nil {
|
||||
EP.Duration.Int64 = du
|
||||
}
|
||||
database.Db.Save(&EP);
|
||||
c.Redirect(301, "/admin/episode#" + strconv.FormatUint(uint64(EP.ID), 10))
|
||||
} else {
|
||||
c.Redirect(301, "/admin/episode")
|
||||
}
|
||||
}
|
||||
|
||||
func GetAdminAuthor(c *gin.Context) {
|
||||
if id, ok := CleanParam(c.Param("id")); ok {
|
||||
//AT in URL
|
||||
var AT database.Author
|
||||
if database.Db.Where(id).First(&AT).Error == nil {
|
||||
//AT found
|
||||
c.HTML(200, "admin_at.html", gin.H{
|
||||
"title": "Admin Sprecher",
|
||||
"AT": AT,
|
||||
"page": "admin_at",
|
||||
})
|
||||
} else {
|
||||
//AT not found
|
||||
c.AbortWithStatus(404)
|
||||
}
|
||||
} else {
|
||||
var ATs []database.Author
|
||||
database.Db.Order("id asc").Find(&ATs)
|
||||
c.HTML(200, "admin_ats.html", gin.H{
|
||||
"title": "Admin Sprecher",
|
||||
"ATs": ATs,
|
||||
"page": "admin_ats",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func PostAdminAuthor(c *gin.Context) {
|
||||
if id, ok := CleanParam(c.Param("id")); ok {
|
||||
var AT database.Author
|
||||
database.Db.Where(id).First(&AT)
|
||||
if id, err := strconv.ParseUint(c.PostForm("id"), 10, 0); err == nil {
|
||||
AT.ID = uint(id)
|
||||
}
|
||||
AT.Slug.String = c.PostForm("slug")
|
||||
AT.Name.String = c.PostForm("name")
|
||||
AT.Youtube.String = c.PostForm("youtube")
|
||||
if c.PostForm("avatars") == "" && !strings.HasPrefix(c.PostForm("avatarb"), "/") {
|
||||
AT.AvatarS.String, AT.AvatarB.String, _ = image.ResizeAvatar(c.PostForm("avatarb"))
|
||||
} else {
|
||||
AT.AvatarS.String = c.PostForm("avatars")
|
||||
AT.AvatarB.String = c.PostForm("avatarb")
|
||||
}
|
||||
if c.PostForm("fanarts") == "" && !strings.HasPrefix(c.PostForm("fanartb"), "/") {
|
||||
AT.FanArtS.String, AT.FanArtB.String, _ = image.ResizeFanArt(c.PostForm("fanartb"))
|
||||
} else {
|
||||
AT.FanArtS.String = c.PostForm("fanarts")
|
||||
AT.FanArtB.String = c.PostForm("fanartb")
|
||||
}
|
||||
database.Db.Save(&AT);
|
||||
c.Redirect(301, "/admin/sprecher#" + strconv.FormatUint(uint64(AT.ID), 10))
|
||||
} else {
|
||||
c.Redirect(301, "/admin/sprecher")
|
||||
}
|
||||
}
|
|
@ -40,6 +40,25 @@ func initRouter() *gin.Engine {
|
|||
router.GET("/zeige/:aslug/testet", GetAtLts)
|
||||
router.GET("/zeige/:aslug/episoden", GetAtEps)
|
||||
|
||||
admin := router.Group("/admin")
|
||||
|
||||
admin.GET("/", GetAdminIndex)
|
||||
|
||||
admin.GET("/lets-play", GetAdminLetsPlay)
|
||||
admin.GET("/lets-play/:id", GetAdminLetsPlay)
|
||||
admin.POST("/lets-play/:id", PostAdminLetsPlay)
|
||||
|
||||
admin.GET("/lets-test", GetAdminLetsTest)
|
||||
admin.GET("/lets-test/:id", GetAdminLetsTest)
|
||||
admin.POST("/lets-test/:id", PostAdminLetsTest)
|
||||
|
||||
admin.GET("/episode", GetAdminEpisode)
|
||||
admin.GET("/episode/:id", GetAdminEpisode)
|
||||
admin.POST("/episode/:id", PostAdminEpisode)
|
||||
|
||||
admin.GET("/sprecher", GetAdminAuthor)
|
||||
admin.GET("/sprecher/:id", GetAdminAuthor)
|
||||
admin.POST("/sprecher/:id", PostAdminAuthor)
|
||||
|
||||
// API
|
||||
api := router.Group("/api")
|
||||
|
@ -71,6 +90,7 @@ func initRouter() *gin.Engine {
|
|||
v3.GET("/recent/:limit", apiv3.GetRecent)
|
||||
v3.GET("/search/:type/:query", apiv3.GetSearch)
|
||||
}
|
||||
|
||||
return router
|
||||
}
|
||||
|
||||
|
|
34
gserver/templates/admin_at.html
Normal file
34
gserver/templates/admin_at.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }} #{{ .AT.ID }}</h1>
|
||||
<form method="post">
|
||||
<label>
|
||||
ID <input type="text" name="id" value="{{ .AT.ID }}">
|
||||
</label>
|
||||
<label>
|
||||
Slug <input type="text" name="slug" value="{{ .AT.Slug.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Name <input type="text" name="name" value="{{ .AT.Name.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Youtube <input type="text" name="youtube" value="{{ .AT.Youtube.String }}">
|
||||
</label>
|
||||
<label>
|
||||
AvatarS <input type="text" name="avatars" value="{{ .AT.AvatarS.String }}">
|
||||
</label>
|
||||
<label>
|
||||
AvatarB <input type="text" name="avatarb" value="{{ .AT.AvatarB.String }}">
|
||||
</label>
|
||||
<label>
|
||||
FanArtS <input type="text" name="fanarts" value="{{ .AT.FanArtS.String }}">
|
||||
</label>
|
||||
<label>
|
||||
FanArtB <input type="text" name="fanartb" value="{{ .AT.FanArtB.String }}">
|
||||
</label>
|
||||
<input type="submit" class="button">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
25
gserver/templates/admin_ats.html
Normal file
25
gserver/templates/admin_ats.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }}</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Name</th>
|
||||
<th>Slug</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .ATs }}
|
||||
<tr>
|
||||
<td><a href="/admin/sprecher/{{ .ID }}" id="{{ .ID }}">{{ .ID }}</a></td>
|
||||
<td>{{ .Name.String }}</td>
|
||||
<td>{{ .Slug.String }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
52
gserver/templates/admin_ep.html
Normal file
52
gserver/templates/admin_ep.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }} #{{ .EP.ID }}</h1>
|
||||
<form method="post">
|
||||
<label>
|
||||
ID <input type="text" name="id" value="{{ .EP.ID }}">
|
||||
</label>
|
||||
<label>
|
||||
AuthorID <input type="text" name="authorid" value="{{ .EP.AuthorID }}">
|
||||
</label>
|
||||
<label>
|
||||
LetsPlayID <input type="text" name="letsplayid" value="{{ .EP.LetsPlayID }}">
|
||||
</label>
|
||||
<label>
|
||||
Slug <input type="text" name="slug" value="{{ .EP.Slug.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Name <input type="text" name="name" value="{{ .EP.Name.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Episode <input type="text" name="episode" value="{{ .EP.Episode.Int64 }}">
|
||||
</label>
|
||||
<label>
|
||||
ThumbS <input type="text" name="thumbs" value="{{ .EP.ThumbS.String }}">
|
||||
</label>
|
||||
<label>
|
||||
ThumbB <input type="text" name="thumbb" value="{{ .EP.ThumbB.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Youtube <input type="text" name="youtube" value="{{ .EP.Youtube.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Descr <textarea name="descr" rows="20">{{ .EP.Descr.String }}</textarea>
|
||||
</label>
|
||||
<label>
|
||||
Aired <input type="text" name="aired" value="{{ .EP.Aired }}">
|
||||
</label>
|
||||
<label>
|
||||
Rating <input type="text" name="rating" value="{{ .EP.Rating.Float64 }}">
|
||||
</label>
|
||||
<label>
|
||||
Votes <input type="text" name="votes" value="{{ .EP.Votes.Int64 }}">
|
||||
</label>
|
||||
<label>
|
||||
Duration <input type="text" name="duration" value="{{ .EP.Duration.Int64 }}">
|
||||
</label>
|
||||
<input type="submit" class="button">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
29
gserver/templates/admin_eps.html
Normal file
29
gserver/templates/admin_eps.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }}</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>AT #</th>
|
||||
<th>LP #</th>
|
||||
<th>Name</th>
|
||||
<th>Slug</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .EPs }}
|
||||
<tr>
|
||||
<td><a href="/admin/episode/{{ .ID }}" id="{{ .ID }}">{{ .ID }}</a></td>
|
||||
<td><a href="/admin/sprecher/{{ .AuthorID }}">{{ .AuthorID }}</a></td>
|
||||
<td><a href="/admin/lets-play/{{ .LetsPlayID }}">{{ .LetsPlayID }}</a></td>
|
||||
<td>{{ .Name.String }}</td>
|
||||
<td>{{ .Slug.String }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
13
gserver/templates/admin_index.html
Normal file
13
gserver/templates/admin_index.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }}</h1>
|
||||
<ul>
|
||||
<li><a href="/admin/lets-play">Let's Plays</a>: {{ .LPs }}</li>
|
||||
<li><a href="/admin/lets-test">Let's Tests</a>: {{ .LTs }}</li>
|
||||
<li><a href="/admin/episode">Episoden</a>: {{ .EPs }}</li>
|
||||
<li><a href="/admin/sprecher">Sprecher</a>: {{ .ATs }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
31
gserver/templates/admin_lp.html
Normal file
31
gserver/templates/admin_lp.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }} #{{ .LP.ID }}</h1>
|
||||
<form method="post">
|
||||
<label>
|
||||
ID <input type="text" name="id" value="{{ .LP.ID }}">
|
||||
</label>
|
||||
<label>
|
||||
AuthorID <input type="text" name="authorid" value="{{ .LP.AuthorID }}">
|
||||
</label>
|
||||
<label>
|
||||
Slug <input type="text" name="slug" value="{{ .LP.Slug.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Name <input type="text" name="name" value="{{ .LP.Name.String }}">
|
||||
</label>
|
||||
<label>
|
||||
PosterS <input type="text" name="posters" value="{{ .LP.PosterS.String }}">
|
||||
</label>
|
||||
<label>
|
||||
PosterB <input type="text" name="posterb" value="{{ .LP.PosterB.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Aired <input type="text" name="aired" value="{{ .LP.Aired }}">
|
||||
</label>
|
||||
<input type="submit" class="button">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
27
gserver/templates/admin_lps.html
Normal file
27
gserver/templates/admin_lps.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }}</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>AT #</th>
|
||||
<th>Name</th>
|
||||
<th>Slug</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .LPs }}
|
||||
<tr>
|
||||
<td><a href="/admin/lets-play/{{ .ID }}" id="{{ .ID }}">{{ .ID }}</a></td>
|
||||
<td><a href="/admin/sprecher/{{ .AuthorID }}">{{ .AuthorID }}</a></td>
|
||||
<td>{{ .Name.String }}</td>
|
||||
<td>{{ .Slug.String }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
52
gserver/templates/admin_lt.html
Normal file
52
gserver/templates/admin_lt.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }} #{{ .LT.ID }}</h1>
|
||||
<form method="post">
|
||||
<label>
|
||||
ID <input type="text" name="id" value="{{ .LT.ID }}">
|
||||
</label>
|
||||
<label>
|
||||
AuthorID <input type="text" name="authorid" value="{{ .LT.AuthorID }}">
|
||||
</label>
|
||||
<label>
|
||||
Slug <input type="text" name="slug" value="{{ .LT.Slug.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Name <input type="text" name="name" value="{{ .LT.Name.String }}">
|
||||
</label>
|
||||
<label>
|
||||
PosterS <input type="text" name="posters" value="{{ .LT.PosterS.String }}">
|
||||
</label>
|
||||
<label>
|
||||
PosterB <input type="text" name="posterb" value="{{ .LT.PosterB.String }}">
|
||||
</label>
|
||||
<label>
|
||||
ThumbS <input type="text" name="thumbs" value="{{ .LT.ThumbS.String }}">
|
||||
</label>
|
||||
<label>
|
||||
ThumbB <input type="text" name="thumbb" value="{{ .LT.ThumbB.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Youtube <input type="text" name="youtube" value="{{ .LT.Youtube.String }}">
|
||||
</label>
|
||||
<label>
|
||||
Descr <textarea name="descr" rows="20">{{ .LT.Descr.String }}</textarea>
|
||||
</label>
|
||||
<label>
|
||||
Aired <input type="text" name="aired" value="{{ .LT.Aired }}">
|
||||
</label>
|
||||
<label>
|
||||
Rating <input type="text" name="rating" value="{{ .LT.Rating.Float64 }}">
|
||||
</label>
|
||||
<label>
|
||||
Votes <input type="text" name="votes" value="{{ .LT.Votes.Int64 }}">
|
||||
</label>
|
||||
<label>
|
||||
Duration <input type="text" name="duration" value="{{ .LT.Duration.Int64 }}">
|
||||
</label>
|
||||
<input type="submit" class="button">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
27
gserver/templates/admin_lts.html
Normal file
27
gserver/templates/admin_lts.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{{ template "header.html" . }}
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h1>{{ .title }}</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>AT #</th>
|
||||
<th>Name</th>
|
||||
<th>Slug</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .LTs }}
|
||||
<tr>
|
||||
<td><a href="/admin/lets-test/{{ .ID }}" id="{{ .ID }}">{{ .ID }}</a></td>
|
||||
<td><a href="/admin/sprecher/{{ .AuthorID }}">{{ .AuthorID }}</a></td>
|
||||
<td>{{ .Name.String }}</td>
|
||||
<td>{{ .Slug.String }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
|
@ -13,7 +13,7 @@
|
|||
<p><a href="http://addons.kodi.tv/show/plugin.video.gronkh.de/">Gronkh.de in Kodi</a></p>
|
||||
</div>
|
||||
<div class="small-12 medium-4 columns">
|
||||
<p>Copyright © 2010 - 2015<br /><a href="http://www.gronkh.de/">gronkh.de</a> — Fair use</p>
|
||||
<p>Copyright © 2010 - 2016<br /><a href="http://www.gronkh.de/">gronkh.de</a> — Fair use</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
@ -55,7 +55,7 @@
|
|||
dropd.empty();
|
||||
$.each(data, function (index, value) {
|
||||
li = $(document.createElement("li"));
|
||||
li.html("<a href=\"/lets-play/" + value.slug + "/\">" + value.name + "</a>");
|
||||
li.html("<a href=\"/lets-play/" + value.slug + "\">" + value.name + "</a>");
|
||||
dropd.append(li);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// Make an HTTP Get Request to u
|
||||
|
@ -19,7 +20,7 @@ func GetHTTPResource(u string) (*http.Response, error) {
|
|||
}
|
||||
req, err := http.NewRequest("GET", u, nil)
|
||||
req.AddCookie(cookie)
|
||||
req.Header.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
|
||||
req.Header.Add("Accept", "*/*")
|
||||
req.Header.Add("Cache-Control", "max-age=0")
|
||||
req.Header.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12")
|
||||
if err != nil {
|
||||
|
@ -31,8 +32,8 @@ func GetHTTPResource(u string) (*http.Response, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if res.StatusCode == http.StatusNotFound {
|
||||
return nil, nil
|
||||
if res.StatusCode != 200 {
|
||||
return nil, errors.New(strconv.Itoa(res.StatusCode))
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue