Implements Wake On Lan and management features (#164)

This commit is contained in:
ned3y2k 2022-03-20 18:03:27 +09:00 committed by GitHub
parent 037a6c56d3
commit 0224e1f137
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 638 additions and 21 deletions

View file

@ -3,12 +3,11 @@ package main
import (
"flag"
"fmt"
"github.com/labstack/echo/v4"
"net/http"
"time"
rice "github.com/GeertJohan/go.rice"
"github.com/labstack/echo/v4"
"github.com/ngoduykhanh/wireguard-ui/emailer"
"github.com/ngoduykhanh/wireguard-ui/handler"
"github.com/ngoduykhanh/wireguard-ui/router"
@ -147,6 +146,10 @@ func main() {
app.GET("/api/machine-ips", handler.MachineIPAddresses(), handler.ValidSession)
app.GET("/api/suggest-client-ips", handler.SuggestIPAllocation(db), handler.ValidSession)
app.GET("/api/apply-wg-config", handler.ApplyServerConfig(db, tmplBox), handler.ValidSession)
app.GET("/wake_on_lan_hosts", handler.GetWakeOnLanHosts(db), handler.ValidSession)
app.POST("/wake_on_lan_host", handler.SaveWakeOnLanHost(db), handler.ValidSession)
app.DELETE("/wake_on_lan_host/:mac_address", handler.DeleteWakeOnHost(db), handler.ValidSession)
app.PUT("/wake_on_lan_host/:mac_address", handler.WakeOnHost(db), handler.ValidSession)
// servers other static files
app.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assetHandler)))