Compare commits

...

4 Commits

Author SHA1 Message Date
Dan Ballard 7a65efaa78 change to use new go-cross-compile container
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is pending Details
2024-03-05 09:38:14 -08:00
Sarah Jamie Lewis 83c84b2049
Add Reload Field to CwtchStarted event
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-02-26 18:01:46 -08:00
Sarah Jamie Lewis 6618410cc9
Upgrade Cwtch
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-02-26 09:28:36 -08:00
Sarah Jamie Lewis 89f19928c2
Load Correct Profile Image when ProfileImageExperiment is Disabled
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-02-23 15:22:12 -08:00
6 changed files with 24 additions and 22 deletions

View File

@ -5,7 +5,7 @@ name: linux-android-windows-test
steps: steps:
- name: fetch - name: fetch
image: golang:1.21.5 image: openpriv/go-cross-compile:2024.02
volumes: volumes:
- name: deps - name: deps
path: /go path: /go
@ -26,7 +26,7 @@ steps:
- export GOSUMDB="off" - export GOSUMDB="off"
- name: build-linux - name: build-linux
image: openpriv/golangxarm:1.21.5-bullseye image: openpriv/go-cross-compile:2024.02
volumes: volumes:
- name: deps - name: deps
path: /go path: /go
@ -36,7 +36,7 @@ steps:
- make linux - make linux
- name: build-android - name: build-android
image: openpriv/android-go-mobile:2024.01 image: openpriv/go-cross-compile:2024.02
volumes: volumes:
- name: deps - name: deps
path: /go path: /go
@ -49,7 +49,7 @@ steps:
- make android - make android
- name: build-windows - name: build-windows
image: openpriv/mingw-go:2024.01 image: openpriv/go-cross-compile:2024.02
environment: environment:
GOPATH: /go GOPATH: /go
volumes: volumes:
@ -60,7 +60,7 @@ steps:
- make windows - make windows
- name: deploy-buildfiles - name: deploy-buildfiles
image: kroniak/ssh-client image: openpriv/go-cross-compile:2024.02
pull: if-not-exists pull: if-not-exists
environment: environment:
BUILDFILES_KEY: BUILDFILES_KEY:

View File

@ -48,7 +48,7 @@ libCwtch.x.so: lib.go
./switch-ffi.sh ./switch-ffi.sh
mkdir -p build/linux mkdir -p build/linux
ifeq ($(ARCH),x86_64) 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.so build/linux/libCwtch.arm64.so
mv libCwtch.x.h build/linux/libCwtch.h mv libCwtch.x.h build/linux/libCwtch.h
endif endif

2
go.mod
View File

@ -3,7 +3,7 @@ module git.openprivacy.ca/cwtch.im/cwtch-autobindings
go 1.20 go 1.20
require ( 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/cwtch.im/server v1.4.5
git.openprivacy.ca/openprivacy/connectivity v1.11.0 git.openprivacy.ca/openprivacy/connectivity v1.11.0
git.openprivacy.ca/openprivacy/log v1.0.3 git.openprivacy.ca/openprivacy/log v1.0.3

4
go.sum
View File

@ -1,6 +1,6 @@
cwtch.im/cwtch v0.18.0/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y= cwtch.im/cwtch v0.18.0/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
cwtch.im/cwtch v0.26.3 h1:YcNu3AyP/jMj1d/m402tz6kYcqTlK5AIlJRkK7MxJHk= cwtch.im/cwtch v0.27.0 h1:MkNIZ+pT5ZwiGlKHk20GMUTlzBsmCWJEibbj6hr+WHw=
cwtch.im/cwtch v0.26.3/go.mod h1:A3i92aFuhyHI2DYO2Qnvl5iqEw0Cox22pdiypHnMOy4= 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-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=

View File

@ -247,7 +247,7 @@ func ReconnectCwtchForeground() {
settingsJson, _ := json.Marshal(application.ReadSettings()) 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.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.QueryACNStatus()
application.QueryACNVersion() application.QueryACNVersion()
} }

View File

@ -224,7 +224,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
cpicPath = RandomGroupImage(conversationInfo.Handle) cpicPath = RandomGroupImage(conversationInfo.Handle)
defaultPath = RandomGroupImage(conversationInfo.Handle) defaultPath = RandomGroupImage(conversationInfo.Handle)
} else { } else {
cpicPath = GetProfileImage(profile, conversationInfo, settings.DownloadPath) cpicPath = eh.GetProfileImage(profile, conversationInfo, settings.DownloadPath)
defaultPath = RandomProfileImage(conversationInfo.Handle) defaultPath = RandomProfileImage(conversationInfo.Handle)
} }
@ -333,15 +333,17 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
return string(json) 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 {
fileKey, err := profile.GetConversationAttribute(conversationInfo.ID, attr.PublicScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(constants.CustomProfileImageKey))) if eh.app.IsFeatureEnabled(constants.ImagePreviewsExperiment) {
if err == nil { fileKey, err := profile.GetConversationAttribute(conversationInfo.ID, attr.PublicScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(constants.CustomProfileImageKey)))
if value, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.complete", fileKey)); exists && value == event.True { if err == nil {
fp, _ := filesharing.GenerateDownloadPath(basepath, fileKey, true) if value, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.complete", fileKey)); exists && value == event.True {
// check if the file exists...if it does then set the path... fp, _ := filesharing.GenerateDownloadPath(basepath, fileKey, true)
if _, err := os.Stat(fp); err == nil { // check if the file exists...if it does then set the path...
image, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.path", fileKey)) if _, err := os.Stat(fp); err == nil {
return image image, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.path", fileKey))
return image
}
} }
} }
} }
@ -370,7 +372,7 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
if ci != nil && err == nil { if ci != nil && err == nil {
ev.Event.Data[event.ConversationID] = strconv.Itoa(ci.ID) ev.Event.Data[event.ConversationID] = strconv.Itoa(ci.ID)
profile.SetConversationAttribute(ci.ID, attr.LocalScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(constants2.Archived)), event.False) 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 { } else {
// TODO This Conversation May Not Exist Yet...But we are not in charge of creating it... // 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...") 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["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]) conversationID, _ := strconv.Atoi(ev.Event.Data[event.ConversationID])