Fixing build issues
This commit is contained in:
parent
06ce580d27
commit
eb8afc4404
1
main.go
1
main.go
|
@ -14,6 +14,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/layeh/gumble/gumble"
|
"github.com/layeh/gumble/gumble"
|
||||||
)
|
)
|
||||||
|
@ -64,7 +65,7 @@ func findServiceAndAdd(user *gumble.User, url string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if urlService == nil {
|
if urlService == nil {
|
||||||
return "", errors.New("INVALID_URL")
|
return errors.New("INVALID_URL")
|
||||||
} else {
|
} else {
|
||||||
oldLength := dj.queue.Len()
|
oldLength := dj.queue.Len()
|
||||||
var title string
|
var title string
|
||||||
|
@ -80,7 +81,7 @@ func findServiceAndAdd(user *gumble.User, url string) error {
|
||||||
} else {
|
} else {
|
||||||
dj.queue.CurrentSong().Delete()
|
dj.queue.CurrentSong().Delete()
|
||||||
dj.queue.OnSongFinished()
|
dj.queue.OnSongFinished()
|
||||||
return "", errors.New("FAILED_TO_DOWNLOAD")
|
return errors.New("FAILED_TO_DOWNLOAD")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
10
web.go
10
web.go
|
@ -36,7 +36,7 @@ func Webserver(port int) *WebServer {
|
||||||
return &webserver
|
return &webserver
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WebServer) homepage(w http.ResponseWriter, r *http.Request) {
|
func (web WebServer) homepage(w http.ResponseWriter, r *http.Request) {
|
||||||
var uname = token_client[r.URL.Path[1:]]
|
var uname = token_client[r.URL.Path[1:]]
|
||||||
if uname == nil {
|
if uname == nil {
|
||||||
fmt.Fprintf(w, "Invalid Token")
|
fmt.Fprintf(w, "Invalid Token")
|
||||||
|
@ -46,7 +46,7 @@ func (w WebServer) homepage(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WebServer) add(w http.ResponseWriter, r *http.Request) {
|
func (web WebServer) add(w http.ResponseWriter, r *http.Request) {
|
||||||
var uname = token_client[r.FormValue("token")]
|
var uname = token_client[r.FormValue("token")]
|
||||||
if uname == nil {
|
if uname == nil {
|
||||||
fmt.Fprintf(w, "Invalid Token")
|
fmt.Fprintf(w, "Invalid Token")
|
||||||
|
@ -55,7 +55,7 @@ func (w WebServer) add(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WebServer) volume(w http.ResponseWriter, r *http.Request) {
|
func (web WebServer) volume(w http.ResponseWriter, r *http.Request) {
|
||||||
var uname = token_client[r.FormValue("token")]
|
var uname = token_client[r.FormValue("token")]
|
||||||
if uname == nil {
|
if uname == nil {
|
||||||
fmt.Fprintf(w, "Invalid Token")
|
fmt.Fprintf(w, "Invalid Token")
|
||||||
|
@ -65,7 +65,7 @@ func (w WebServer) volume(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WebServer) skip(w http.ResponseWriter, r *http.Request) {
|
func (web WebServer) skip(w http.ResponseWriter, r *http.Request) {
|
||||||
var uname = token_client[r.FormValue("token")]
|
var uname = token_client[r.FormValue("token")]
|
||||||
if uname == nil {
|
if uname == nil {
|
||||||
fmt.Fprintf(w, "Invalid Token")
|
fmt.Fprintf(w, "Invalid Token")
|
||||||
|
@ -75,7 +75,7 @@ func (w WebServer) skip(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WebServer) GetWebAddress(user *gumble.User) {
|
func (web WebServer) GetWebAddress(user *gumble.User) {
|
||||||
if client_token[user] != "" {
|
if client_token[user] != "" {
|
||||||
token_client[client_token[user]] = nil
|
token_client[client_token[user]] = nil
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue