mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-25 19:54:06 +03:00
작업중 커밋
This commit is contained in:
parent
4be3a65691
commit
a3376d1974
10 changed files with 251 additions and 18 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/labstack/echo/v4"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strings"
|
||||
|
@ -12,7 +13,6 @@ import (
|
|||
rice "github.com/GeertJohan/go.rice"
|
||||
"github.com/gorilla/sessions"
|
||||
"github.com/labstack/echo-contrib/session"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/rs/xid"
|
||||
"golang.zx2c4.com/wireguard/wgctrl"
|
||||
|
@ -685,3 +685,29 @@ func ApplyServerConfig(db store.IStore, tmplBox *rice.Box) echo.HandlerFunc {
|
|||
return c.JSON(http.StatusOK, jsonHTTPResponse{true, "Applied server config successfully"})
|
||||
}
|
||||
}
|
||||
|
||||
func WakeOnLan(db store.IStore) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
var err error
|
||||
|
||||
hosts, err := db.GetWakeOnLanHosts()
|
||||
if err != nil {
|
||||
log.Errorf("WOL ERROR")
|
||||
return c.JSON(http.StatusNotFound, jsonHTTPResponse{false, "Host not found"})
|
||||
}
|
||||
|
||||
err = c.Render(http.StatusOK, "wake_on_lan_hosts.html", map[string]interface{}{
|
||||
"baseData": model.BaseData{Active: "wake_on_lan_hosts", CurrentUser: currentUser(c)},
|
||||
"hosts": hosts,
|
||||
"error": "",
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
print(err.Error() + "\n")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue