huoshan/huoshan.go

45 lines
819 B
Go
Raw Normal View History

2024-10-02 17:35:29 +08:00
package huoshan
import (
"apigo.cc/apigo/gojs"
_ "embed"
"github.com/ssgo/config"
"github.com/ssgo/log"
"github.com/ssgo/u"
)
//go:embed huoshan.ts
var huoshanTS string
type Conf struct {
AKey string
SKey string
}
var conf = Conf{}
var confAes = u.NewAes([]byte("?GQ$0K0GgLdO=f+~L68PLm$uhKr4'=tV"), []byte("VFs7@sK61cj^f?HZ"))
var keysIsSet = false
func SetSSKey(key, iv []byte) {
if !keysIsSet {
confAes = u.NewAes(key, iv)
keysIsSet = true
}
}
func init() {
obj := gojs.Map{
"image": RequireImage(),
}
config.LoadConfig("huoshan", &conf)
conf.AKey = confAes.DecryptUrlBase64ToString(conf.AKey)
conf.SKey = confAes.DecryptUrlBase64ToString(conf.SKey)
log.DefaultLogger.Info("Conf", "", conf)
gojs.Register("huoshan", gojs.Module{
Object: obj,
TsCode: huoshanTS,
Example: "",
})
}