Compare commits
39 Commits
Author | SHA1 | Date |
---|---|---|
Sarah Jamie Lewis | 055e1d65a1 | |
Sarah Jamie Lewis | 8a7c647ea0 | |
Sarah Jamie Lewis | 5871a2c077 | |
Sarah Jamie Lewis | ae179fab72 | |
Sarah Jamie Lewis | dd411bd337 | |
Sarah Jamie Lewis | 1d3d2878b7 | |
Sarah Jamie Lewis | 28fe3b21fb | |
Sarah Jamie Lewis | 20897a9f8d | |
Sarah Jamie Lewis | 709d377bf4 | |
Sarah Jamie Lewis | 1baac147d7 | |
Sarah Jamie Lewis | f152b02230 | |
Sarah Jamie Lewis | bef3f11150 | |
Sarah Jamie Lewis | b29293334d | |
Sarah Jamie Lewis | 9da33c3083 | |
Sarah Jamie Lewis | 3d0a3a5a49 | |
Sarah Jamie Lewis | 1e4221c6bd | |
Dan Ballard | 973e73a308 | |
Sarah Jamie Lewis | ff20656e22 | |
Sarah Jamie Lewis | e12cb2c965 | |
Sarah Jamie Lewis | 54ba8c463a | |
Sarah Jamie Lewis | 137027d011 | |
Dan Ballard | 916ca279ea | |
Sarah Jamie Lewis | 0d05a0731c | |
Dan Ballard | e7e9a71515 | |
Dan Ballard | 6021daeaca | |
Sarah Jamie Lewis | 92ec4c6667 | |
Sarah Jamie Lewis | d28d0db77c | |
Dan Ballard | 18c6907dbe | |
Sarah Jamie Lewis | c88700b226 | |
Sarah Jamie Lewis | 1f3617cce6 | |
Sarah Jamie Lewis | 3a15d75011 | |
Sarah Jamie Lewis | 482cb54263 | |
Sarah Jamie Lewis | ec467116b1 | |
Dan Ballard | 397d264bd9 | |
Sarah Jamie Lewis | 1a25b45bcf | |
Sarah Jamie Lewis | 989cc25c93 | |
Dan Ballard | 9ef5cbc911 | |
Sarah Jamie Lewis | 39eaa5c8c3 | |
Sarah Jamie Lewis | f0ea513177 |
15
.drone.yml
15
.drone.yml
|
@ -5,15 +5,15 @@ name: linux-android-windows-test
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: fetch
|
- name: fetch
|
||||||
image: golang:1.17.5
|
image: golang:1.19.1
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
commands:
|
commands:
|
||||||
|
- go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||||
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor
|
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor
|
||||||
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc
|
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc
|
||||||
- chmod a+x tor
|
- chmod a+x tor
|
||||||
- go get -u golang.org/x/lint/golint
|
|
||||||
- git fetch --tags
|
- git fetch --tags
|
||||||
#- export GO111MODULE=on
|
#- export GO111MODULE=on
|
||||||
#- go mod vendor
|
#- go mod vendor
|
||||||
|
@ -25,17 +25,16 @@ steps:
|
||||||
- echo `date +%G-%m-%d-%H-%M` > BUILDDATE
|
- echo `date +%G-%m-%d-%H-%M` > BUILDDATE
|
||||||
|
|
||||||
- name: quality
|
- name: quality
|
||||||
image: golang:1.17.5
|
image: golang:1.19.1
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
commands:
|
commands:
|
||||||
- go list ./... | xargs go vet
|
- staticcheck ./...
|
||||||
- go list ./... | xargs golint
|
|
||||||
#Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting
|
#Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting
|
||||||
|
|
||||||
- name: build-linux
|
- name: build-linux
|
||||||
image: golang:1.17.5
|
image: golang:1.19.1
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
|
@ -43,7 +42,7 @@ steps:
|
||||||
- make linux
|
- make linux
|
||||||
|
|
||||||
- name: build-android
|
- name: build-android
|
||||||
image: openpriv/android-go-mobile:2022.09
|
image: openpriv/android-go-mobile:2023.02
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
|
@ -53,7 +52,7 @@ steps:
|
||||||
- make android
|
- make android
|
||||||
|
|
||||||
- name: build-windows
|
- name: build-windows
|
||||||
image: openpriv/mingw-go:2022.09
|
image: openpriv/mingw-go:2023.01
|
||||||
environment:
|
environment:
|
||||||
GOPATH: /go
|
GOPATH: /go
|
||||||
volumes:
|
volumes:
|
||||||
|
|
14
Makefile
14
Makefile
|
@ -16,23 +16,27 @@ windows: libCwtch.dll
|
||||||
|
|
||||||
libCwtch.so: lib.go
|
libCwtch.so: lib.go
|
||||||
./switch-ffi.sh
|
./switch-ffi.sh
|
||||||
go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.so
|
go build -trimpath -ldflags "-buildid=$(shell git describe --tags) -X main.buildVer=$(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.so
|
||||||
|
|
||||||
libCwtch.x64.dylib: lib.go
|
libCwtch.x64.dylib: lib.go
|
||||||
./switch-ffi.sh
|
./switch-ffi.sh
|
||||||
go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.x64.dylib
|
go build -trimpath -ldflags "-buildid=$(shell git describe --tags) -X main.buildVer=$(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.x64.dylib
|
||||||
|
|
||||||
libCwtch.arm64.dylib: lib.go
|
libCwtch.arm64.dylib: lib.go
|
||||||
./switch-ffi.sh
|
./switch-ffi.sh
|
||||||
env GOARCH=arm64 GOOS=darwin CGO_ENABLED=1 go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.arm64.dylib
|
env GOARCH=arm64 GOOS=darwin CGO_ENABLED=1 go build -trimpath -ldflags "-buildid=$(shell git describe --tags) -X main.buildVer=$(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.arm64.dylib
|
||||||
|
|
||||||
cwtch.aar: lib.go
|
cwtch.aar: lib.go
|
||||||
./switch-gomobile.sh
|
./switch-gomobile.sh
|
||||||
gomobile bind -target android/arm,android/arm64,android/amd64 -ldflags="-X cwtch.buildVer=$(shell git describe --tags) -X cwtch.buildDate=$(shell date +%G-%m-%d-%H-%M)"
|
gomobile bind -trimpath -target android/arm,android/arm64,android/amd64 -ldflags="-buildid=$(shell git describe --tags) -X cwtch.buildVer=$(shell git describe --tags) -X cwtch.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)"
|
||||||
|
|
||||||
libCwtch.dll: lib.go
|
libCwtch.dll: lib.go
|
||||||
./switch-ffi.sh
|
./switch-ffi.sh
|
||||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-win32 go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.dll
|
# '-Xlinker --no-insert-timestamp` sets the output dll PE timestamp header to all zeros, instead of the actual time
|
||||||
|
# this is necessary for reproducible builds (see: https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries for additional information)
|
||||||
|
# note: the above documentation also references an ability to set an optional timestamp - this behaviour seems to no longer be supported in more recent versions of mingw32-gcc (the help docs no longer reference that functionality)
|
||||||
|
# these flags have to be passed through to the underlying gcc process using the -extldflags option in the underlying go linker, note that the whole flag is quoted...this is necessary.
|
||||||
|
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-win32 go build -trimpath -ldflags "-buildid=$(shell git describe --tags) -X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M) '-extldflags=-Xlinker --no-insert-timestamp'" -buildmode c-shared -o libCwtch.dll
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.dylib
|
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.dylib
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# NOTE: libcwtch-go has been deprecated in favour of [autobindings](https://git.openprivacy.ca/cwtch.im/autobindings). This repository has been archived and is no longer maintained.
|
||||||
|
|
||||||
# libcwtch-go
|
# libcwtch-go
|
||||||
|
|
||||||
C-bindings for the Go Cwtch Library.
|
C-bindings for the Go Cwtch Library.
|
||||||
|
|
|
@ -16,6 +16,8 @@ const ProfileTypeV1Password = "v1-userPassword"
|
||||||
// PeerOnline stores state on if the peer believes it is online
|
// PeerOnline stores state on if the peer believes it is online
|
||||||
const PeerOnline = "peer-online"
|
const PeerOnline = "peer-online"
|
||||||
|
|
||||||
|
const PeerAutostart = "autostart"
|
||||||
|
|
||||||
// Description is used on server contacts,
|
// Description is used on server contacts,
|
||||||
const Description = "description"
|
const Description = "description"
|
||||||
|
|
||||||
|
|
4
go.mod
4
go.mod
|
@ -3,7 +3,7 @@ module git.openprivacy.ca/cwtch.im/libcwtch-go
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cwtch.im/cwtch v0.18.1
|
cwtch.im/cwtch v0.18.10
|
||||||
git.openprivacy.ca/cwtch.im/server v1.4.5
|
git.openprivacy.ca/cwtch.im/server v1.4.5
|
||||||
git.openprivacy.ca/openprivacy/connectivity v1.8.6
|
git.openprivacy.ca/openprivacy/connectivity v1.8.6
|
||||||
git.openprivacy.ca/openprivacy/log v1.0.3
|
git.openprivacy.ca/openprivacy/log v1.0.3
|
||||||
|
@ -12,7 +12,7 @@ require (
|
||||||
|
|
||||||
require (
|
require (
|
||||||
filippo.io/edwards25519 v1.0.0 // indirect
|
filippo.io/edwards25519 v1.0.0 // indirect
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.5.5 // indirect
|
git.openprivacy.ca/cwtch.im/tapir v0.6.0 // indirect
|
||||||
git.openprivacy.ca/openprivacy/bine v0.0.4 // indirect
|
git.openprivacy.ca/openprivacy/bine v0.0.4 // indirect
|
||||||
github.com/gtank/merlin v0.1.1 // indirect
|
github.com/gtank/merlin v0.1.1 // indirect
|
||||||
github.com/gtank/ristretto255 v0.1.3-0.20210930101514-6bb39798585c // indirect
|
github.com/gtank/ristretto255 v0.1.3-0.20210930101514-6bb39798585c // indirect
|
||||||
|
|
25
go.sum
25
go.sum
|
@ -1,6 +1,18 @@
|
||||||
cwtch.im/cwtch v0.18.0/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
|
cwtch.im/cwtch v0.18.0/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
|
||||||
cwtch.im/cwtch v0.18.1 h1:Z5doy6bMLMZFyLRXOxiZ0CjyUGA3Y59mrN4Ps0/HAw8=
|
cwtch.im/cwtch v0.18.3 h1:3zBvC4buII6pWQ+OOVUR6WuAwQDKCxSrj0ZOYKEeB6I=
|
||||||
cwtch.im/cwtch v0.18.1/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
|
cwtch.im/cwtch v0.18.3/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
|
||||||
|
cwtch.im/cwtch v0.18.4 h1:Oht7rEDVJjVWDOKg0xqDgXvY/H059HMJlOPt/nBGqxk=
|
||||||
|
cwtch.im/cwtch v0.18.4/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||||
|
cwtch.im/cwtch v0.18.5 h1:yqDns4flbowsbaWjMiUm7Em4IAlM8kkgm79CCcXV1GE=
|
||||||
|
cwtch.im/cwtch v0.18.5/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||||
|
cwtch.im/cwtch v0.18.6 h1:CRwoZ/H7y1rAp6jrYh6YCIILU+Sw59hJUvHaWqPgBjg=
|
||||||
|
cwtch.im/cwtch v0.18.6/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||||
|
cwtch.im/cwtch v0.18.7 h1:ysE1kjy4oTF+VaQrkNdwdEs6rklWGOe9Dp8rlu9VDKI=
|
||||||
|
cwtch.im/cwtch v0.18.7/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||||
|
cwtch.im/cwtch v0.18.8 h1:D5mmsBkmHhE7jhRodZG2DtdaxmfvdvLG0W7CAPBf7eo=
|
||||||
|
cwtch.im/cwtch v0.18.8/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||||
|
cwtch.im/cwtch v0.18.10 h1:iTzLzlms1mgn8kLfClU/yAWIVWVRRT8UmfbDNli9dzE=
|
||||||
|
cwtch.im/cwtch v0.18.10/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||||
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=
|
||||||
|
@ -8,6 +20,8 @@ git.openprivacy.ca/cwtch.im/server v1.4.5 h1:QuNAIxld+aWeQfWuGHB2QYZXsqJMmTyl55P
|
||||||
git.openprivacy.ca/cwtch.im/server v1.4.5/go.mod h1:dGB1bePUgDU9xwk7gGkioNeshrbNgGWhSH8zMQwIAUg=
|
git.openprivacy.ca/cwtch.im/server v1.4.5/go.mod h1:dGB1bePUgDU9xwk7gGkioNeshrbNgGWhSH8zMQwIAUg=
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.5.5 h1:km6UDrLYH/GCEn2s+S299/TiRHhxKCIAipYr9GbG3Hk=
|
git.openprivacy.ca/cwtch.im/tapir v0.5.5 h1:km6UDrLYH/GCEn2s+S299/TiRHhxKCIAipYr9GbG3Hk=
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.5.5/go.mod h1:bWWHrDYBtHvxMri59RwIB/w7Eg1aC0BrQ/ycKlnbB5k=
|
git.openprivacy.ca/cwtch.im/tapir v0.5.5/go.mod h1:bWWHrDYBtHvxMri59RwIB/w7Eg1aC0BrQ/ycKlnbB5k=
|
||||||
|
git.openprivacy.ca/cwtch.im/tapir v0.6.0 h1:TtnKjxitkIDMM7Qn0n/u+mOHRLJzuQUYjYRu5n0/QFY=
|
||||||
|
git.openprivacy.ca/cwtch.im/tapir v0.6.0/go.mod h1:iQIq4y7N+DuP3CxyG66WNEC/d6vzh+wXvvOmelB+KoY=
|
||||||
git.openprivacy.ca/openprivacy/bine v0.0.4 h1:CO7EkGyz+jegZ4ap8g5NWRuDHA/56KKvGySR6OBPW+c=
|
git.openprivacy.ca/openprivacy/bine v0.0.4 h1:CO7EkGyz+jegZ4ap8g5NWRuDHA/56KKvGySR6OBPW+c=
|
||||||
git.openprivacy.ca/openprivacy/bine v0.0.4/go.mod h1:13ZqhKyqakDsN/ZkQkIGNULsmLyqtXc46XBcnuXm/mU=
|
git.openprivacy.ca/openprivacy/bine v0.0.4/go.mod h1:13ZqhKyqakDsN/ZkQkIGNULsmLyqtXc46XBcnuXm/mU=
|
||||||
git.openprivacy.ca/openprivacy/connectivity v1.8.6 h1:g74PyDGvpMZ3+K0dXy3mlTJh+e0rcwNk0XF8owzkmOA=
|
git.openprivacy.ca/openprivacy/connectivity v1.8.6 h1:g74PyDGvpMZ3+K0dXy3mlTJh+e0rcwNk0XF8owzkmOA=
|
||||||
|
@ -80,6 +94,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
|
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
|
||||||
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
|
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
|
||||||
|
@ -97,10 +112,13 @@ golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+o
|
||||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||||
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 h1:h+GZ3ubjuWaQjGe8owMGcmMVCqs0xYJtRG5y2bpHaqU=
|
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 h1:h+GZ3ubjuWaQjGe8owMGcmMVCqs0xYJtRG5y2bpHaqU=
|
||||||
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
|
golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
|
||||||
|
golang.org/x/mobile v0.0.0-20220722155234-aaac322e2105 h1:3vUV5x5+3LfQbgk7paCM6INOaJG9xXQbn79xoNkwfIk=
|
||||||
|
golang.org/x/mobile v0.0.0-20220722155234-aaac322e2105/go.mod h1:pe2sM7Uk+2Su1y7u/6Z8KJ24D7lepUjFZbhFOrmDfuQ=
|
||||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||||
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
|
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
@ -111,6 +129,7 @@ golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwY
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||||
|
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
|
@ -135,6 +154,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||||
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
@ -154,6 +174,7 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
|
||||||
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
|
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
|
52
lib.go
52
lib.go
|
@ -238,6 +238,7 @@ func buildACN(settings utils.GlobalSettings, torPath string, appDir string) conn
|
||||||
}
|
}
|
||||||
|
|
||||||
torrc := tor.NewTorrc().WithSocksPort(socksPort).WithOnionTrafficOnly().WithControlPort(controlPort).WithHashedPassword(base64.StdEncoding.EncodeToString(key))
|
torrc := tor.NewTorrc().WithSocksPort(socksPort).WithOnionTrafficOnly().WithControlPort(controlPort).WithHashedPassword(base64.StdEncoding.EncodeToString(key))
|
||||||
|
// torrc.WithLog(path.Join(appDir, "tor", "tor.log"), tor.TorLogLevelNotice)
|
||||||
if settings.UseCustomTorrc {
|
if settings.UseCustomTorrc {
|
||||||
customTorrc := settings.CustomTorrc
|
customTorrc := settings.CustomTorrc
|
||||||
torrc.WithCustom(strings.Split(customTorrc, "\n"))
|
torrc.WithCustom(strings.Split(customTorrc, "\n"))
|
||||||
|
@ -519,17 +520,47 @@ func GetAppBusEvent() string {
|
||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
//export c_CreateProfile
|
//export c_ActivatePeerEngine
|
||||||
func c_CreateProfile(nick_ptr *C.char, nick_len C.int, pass_ptr *C.char, pass_len C.int) {
|
func c_ActivatePeerEngine(onion_ptr *C.char, onion_len C.int) {
|
||||||
CreateProfile(C.GoStringN(nick_ptr, nick_len), C.GoStringN(pass_ptr, pass_len))
|
ActivatePeerEngine(C.GoStringN(onion_ptr, onion_len))
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateProfile(nick, pass string) {
|
func ActivatePeerEngine(profile string) {
|
||||||
if pass == constants.DefactoPasswordForUnencryptedProfiles {
|
doServers := false
|
||||||
application.CreateTaggedPeer(nick, pass, constants.ProfileTypeV1DefaultPassword)
|
if _, err := groups.ExperimentGate(utils.ReadGlobalSettings().Experiments); err == nil {
|
||||||
} else {
|
doServers = true
|
||||||
application.CreateTaggedPeer(nick, pass, constants.ProfileTypeV1Password)
|
|
||||||
}
|
}
|
||||||
|
application.ActivatePeerEngine(profile, true, true, doServers)
|
||||||
|
}
|
||||||
|
|
||||||
|
//export c_DeactivatePeerEngine
|
||||||
|
func c_DeactivatePeerEngine(onion_ptr *C.char, onion_len C.int) {
|
||||||
|
DeactivatePeerEngine(C.GoStringN(onion_ptr, onion_len))
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeactivatePeerEngine(profile string) {
|
||||||
|
application.DeactivatePeerEngine(profile)
|
||||||
|
}
|
||||||
|
|
||||||
|
//export c_CreateProfile
|
||||||
|
func c_CreateProfile(nick_ptr *C.char, nick_len C.int, pass_ptr *C.char, pass_len C.int, autostart C.char) {
|
||||||
|
CreateProfile(C.GoStringN(nick_ptr, nick_len), C.GoStringN(pass_ptr, pass_len), autostart == 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateProfile(nick, pass string, autostart bool) {
|
||||||
|
autostartVal := constants2.True
|
||||||
|
if !autostart {
|
||||||
|
autostartVal = constants2.False
|
||||||
|
}
|
||||||
|
tagVal := constants.ProfileTypeV1Password
|
||||||
|
if pass == constants.DefactoPasswordForUnencryptedProfiles {
|
||||||
|
tagVal = constants.ProfileTypeV1DefaultPassword
|
||||||
|
}
|
||||||
|
|
||||||
|
application.CreatePeer(nick, pass, map[attr.ZonedPath]string{
|
||||||
|
attr.ProfileZone.ConstructZonedPath(constants2.Tag): tagVal,
|
||||||
|
attr.ProfileZone.ConstructZonedPath(constants.PeerAutostart): autostartVal,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//export c_LoadProfiles
|
//export c_LoadProfiles
|
||||||
|
@ -914,7 +945,8 @@ func DownloadFile(profileOnion string, conversationID int, filepath, manifestpat
|
||||||
log.Errorf("file sharing error: %v", err)
|
log.Errorf("file sharing error: %v", err)
|
||||||
} else {
|
} else {
|
||||||
// default to max 10 GB limit...
|
// default to max 10 GB limit...
|
||||||
fh.DownloadFile(profile, conversationID, filepath, manifestpath, filekey, files.MaxManifestSize*files.DefaultChunkSize)
|
err := fh.DownloadFile(profile, conversationID, filepath, manifestpath, filekey, files.MaxManifestSize*files.DefaultChunkSize)
|
||||||
|
log.Errorf("file sharing error: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1110,6 +1142,8 @@ func SetProfileAttribute(profileOnion string, key string, value string) {
|
||||||
// All other scopes and zones need to be added explicitly or handled by Cwtch.
|
// All other scopes and zones need to be added explicitly or handled by Cwtch.
|
||||||
if zone == attr.ProfileZone && key == constants.Name {
|
if zone == attr.ProfileZone && key == constants.Name {
|
||||||
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name, value)
|
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name, value)
|
||||||
|
} else if zone == attr.ProfileZone && key == constants.PeerAutostart {
|
||||||
|
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants.PeerAutostart, value)
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("attempted to set an attribute with an unknown zone: %v", key)
|
log.Errorf("attempted to set an attribute with an unknown zone: %v", key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,9 +84,12 @@ func (eh *EventHandler) GetNextEvent() string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// track acnStatus across events
|
||||||
|
var acnStatus = -1
|
||||||
|
|
||||||
// handleAppBusEvent enriches AppBus events so they are usable with out further data fetches
|
// handleAppBusEvent enriches AppBus events so they are usable with out further data fetches
|
||||||
func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
acnStatus := -1
|
|
||||||
if eh.app != nil {
|
if eh.app != nil {
|
||||||
switch e.EventType {
|
switch e.EventType {
|
||||||
case event.ACNStatus:
|
case event.ACNStatus:
|
||||||
|
@ -97,14 +100,17 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
if newAcnStatus == 100 {
|
if newAcnStatus == 100 {
|
||||||
if acnStatus != 100 {
|
if acnStatus != 100 {
|
||||||
// just came online
|
// just came online
|
||||||
for _, onion := range eh.app.ListProfiles() {
|
|
||||||
// launch a listen thread (internally this does a check that the protocol engine is not listening)
|
|
||||||
// and as such is safe to call.
|
|
||||||
doServers := false
|
doServers := false
|
||||||
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
|
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
|
||||||
doServers = true
|
doServers = true
|
||||||
}
|
}
|
||||||
eh.app.ActivePeerEngine(onion, true, true, doServers)
|
|
||||||
|
for _, onion := range eh.app.ListProfiles() {
|
||||||
|
profile := eh.app.GetPeer(onion)
|
||||||
|
autostart, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerAutostart)
|
||||||
|
if !exists || autostart == "true" {
|
||||||
|
eh.app.ActivatePeerEngine(onion, true, true, doServers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
eh.api.LaunchServers()
|
eh.api.LaunchServers()
|
||||||
}
|
}
|
||||||
|
@ -118,7 +124,6 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
acnStatus = newAcnStatus
|
acnStatus = newAcnStatus
|
||||||
|
|
||||||
case event.NewPeer:
|
case event.NewPeer:
|
||||||
onion := e.Data[event.Identity]
|
onion := e.Data[event.Identity]
|
||||||
profile := eh.app.GetPeer(e.Data[event.Identity])
|
profile := eh.app.GetPeer(e.Data[event.Identity])
|
||||||
|
@ -141,8 +146,9 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline, event.False)
|
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline, event.False)
|
||||||
eh.app.AddPeerPlugin(onion, plugins.CONNECTIONRETRY)
|
// disabeling network check for connection attempt reservation, needs rework
|
||||||
eh.app.AddPeerPlugin(onion, plugins.NETWORKCHECK)
|
//eh.app.AddPeerPlugin(onion, plugins.NETWORKCHECK)
|
||||||
|
eh.app.AddPeerPlugin(onion, plugins.ANTISPAM)
|
||||||
|
|
||||||
// If the user has chosen to block unknown profiles
|
// If the user has chosen to block unknown profiles
|
||||||
// then explicitly configure the protocol engine to do so..
|
// then explicitly configure the protocol engine to do so..
|
||||||
|
@ -156,14 +162,26 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
|
|
||||||
// Start up the Profile
|
// Start up the Profile
|
||||||
if acnStatus == 100 {
|
if acnStatus == 100 {
|
||||||
|
autostart, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerAutostart)
|
||||||
|
if !exists || autostart == "true" {
|
||||||
doServers := false
|
doServers := false
|
||||||
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
|
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
|
||||||
doServers = true
|
doServers = true
|
||||||
}
|
}
|
||||||
eh.app.ActivePeerEngine(onion, true, true, doServers)
|
eh.app.ActivatePeerEngine(onion, true, true, doServers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
online, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline)
|
online, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline)
|
||||||
|
e.Data["Online"] = online
|
||||||
|
|
||||||
|
autostart, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerAutostart)
|
||||||
|
// legacy profiles should autostart by default
|
||||||
|
if !exists {
|
||||||
|
autostart = "true"
|
||||||
|
}
|
||||||
|
e.Data["autostart"] = autostart
|
||||||
|
|
||||||
// Name always exists
|
// Name always exists
|
||||||
e.Data[constants.Name], _ = profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
|
e.Data[constants.Name], _ = profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
|
||||||
e.Data[constants2.DefaultProfilePicture] = RandomProfileImage(onion)
|
e.Data[constants2.DefaultProfilePicture] = RandomProfileImage(onion)
|
||||||
|
@ -173,21 +191,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
e.Data[constants2.Picture] = RandomProfileImage(onion)
|
e.Data[constants2.Picture] = RandomProfileImage(onion)
|
||||||
} else {
|
} else {
|
||||||
e.Data[constants2.Picture], _ = profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.path", key))
|
e.Data[constants2.Picture], _ = profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.path", key))
|
||||||
serializedManifest, _ := profile.GetScopedZonedAttribute(attr.ConversationScope, attr.FilesharingZone, fmt.Sprintf("%s.manifest", key))
|
|
||||||
profile.ShareFile(key, serializedManifest)
|
|
||||||
log.Debugf("Custom Profile Image: %v %s", e.Data[constants2.Picture], serializedManifest)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the profile image of the profile.
|
|
||||||
|
|
||||||
e.Data["Online"] = online
|
|
||||||
|
|
||||||
// If file sharing is enabled then reshare all active files...
|
|
||||||
fsf, err := filesharing.FunctionalityGate(settings.Experiments)
|
|
||||||
if err == nil {
|
|
||||||
fsf.ReShareFiles(profile)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct our conversations and our srever lists
|
// Construct our conversations and our srever lists
|
||||||
var contacts []Contact
|
var contacts []Contact
|
||||||
var servers []groups.Server
|
var servers []groups.Server
|
||||||
|
@ -604,6 +608,31 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
||||||
associatedGroupsJson, _ := json.Marshal(associatedGroups)
|
associatedGroupsJson, _ := json.Marshal(associatedGroups)
|
||||||
ev.Event.Data[event.Data] = string(associatedGroupsJson)
|
ev.Event.Data[event.Data] = string(associatedGroupsJson)
|
||||||
}
|
}
|
||||||
|
case event.ProtocolEngineCreated:
|
||||||
|
// TODO this code should be moved into Cwtch during the API officialization...
|
||||||
|
settings := ReadGlobalSettings()
|
||||||
|
|
||||||
|
// ensure that protocol engine respects blocking settings...
|
||||||
|
if settings.BlockUnknownConnections {
|
||||||
|
profile.BlockUnknownConnections()
|
||||||
|
} else {
|
||||||
|
profile.AllowUnknownConnections()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now that the Peer Engine is Activated, Share Files
|
||||||
|
key, exists := profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.CustomProfileImageKey)
|
||||||
|
if exists {
|
||||||
|
serializedManifest, _ := profile.GetScopedZonedAttribute(attr.ConversationScope, attr.FilesharingZone, fmt.Sprintf("%s.manifest", key))
|
||||||
|
// reset the share timestamp, currently file shares are hardcoded to expire after 30 days...
|
||||||
|
// we reset the profile image here so that it is always available.
|
||||||
|
profile.SetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.ts", key), strconv.FormatInt(time.Now().Unix(), 10))
|
||||||
|
log.Debugf("Custom Profile Image: %v %s", key, serializedManifest)
|
||||||
|
}
|
||||||
|
// If file sharing is enabled then reshare all active files...
|
||||||
|
fsf, err := filesharing.FunctionalityGate(settings.Experiments)
|
||||||
|
if err == nil {
|
||||||
|
fsf.ReShareFiles(profile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,7 +674,7 @@ func (eh *EventHandler) startHandlingPeer(onion string) {
|
||||||
eventBus.Subscribe(event.FileDownloadProgressUpdate, q)
|
eventBus.Subscribe(event.FileDownloadProgressUpdate, q)
|
||||||
eventBus.Subscribe(event.FileDownloaded, q)
|
eventBus.Subscribe(event.FileDownloaded, q)
|
||||||
eventBus.Subscribe(event.TokenManagerInfo, q)
|
eventBus.Subscribe(event.TokenManagerInfo, q)
|
||||||
|
eventBus.Subscribe(event.ProtocolEngineCreated, q)
|
||||||
go eh.forwardProfileMessages(onion, q)
|
go eh.forwardProfileMessages(onion, q)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue