This commit is contained in:
2026-02-28 16:24:37 +00:00
parent 0ac43946b1
commit bf1685a382
7 changed files with 23 additions and 8 deletions

View File

@@ -79,7 +79,7 @@ var okB64 string = base64.StdEncoding.EncodeToString(okBytes)
var hourglassBytes []byte
var hourglassB64 string = base64.StdEncoding.EncodeToString(hourglassBytes)
//go:embed assets/connect.png
//go:embed assets/connect_tls.png
var connectBytes []byte
var connectB64 string = base64.StdEncoding.EncodeToString(connectBytes)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 748 B

BIN
assets/connect_tls.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

View File

@@ -260,6 +260,9 @@ func switchToTab(jid string, w *gtk.Window) {
headerBox.Append(gtk.NewLabel(fmt.Sprintf("%d participant(s)", i)))
gen.Prepend(headerBox)
muci := getAvatar(jid, jid)
muci.SetPixelSize(80)
gen.Prepend(muci)
memberList.SetChild(gen)
} else {
memberList.SetChild(gtk.NewLabel(jid))

View File

@@ -9,10 +9,21 @@ import (
"path/filepath"
"github.com/BurntSushi/toml"
"math/rand/v2"
_ "embed"
)
func randomClientResource() string {
chars := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZλ"
str := ""
for range 4 {
str = str + string(chars[rand.IntN(len(chars))])
}
return "lambda." + str
}
func dropToSignInPage(err error) {
app := gtk.NewApplication("net.sunglocto.lambda.login", gio.ApplicationFlagsNone)
app.ConnectActivate(func() {
@@ -81,6 +92,7 @@ func dropToSignInPage(err error) {
conf.Nick = nickname_entry.Text()
conf.Insecure = insecure_check.Active()
conf.JoinBookmarks = true
conf.Resource = randomClientResource()
var b bytes.Buffer
e := toml.NewEncoder(&b)

13
main.go
View File

@@ -24,7 +24,6 @@ import (
_ "embed"
"encoding/xml"
"github.com/kr/pretty"
"math/rand/v2"
"runtime"
)
@@ -104,18 +103,16 @@ func main() {
panic(err)
}
// Put 4 random characters at the end
chars := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZλ"
str := ""
for range 4 {
str = str + string(chars[rand.IntN(len(chars))])
if loadedConfig.Resource == "" {
fmt.Println("Config resource is empty! Generating a random one")
loadedConfig.Resource = randomClientResource()
}
config := xmpp.Config{
TransportConfiguration: xmpp.TransportConfiguration{
Address: loadedConfig.Server,
},
Jid: loadedConfig.Username + "/lambda." + str,
Jid: loadedConfig.Username + "/" + loadedConfig.Resource,
Credential: xmpp.Password(loadedConfig.Password),
Insecure: loadedConfig.Insecure,
// StreamLogger: os.Stdout,
@@ -347,6 +344,7 @@ func main() {
c, err := xmpp.NewClient(&config, router, func(err error) {
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
})
if err != nil {
@@ -447,6 +445,7 @@ func main() {
if err != nil {
fmt.Println(err.Error())
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
}
}()

View File

@@ -13,6 +13,7 @@ type chatTab struct {
type lambdaConfig struct {
Server string
Username string
Resource string
Password string
Insecure bool
Nick string