- switched all admin routes to /admin/...
- auto redirect from ./ to ./admin - enabled two auth flows (admin and update) - disabled auth for admin by skipping env variable DDNS_ADMIN_LOGIN - introduced optional env variable DDNS_TITLE for dynamic UI title (default TheBBCloudDynDNS) - set copyright date in footer dynamic on startup - moved all remote js/css packages into static in order to avoid external dependencies - added "copy to clipboard button" on host overview page - replaced all fmt.Println to log... - introduced new optional env variable DDNS_CLEAR_LOG_INTERVAL to clear logs after n days (int). (check runs daily once if update request received) - newest logs are shown from top to button on logs page
This commit is contained in:
@@ -3,7 +3,7 @@ package nswrapper
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/labstack/gommon/log"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -25,7 +25,7 @@ func GetIPType(ipAddr string) string {
|
||||
// GetCallerIP searches for the "real" IP senders has actually.
|
||||
// If its a private address we won't use it.
|
||||
func GetCallerIP(r *http.Request) (string, error) {
|
||||
fmt.Println("request", r.Header)
|
||||
log.Info("request", r.Header)
|
||||
for _, h := range []string{"X-Real-Ip", "X-Forwarded-For"} {
|
||||
addresses := strings.Split(r.Header.Get(h), ",")
|
||||
// march from right to left until we get a public address
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/labstack/gommon/log"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -11,7 +12,7 @@ import (
|
||||
|
||||
// UpdateRecord builds a nsupdate file and updates a record by executing it with nsupdate.
|
||||
func UpdateRecord(hostname string, target string, addrType string, zone string, ttl int) error {
|
||||
fmt.Printf("%s record update request: %s -> %s\n", addrType, hostname, target)
|
||||
log.Info(fmt.Sprintf("%s record update request: %s -> %s", addrType, hostname, target))
|
||||
|
||||
f, err := ioutil.TempFile(os.TempDir(), "dyndns")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user