mirror of
https://github.com/handsomezhuzhu/api-proxy.git
synced 2026-02-20 20:00:15 +00:00
v1.1.0
This commit is contained in:
14
main.go
14
main.go
@@ -13,6 +13,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
Version = "1.1.0"
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
proxyMap = make(map[string]*httputil.ReverseProxy)
|
proxyMap = make(map[string]*httputil.ReverseProxy)
|
||||||
tpl *template.Template
|
tpl *template.Template
|
||||||
@@ -190,7 +194,7 @@ const htmlTemplate = `<!DOCTYPE html>
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
AI API Proxy © 2024
|
AI API Proxy v{{.Version}} © 2024
|
||||||
<br>
|
<br>
|
||||||
Maintainer: <a href="https://zhuzihan.com" target="_blank" style="color: inherit; text-decoration: none; border-bottom: 1px dashed currentColor;">Simon</a>
|
Maintainer: <a href="https://zhuzihan.com" target="_blank" style="color: inherit; text-decoration: none; border-bottom: 1px dashed currentColor;">Simon</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -199,7 +203,8 @@ const htmlTemplate = `<!DOCTYPE html>
|
|||||||
</html>`
|
</html>`
|
||||||
|
|
||||||
type PageData struct {
|
type PageData struct {
|
||||||
Items []MappingItem
|
Items []MappingItem
|
||||||
|
Version string
|
||||||
}
|
}
|
||||||
|
|
||||||
type MappingItem struct {
|
type MappingItem struct {
|
||||||
@@ -360,7 +365,10 @@ func renderHome(w http.ResponseWriter) {
|
|||||||
return items[i].Path < items[j].Path
|
return items[i].Path < items[j].Path
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := tpl.Execute(w, PageData{Items: items}); err != nil {
|
if err := tpl.Execute(w, PageData{
|
||||||
|
Items: items,
|
||||||
|
Version: Version,
|
||||||
|
}); err != nil {
|
||||||
log.Printf("Template execution error: %v", err)
|
log.Printf("Template execution error: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user