Merge branch 'master' into email-settings-UI

This commit is contained in:
Arminas 2023-05-19 01:28:32 +03:00 committed by GitHub
commit e2d767ea3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 88 additions and 85 deletions

View file

@ -5,13 +5,13 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"io/fs"
"net/http"
"os"
"sort"
"strings"
"time"
rice "github.com/GeertJohan/go.rice"
"github.com/gorilla/sessions"
"github.com/labstack/echo-contrib/session"
"github.com/labstack/echo/v4"
@ -1015,7 +1015,7 @@ func SuggestIPAllocation(db store.IStore) echo.HandlerFunc {
}
// ApplyServerConfig handler to write config file and restart Wireguard server
func ApplyServerConfig(db store.IStore, tmplBox *rice.Box) echo.HandlerFunc {
func ApplyServerConfig(db store.IStore, tmplDir fs.FS) echo.HandlerFunc {
return func(c echo.Context) error {
server, err := db.GetServer()
@ -1043,14 +1043,14 @@ func ApplyServerConfig(db store.IStore, tmplBox *rice.Box) echo.HandlerFunc {
}
// Write config file
err = util.WriteWireGuardServerConfig(tmplBox, server, clients, users, settings)
err = util.WriteWireGuardServerConfig(tmplDir, server, clients, users, settings)
if err != nil {
log.Error("Cannot apply server config: ", err)
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{
false, fmt.Sprintf("Cannot apply server config: %v", err),
})
}
err = util.UpdateHashes(db)
if err != nil {
log.Error("Cannot update hashes: ", err)
@ -1083,4 +1083,3 @@ func AboutPage() echo.HandlerFunc {
})
}
}