Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
Dan Ballard | 7a65efaa78 | |
Sarah Jamie Lewis | 83c84b2049 | |
Sarah Jamie Lewis | 6618410cc9 | |
Sarah Jamie Lewis | 89f19928c2 | |
Sarah Jamie Lewis | 243727a131 |
10
.drone.yml
10
.drone.yml
|
@ -5,7 +5,7 @@ name: linux-android-windows-test
|
|||
|
||||
steps:
|
||||
- name: fetch
|
||||
image: golang:1.21.5
|
||||
image: openpriv/go-cross-compile:2024.02
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
|
@ -26,7 +26,7 @@ steps:
|
|||
- export GOSUMDB="off"
|
||||
|
||||
- name: build-linux
|
||||
image: openpriv/golangxarm:1.21.5-bullseye
|
||||
image: openpriv/go-cross-compile:2024.02
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
|
@ -36,7 +36,7 @@ steps:
|
|||
- make linux
|
||||
|
||||
- name: build-android
|
||||
image: openpriv/android-go-mobile:2024.01
|
||||
image: openpriv/go-cross-compile:2024.02
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
|
@ -49,7 +49,7 @@ steps:
|
|||
- make android
|
||||
|
||||
- name: build-windows
|
||||
image: openpriv/mingw-go:2024.01
|
||||
image: openpriv/go-cross-compile:2024.02
|
||||
environment:
|
||||
GOPATH: /go
|
||||
volumes:
|
||||
|
@ -60,7 +60,7 @@ steps:
|
|||
- make windows
|
||||
|
||||
- name: deploy-buildfiles
|
||||
image: kroniak/ssh-client
|
||||
image: openpriv/go-cross-compile:2024.02
|
||||
pull: if-not-exists
|
||||
environment:
|
||||
BUILDFILES_KEY:
|
||||
|
|
2
Makefile
2
Makefile
|
@ -48,7 +48,7 @@ libCwtch.x.so: lib.go
|
|||
./switch-ffi.sh
|
||||
mkdir -p build/linux
|
||||
ifeq ($(ARCH),x86_64)
|
||||
env CGO_ENABLED=1 CC=$(ARM_X_CC) GOARCH=arm64 go build -trimpath -ldflags "-buildid=autobindings-v0.0.3-22-g20065b2 -X main.buildVer=autobindings-v0.0.3-22-g20065b2 -X main.buildDate=2023-05-01-21-41" -buildmode c-shared -o libCwtch.x.so
|
||||
env CGO_ENABLED=1 CC=$(ARM_X_CC) GOARCH=arm64 go build -trimpath -ldflags "-buildid=autobindings-$(shell git describe --tags) -X main.buildVer=autobindings-$(shell git describe --tags) -X main.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.x.so
|
||||
mv libCwtch.x.so build/linux/libCwtch.arm64.so
|
||||
mv libCwtch.x.h build/linux/libCwtch.h
|
||||
endif
|
||||
|
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module git.openprivacy.ca/cwtch.im/cwtch-autobindings
|
|||
go 1.20
|
||||
|
||||
require (
|
||||
cwtch.im/cwtch v0.26.3
|
||||
cwtch.im/cwtch v0.27.0
|
||||
git.openprivacy.ca/cwtch.im/server v1.4.5
|
||||
git.openprivacy.ca/openprivacy/connectivity v1.11.0
|
||||
git.openprivacy.ca/openprivacy/log v1.0.3
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,6 +1,6 @@
|
|||
cwtch.im/cwtch v0.18.0/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
|
||||
cwtch.im/cwtch v0.26.3 h1:YcNu3AyP/jMj1d/m402tz6kYcqTlK5AIlJRkK7MxJHk=
|
||||
cwtch.im/cwtch v0.26.3/go.mod h1:A3i92aFuhyHI2DYO2Qnvl5iqEw0Cox22pdiypHnMOy4=
|
||||
cwtch.im/cwtch v0.27.0 h1:MkNIZ+pT5ZwiGlKHk20GMUTlzBsmCWJEibbj6hr+WHw=
|
||||
cwtch.im/cwtch v0.27.0/go.mod h1:A3i92aFuhyHI2DYO2Qnvl5iqEw0Cox22pdiypHnMOy4=
|
||||
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
|
||||
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"runtime"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
"strconv"
|
||||
"time"
|
||||
mrand "math/rand"
|
||||
"crypto/rand"
|
||||
|
@ -246,7 +247,7 @@ func ReconnectCwtchForeground() {
|
|||
|
||||
settingsJson, _ := json.Marshal(application.ReadSettings())
|
||||
application.GetPrimaryBus().Publish(event.NewEvent(settings.UpdateGlobalSettings, map[event.Field]string{event.Data: string(settingsJson)}))
|
||||
application.GetPrimaryBus().Publish(event.NewEvent(settings.CwtchStarted, map[event.Field]string{}))
|
||||
application.GetPrimaryBus().Publish(event.NewEvent(settings.CwtchStarted, map[event.Field]string{utils.ReloadEvent: event.True}))
|
||||
application.QueryACNStatus()
|
||||
application.QueryACNVersion()
|
||||
}
|
||||
|
@ -469,7 +470,30 @@ func buildACN(globalSettings settings.GlobalSettings, torPath string, appDir str
|
|||
// Override Ports if on Tails...
|
||||
if cwtchTails := os.Getenv("CWTCH_TAILS"); strings.ToLower(cwtchTails) == "true" {
|
||||
log.Infof("CWTCH_TAILS environment variable set... overriding tor config...")
|
||||
|
||||
controlPort = 9051
|
||||
|
||||
// In tails 5.13 the control port was changed to 951
|
||||
// so read the Tails Version File and if it exists...
|
||||
b, err := os.ReadFile("/etc/amnesia/version")
|
||||
if err == nil {
|
||||
// the file should start with the version followed
|
||||
// by a space...
|
||||
versionEnd := strings.Index(string(b), " ")
|
||||
versionStr := string(b)[:versionEnd]
|
||||
version, err := strconv.ParseFloat(versionStr, 64)
|
||||
if err == nil {
|
||||
log.Infof("Confirming Tails Version: %v", version)
|
||||
// assert the control port if we are at the dedicated version...
|
||||
// we know this change happened sometime after 5.11
|
||||
if version >= 5.13 {
|
||||
controlPort = 951
|
||||
}
|
||||
} else {
|
||||
log.Errorf("Unable to confirm Tails version. CWTCH_TAILS options may not function correctly.")
|
||||
}
|
||||
}
|
||||
|
||||
socksPort = 9050
|
||||
globalSettings.CustomControlPort = controlPort
|
||||
globalSettings.CustomSocksPort = socksPort
|
||||
|
|
|
@ -224,7 +224,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
cpicPath = RandomGroupImage(conversationInfo.Handle)
|
||||
defaultPath = RandomGroupImage(conversationInfo.Handle)
|
||||
} else {
|
||||
cpicPath = GetProfileImage(profile, conversationInfo, settings.DownloadPath)
|
||||
cpicPath = eh.GetProfileImage(profile, conversationInfo, settings.DownloadPath)
|
||||
defaultPath = RandomProfileImage(conversationInfo.Handle)
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,8 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
return string(json)
|
||||
}
|
||||
|
||||
func GetProfileImage(profile peer.CwtchPeer, conversationInfo *model.Conversation, basepath string) string {
|
||||
func (eh *EventHandler) GetProfileImage(profile peer.CwtchPeer, conversationInfo *model.Conversation, basepath string) string {
|
||||
if eh.app.IsFeatureEnabled(constants.ImagePreviewsExperiment) {
|
||||
fileKey, err := profile.GetConversationAttribute(conversationInfo.ID, attr.PublicScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(constants.CustomProfileImageKey)))
|
||||
if err == nil {
|
||||
if value, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.complete", fileKey)); exists && value == event.True {
|
||||
|
@ -345,6 +346,7 @@ func GetProfileImage(profile peer.CwtchPeer, conversationInfo *model.Conversatio
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return RandomProfileImage(conversationInfo.Handle)
|
||||
}
|
||||
|
||||
|
@ -370,7 +372,7 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
|||
if ci != nil && err == nil {
|
||||
ev.Event.Data[event.ConversationID] = strconv.Itoa(ci.ID)
|
||||
profile.SetConversationAttribute(ci.ID, attr.LocalScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(constants2.Archived)), event.False)
|
||||
ev.Event.Data[constants2.Picture] = GetProfileImage(profile, ci, eh.app.ReadSettings().DownloadPath)
|
||||
ev.Event.Data[constants2.Picture] = eh.GetProfileImage(profile, ci, eh.app.ReadSettings().DownloadPath)
|
||||
} else {
|
||||
// TODO This Conversation May Not Exist Yet...But we are not in charge of creating it...
|
||||
log.Errorf("todo wait for contact to be added before processing this event...")
|
||||
|
@ -399,7 +401,7 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
|||
ev.Event.Data["Nick"] = ev.Event.Data["RemotePeer"]
|
||||
}
|
||||
}
|
||||
ev.Event.Data[constants2.Picture] = GetProfileImage(profile, ci, eh.app.ReadSettings().DownloadPath)
|
||||
ev.Event.Data[constants2.Picture] = eh.GetProfileImage(profile, ci, eh.app.ReadSettings().DownloadPath)
|
||||
}
|
||||
|
||||
conversationID, _ := strconv.Atoi(ev.Event.Data[event.ConversationID])
|
||||
|
|
Loading…
Reference in New Issue