mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-16 08:55:31 +01:00
Now gets ingame!
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/julienschmidt/httprouter"
|
||||
)
|
||||
|
||||
@@ -11,15 +15,27 @@ func g6Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
|
||||
}
|
||||
|
||||
func serverUniqueName(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
dump, err := httputil.DumpRequest(r, true)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
fmt.Println(string(dump))
|
||||
|
||||
fmt.Fprintf(w, `<?xml version="1.0" encoding="ISO-8859-1"?><uniq code="200">OK</uniq>`)
|
||||
}
|
||||
|
||||
// serveLauncherHTML is responsible for serving the launcher HTML and (HACK) serverlist.xml.
|
||||
func serveLauncherHTML(listenAddr string) {
|
||||
// Manually route the folder root to index.html? Is there a better way to do this?
|
||||
router := httprouter.New()
|
||||
router.GET("/g6_launcher/", g6Index)
|
||||
router.GET("/server/unique.php", serverUniqueName)
|
||||
|
||||
static := httprouter.New()
|
||||
static.ServeFiles("/*filepath", http.Dir("www"))
|
||||
router.NotFound = static
|
||||
|
||||
http.ListenAndServe(listenAddr, router)
|
||||
http.ListenAndServe(listenAddr, handlers.LoggingHandler(os.Stdout, router))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user