Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/controllers/torrent/router.go
kilo 67d8492380 On-demand stats fetching (#1621)
* Update view.jet.html

* Update router.go

* Create stats.go

* Update view.jet.html

* Update stats.go

* Update stats.go

* rollback

* returns -1 by default

* Update stats.go

* Update stats.go

* Import goscrape & torrent

* copypaste stats.go from scrapers

* travis

* Update stats.go

* Update stats.go

* Put fresh stats into a <span>

* Background-color for freshly fetched stats

* ditto but for tomorrow

* "Loading..." text in case it gets a bit too long

* Stat fetching in controller (missing DB update)

* Update last scraped date too

* update torrent.Scrape tho it doesn't  do anything

* forgot to edit a name

* Update scrape.go

* Update stats.go

* Update stats.go

* flush cache to update stats in listing

* Change function name

* Update stats.go

* Update stats.go

* fix travis

* Update view.jet.html

* Update stats.go

* Update stats.go

* Update stats.go

* Update stats.go

* Update stats.go
2017-10-06 17:06:14 +02:00

28 lignes
878 o
Go

package torrentController
import (
"github.com/NyaaPantsu/nyaa/controllers/middlewares"
"github.com/NyaaPantsu/nyaa/controllers/router"
)
func init() {
router.Get().Any("/download/:hash", DownloadTorrent)
router.Get().Any("/stats/:id", GetStatsHandler)
torrentRoutes := router.Get().Group("/torrent", middlewares.LoggedInMiddleware())
{
torrentRoutes.GET("/", TorrentEditUserPanel)
torrentRoutes.POST("/", TorrentPostEditUserPanel)
torrentRoutes.GET("/tag", ViewFormTag)
torrentRoutes.POST("/tag", ViewFormTag)
torrentRoutes.GET("/tag/add", AddTag)
torrentRoutes.GET("/tag/remove", DeleteTag)
torrentRoutes.GET("/delete", TorrentDeleteUserPanel)
}
torrentViewRoutes := router.Get().Group("/view")
{
torrentViewRoutes.GET("/:id", ViewHandler)
torrentViewRoutes.HEAD("/:id", ViewHeadHandler)
torrentViewRoutes.POST("/:id", PostCommentHandler)
}
}