This commit is contained in:
unknown
2026-02-04 20:27:13 +08:00
commit 3b042d1dad
9410 changed files with 1488147 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package qrcode
import (
"github.com/TeaOSLab/EdgeUser/internal/ttlcache"
"github.com/TeaOSLab/EdgeUser/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/types"
"net/http"
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "")
}
func (this *IndexAction) RunGet(params struct {
Key string
}) {
var item = ttlcache.DefaultCache.Read(params.Key)
if item == nil || item.Value == nil {
this.ResponseWriter.WriteHeader(http.StatusNotFound)
return
}
data, ok := item.Value.([]byte)
if !ok {
this.ResponseWriter.WriteHeader(http.StatusNotFound)
return
}
this.AddHeader("Content-Type", "image/png")
this.AddHeader("Content-Length", types.String(len(data)))
_, _ = this.Write(data)
}

View File

@@ -0,0 +1,14 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package qrcode
import "github.com/iwind/TeaGo"
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Prefix("/qrcode").
Get("", new(IndexAction)).
EndAll()
})
}