forked from sunglocto/lambda
custom resource
This commit is contained in:
14
main.go
14
main.go
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
_ "embed"
|
||||
"encoding/xml"
|
||||
"math/rand/v2"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
@@ -136,6 +137,8 @@ func dropToSignInPage(err error) {
|
||||
|
||||
p, _ := ensureConfig()
|
||||
os.WriteFile(filepath.Join(p, "lambda.toml"), b.Bytes(), 0644)
|
||||
|
||||
|
||||
window.SetVisible(false)
|
||||
main()
|
||||
os.Exit(0)
|
||||
@@ -168,11 +171,18 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Put 4 random characters in front of lambda
|
||||
chars := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZλ"
|
||||
str := ""
|
||||
for range 4 {
|
||||
str = str + string(chars[rand.IntN(len(chars))])
|
||||
}
|
||||
|
||||
config := xmpp.Config{
|
||||
TransportConfiguration: xmpp.TransportConfiguration{
|
||||
Address: loadedConfig.Server,
|
||||
},
|
||||
Jid: loadedConfig.Username,
|
||||
Jid: loadedConfig.Username + "/lambda."+str,
|
||||
Credential: xmpp.Password(loadedConfig.Password),
|
||||
Insecure: loadedConfig.Insecure,
|
||||
// StreamLogger: os.Stdout,
|
||||
@@ -240,9 +250,11 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
if m.Body == "" {
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
originator := jid.MustParse(m.From).Bare().String()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user