HEAVY: migrate accounts and logs to service/repo architecture
This commit is contained in:
parent
5c255fb34b
commit
49e14b5bc5
37 changed files with 1019 additions and 687 deletions
|
|
@ -2,14 +2,15 @@ package view
|
|||
|
||||
import (
|
||||
"arimelody-web/controller"
|
||||
"arimelody-web/model"
|
||||
"arimelody-web/model/app"
|
||||
"arimelody-web/model/twitch"
|
||||
"arimelody-web/templates"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func IndexHandler(app *model.AppState) http.Handler {
|
||||
func IndexHandler(app *app.AppState) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodHead {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
|
@ -18,10 +19,10 @@ func IndexHandler(app *model.AppState) http.Handler {
|
|||
|
||||
if r.URL.Path == "/" || r.URL.Path == "/index.html" {
|
||||
type IndexData struct {
|
||||
TwitchStatus *model.TwitchStreamInfo
|
||||
TwitchStatus *twitch.StreamInfo
|
||||
}
|
||||
var err error
|
||||
var twitchStatus *model.TwitchStreamInfo = nil
|
||||
var twitchStatus *twitch.StreamInfo = nil
|
||||
if app.Twitch != nil && len(app.Config.Twitch.Broadcaster) > 0 {
|
||||
twitchStatus, err = controller.GetTwitchStatus(app, app.Config.Twitch.Broadcaster)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
package view
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"arimelody-web/controller"
|
||||
"arimelody-web/model"
|
||||
"arimelody-web/templates"
|
||||
"arimelody-web/controller"
|
||||
"arimelody-web/model"
|
||||
"arimelody-web/model/app"
|
||||
"arimelody-web/templates"
|
||||
)
|
||||
|
||||
// HTTP HANDLER METHODS
|
||||
|
||||
func MusicHandler(app *model.AppState) http.Handler {
|
||||
func MusicHandler(app *app.AppState) http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -33,7 +34,7 @@ func MusicHandler(app *model.AppState) http.Handler {
|
|||
return mux
|
||||
}
|
||||
|
||||
func ServeCatalog(app *model.AppState) http.Handler {
|
||||
func ServeCatalog(app *app.AppState) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
releases, err := controller.GetAllReleases(app.DB, true, 0, true)
|
||||
if err != nil {
|
||||
|
|
@ -55,7 +56,7 @@ func ServeCatalog(app *model.AppState) http.Handler {
|
|||
})
|
||||
}
|
||||
|
||||
func ServeGateway(app *model.AppState, release *model.Release) http.Handler {
|
||||
func ServeGateway(app *app.AppState, release *model.Release) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// only allow authorised users to view hidden releases
|
||||
privileged := false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue