mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-01-10 04:19:38 +02:00
removed functions out of handlers
This commit is contained in:
parent
57915e63e7
commit
81eb5c47e9
@ -52,7 +52,7 @@ func ListInstalledMods(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Toggles mod passed in through mod variable
|
||||
// Updates mod-list.json file to toggle the enabled status of mods
|
||||
func ToggleMod(w http.ResponseWriter, r *http.Request) {
|
||||
/*func ToggleMod(w http.ResponseWriter, r *http.Request) {
|
||||
var err error
|
||||
resp := JSONResponse{
|
||||
Success: false,
|
||||
@ -88,10 +88,10 @@ func ToggleMod(w http.ResponseWriter, r *http.Request) {
|
||||
if err = json.NewEncoder(w).Encode(resp); err != nil {
|
||||
log.Printf("Error in toggle mod: %s", err)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Returns JSON response of all mods in the mod-list.json file
|
||||
func ListMods(w http.ResponseWriter, r *http.Request) {
|
||||
/*func ListMods(w http.ResponseWriter, r *http.Request) {
|
||||
var err error
|
||||
resp := JSONResponse{
|
||||
Success: false,
|
||||
@ -113,7 +113,7 @@ func ListMods(w http.ResponseWriter, r *http.Request) {
|
||||
if err := json.NewEncoder(w).Encode(resp); err != nil {
|
||||
log.Printf("Error listing mods: %s", err)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Uploads mod to the mods directory
|
||||
func UploadMod(w http.ResponseWriter, r *http.Request) {
|
||||
@ -165,7 +165,7 @@ func UploadMod(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func RemoveMod(w http.ResponseWriter, r *http.Request) {
|
||||
/*func RemoveMod(w http.ResponseWriter, r *http.Request) {
|
||||
var err error
|
||||
resp := JSONResponse{
|
||||
Success: false,
|
||||
@ -193,7 +193,7 @@ func RemoveMod(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
func DownloadMod(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json;charset=UTF-8")
|
||||
@ -208,7 +208,7 @@ func DownloadMod(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, modFile)
|
||||
}
|
||||
|
||||
func CreateModPackHandler(w http.ResponseWriter, r *http.Request) {
|
||||
/*func CreateModPackHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var err error
|
||||
resp := JSONResponse{
|
||||
Success: false,
|
||||
@ -251,9 +251,9 @@ func CreateModPackHandler(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("Error listing saves: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
func ListModPacks(w http.ResponseWriter, r *http.Request) {
|
||||
/*func ListModPacks(w http.ResponseWriter, r *http.Request) {
|
||||
var err error
|
||||
resp := JSONResponse{
|
||||
Success: false,
|
||||
@ -276,7 +276,7 @@ func ListModPacks(w http.ResponseWriter, r *http.Request) {
|
||||
if err := json.NewEncoder(w).Encode(resp); err != nil {
|
||||
log.Printf("Error listing saves: %s", err)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
func DownloadModPack(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json;charset=UTF-8")
|
||||
@ -291,7 +291,7 @@ func DownloadModPack(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, modFile)
|
||||
}
|
||||
|
||||
func DeleteModPack(w http.ResponseWriter, r *http.Request) {
|
||||
/*func DeleteModPack(w http.ResponseWriter, r *http.Request) {
|
||||
var err error
|
||||
resp := JSONResponse{
|
||||
Success: false,
|
||||
@ -318,7 +318,7 @@ func DeleteModPack(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("Error removing modpack: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Lists all save files in the factorio/saves directory
|
||||
func ListSaves(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -98,7 +98,7 @@ func main() {
|
||||
// Load server config from file
|
||||
loadServerConfig(config.ConfFile)
|
||||
// Create mod pack dir if missing
|
||||
createModPackDir()
|
||||
//createModPackDir() FIXME
|
||||
|
||||
// Initialize Factorio Server struct
|
||||
FactorioServ, err = initFactorio()
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
@ -20,18 +19,18 @@ func listInstalledMods(modDir string) ([]Mod, error) {
|
||||
file, err := ioutil.ReadFile(modDir + "mod-list.json")
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
log.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err_json := json.Unmarshal(file, &result)
|
||||
|
||||
if err_json != nil {
|
||||
fmt.Println(err.Error())
|
||||
log.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Printf("%v", result)
|
||||
log.Printf("%v", result)
|
||||
|
||||
|
||||
//files, err := ioutil.ReadDir(modDir)
|
||||
|
Loading…
Reference in New Issue
Block a user