MODS
This commit is contained in:
@@ -79,7 +79,7 @@ var okB64 string = base64.StdEncoding.EncodeToString(okBytes)
|
|||||||
var hourglassBytes []byte
|
var hourglassBytes []byte
|
||||||
var hourglassB64 string = base64.StdEncoding.EncodeToString(hourglassBytes)
|
var hourglassB64 string = base64.StdEncoding.EncodeToString(hourglassBytes)
|
||||||
|
|
||||||
//go:embed assets/connect.png
|
//go:embed assets/connect_tls.png
|
||||||
var connectBytes []byte
|
var connectBytes []byte
|
||||||
var connectB64 string = base64.StdEncoding.EncodeToString(connectBytes)
|
var connectB64 string = base64.StdEncoding.EncodeToString(connectBytes)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 748 B |
BIN
assets/connect_tls.png
Normal file
BIN
assets/connect_tls.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 721 B |
@@ -260,6 +260,9 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
headerBox.Append(gtk.NewLabel(fmt.Sprintf("%d participant(s)", i)))
|
headerBox.Append(gtk.NewLabel(fmt.Sprintf("%d participant(s)", i)))
|
||||||
gen.Prepend(headerBox)
|
gen.Prepend(headerBox)
|
||||||
|
|
||||||
|
muci := getAvatar(jid, jid)
|
||||||
|
muci.SetPixelSize(80)
|
||||||
|
gen.Prepend(muci)
|
||||||
memberList.SetChild(gen)
|
memberList.SetChild(gen)
|
||||||
} else {
|
} else {
|
||||||
memberList.SetChild(gtk.NewLabel(jid))
|
memberList.SetChild(gtk.NewLabel(jid))
|
||||||
|
|||||||
@@ -9,10 +9,21 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
|
"math/rand/v2"
|
||||||
|
|
||||||
_ "embed"
|
_ "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) {
|
func dropToSignInPage(err error) {
|
||||||
app := gtk.NewApplication("net.sunglocto.lambda.login", gio.ApplicationFlagsNone)
|
app := gtk.NewApplication("net.sunglocto.lambda.login", gio.ApplicationFlagsNone)
|
||||||
app.ConnectActivate(func() {
|
app.ConnectActivate(func() {
|
||||||
@@ -81,6 +92,7 @@ func dropToSignInPage(err error) {
|
|||||||
conf.Nick = nickname_entry.Text()
|
conf.Nick = nickname_entry.Text()
|
||||||
conf.Insecure = insecure_check.Active()
|
conf.Insecure = insecure_check.Active()
|
||||||
conf.JoinBookmarks = true
|
conf.JoinBookmarks = true
|
||||||
|
conf.Resource = randomClientResource()
|
||||||
|
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
e := toml.NewEncoder(&b)
|
e := toml.NewEncoder(&b)
|
||||||
|
|||||||
13
main.go
13
main.go
@@ -24,7 +24,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"github.com/kr/pretty"
|
"github.com/kr/pretty"
|
||||||
"math/rand/v2"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -104,18 +103,16 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put 4 random characters at the end
|
if loadedConfig.Resource == "" {
|
||||||
chars := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZλ"
|
fmt.Println("Config resource is empty! Generating a random one")
|
||||||
str := ""
|
loadedConfig.Resource = randomClientResource()
|
||||||
for range 4 {
|
|
||||||
str = str + string(chars[rand.IntN(len(chars))])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config := xmpp.Config{
|
config := xmpp.Config{
|
||||||
TransportConfiguration: xmpp.TransportConfiguration{
|
TransportConfiguration: xmpp.TransportConfiguration{
|
||||||
Address: loadedConfig.Server,
|
Address: loadedConfig.Server,
|
||||||
},
|
},
|
||||||
Jid: loadedConfig.Username + "/lambda." + str,
|
Jid: loadedConfig.Username + "/" + loadedConfig.Resource,
|
||||||
Credential: xmpp.Password(loadedConfig.Password),
|
Credential: xmpp.Password(loadedConfig.Password),
|
||||||
Insecure: loadedConfig.Insecure,
|
Insecure: loadedConfig.Insecure,
|
||||||
// StreamLogger: os.Stdout,
|
// StreamLogger: os.Stdout,
|
||||||
@@ -347,6 +344,7 @@ func main() {
|
|||||||
|
|
||||||
c, err := xmpp.NewClient(&config, router, func(err error) {
|
c, err := xmpp.NewClient(&config, router, func(err error) {
|
||||||
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
|
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
|
||||||
|
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -447,6 +445,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
|
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
|
||||||
|
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user