diff --git a/internal/router/router.go b/internal/router/router.go index 5e5d3a1..6d92cd3 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -5,6 +5,7 @@ import ( "net/http" "os" "runtime" + "strings" "github.com/debridmediamanager/zurg/internal/config" "github.com/debridmediamanager/zurg/internal/dav" @@ -15,12 +16,8 @@ import ( "github.com/debridmediamanager/zurg/pkg/logutil" "github.com/debridmediamanager/zurg/pkg/realdebrid" "github.com/julienschmidt/httprouter" - - jsoniter "github.com/json-iterator/go" ) -var json = jsoniter.ConfigCompatibleWithStandardLibrary - type ZurgRouter struct { getfile *universal.GetFile torMgr *torrent.TorrentManager @@ -192,6 +189,7 @@ type RootResponse struct { GitCommit string `json:"git_commit"` Dav string `json:"dav"` Html string `json:"html"` + Logs string `json:"logs"` UserInfo *realdebrid.User `json:"user_info"` // Replace UserInfoType with the actual type MemAlloc uint64 `json:"mem_alloc"` // Memory allocation in MB TotalAlloc uint64 `json:"total_alloc"` // Total memory allocated in MB @@ -218,6 +216,7 @@ func (zr *ZurgRouter) rootHandler(resp http.ResponseWriter, req *http.Request, p GitCommit: version.GetGitCommit(), Dav: fmt.Sprintf("//%s/dav/", req.Host), Html: fmt.Sprintf("//%s/http/", req.Host), + Logs: fmt.Sprintf("//%s/logs/", req.Host), UserInfo: userInfo, MemAlloc: bToMb(mem.Alloc), TotalAlloc: bToMb(mem.TotalAlloc), @@ -232,9 +231,225 @@ func (zr *ZurgRouter) rootHandler(resp http.ResponseWriter, req *http.Request, p Config: zr.cfg.GetConfig(), } - if err := json.NewEncoder(resp).Encode(response); err != nil { - http.Error(resp, err.Error(), http.StatusInternalServerError) - } + out := `
| zurg | +||
|---|---|---|
| Version | +%s | +|
| Built At | +%s | +|
| Git Commit | +%s | +|
| DAV | +%s | +|
| HTML | +%s | +|
| Logs | +%s | +|
| Memory Allocation | +%d MB | +|
| Total Memory Allocated | +%d MB | +|
| System Memory | +%d MB | +|
| Number of GC Cycles | +%d | +|
| Process ID | +%d | +|
| Sponsor Zurg | +Patreon | +%s | +
| Github | +%s | +|
| Paypal | +%s | +|
| User Info | +Username | +%s | +
| Points | +%d | +|
| Locale | +%s | +|
| Type | +%s | +|
| Premium | +%d seconds | +|
| Expiration | +%s | +|
| Config | +Version | +%s | +
| Token | +%s | +|
| Host | +%s | +|
| Port | +%s | +|
| Number of Workers | +%d | +|
| Refresh Every Seconds | +%d | +|
| Retain RD Torrent Name | +%t | +|
| Retain Folder Name Extension | +%t | +|
| Can Repair | +%t | +|
| Delete Rar Files | +%t | +|
| RealDebrid Timeout | +%d | +|
| Use Download Cache | +%t | +|
| Rate Limit Sleep Seconds | +%d | +|
| Retries Until Failed | +%d | +|
| Preferred Hosts | +%s | +|
| Network Buffer Size | +%d | +|
| Serve From Rclone | +%t | +|
| Verify Download Link | +%t | +|
| Force IPv6 | +%t | +|
| On Library Update | +%s | +|