Merge branch 'trunk' of git.openprivacy.ca:flutter/libcwtch-go into trunk
This commit is contained in:
commit
8837a62808
100
.drone.yml
100
.drone.yml
|
@ -10,54 +10,54 @@ steps:
|
||||||
repo: flutter/libcwtch-go
|
repo: flutter/libcwtch-go
|
||||||
branch: trunk
|
branch: trunk
|
||||||
event: [ push, pull_request ]
|
event: [ push, pull_request ]
|
||||||
|
commands:
|
||||||
|
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor
|
||||||
|
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc
|
||||||
|
- chmod a+x tor
|
||||||
|
- go get -u golang.org/x/lint/golint
|
||||||
|
- go mod vendor
|
||||||
|
- name: quality
|
||||||
|
image: golang
|
||||||
|
when:
|
||||||
|
repo: flutter/libcwtch-go
|
||||||
|
branch: trunk
|
||||||
|
event: [ push, pull_request ]
|
||||||
|
commands:
|
||||||
|
- go list ./... | xargs go vet
|
||||||
|
- go list ./... | xargs golint -set_exit_status
|
||||||
|
- name: buildLinux
|
||||||
|
image: openpriv/android-go-mobile:2021
|
||||||
|
when:
|
||||||
|
repo: flutter/libcwtch-go
|
||||||
|
branch: trunk
|
||||||
|
event: [ push, pull_request ]
|
||||||
commands:
|
commands:
|
||||||
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor
|
- make linux
|
||||||
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc
|
- name: build-androiud
|
||||||
- chmod a+x tor
|
image: openpriv/android-go-mobile:2021
|
||||||
- go get -u golang.org/x/lint/golint
|
when:
|
||||||
- go mod vendor
|
repo: flutter/libcwtch-go
|
||||||
quality:
|
branch: trunk
|
||||||
image: golang
|
event: [ push, pull_request ]
|
||||||
when:
|
commands:
|
||||||
repo: flutter/libcwtch-go
|
- make android
|
||||||
branch: trunk
|
- name: notify-email
|
||||||
event: [ push, pull_request ]
|
image: drillster/drone-email
|
||||||
commands:
|
host: build.openprivacy.ca
|
||||||
- go list ./... | xargs go vet
|
port: 25
|
||||||
- go list ./... | xargs golint -set_exit_status
|
skip_verify: true
|
||||||
build-linux:
|
from: drone@openprivacy.ca
|
||||||
image: openpriv/android-go-mobile:2021
|
when:
|
||||||
when:
|
repo: flutter/libcwtch-go
|
||||||
repo: flutter/libcwtch-go
|
branch: trunk
|
||||||
branch: trunk
|
event: [ push, pull_request ]
|
||||||
event: [ push, pull_request ]
|
status: [ failure ]
|
||||||
commands:
|
- name: notify-gogs
|
||||||
- make linux
|
image: openpriv/drone-gogs
|
||||||
build-androiud:
|
when:
|
||||||
image: openpriv/android-go-mobile:2021
|
repo: flutter/libcwtch-go
|
||||||
when:
|
branch: trunk
|
||||||
repo: flutter/libcwtch-go
|
event: pull_request
|
||||||
branch: trunk
|
status: [ success, changed, failure ]
|
||||||
event: [ push, pull_request ]
|
secrets: [gogs_account_token]
|
||||||
commands:
|
gogs_url: https://git.openprivacy.ca
|
||||||
- make android
|
|
||||||
notify-email:
|
|
||||||
image: drillster/drone-email
|
|
||||||
host: build.openprivacy.ca
|
|
||||||
port: 25
|
|
||||||
skip_verify: true
|
|
||||||
from: drone@openprivacy.ca
|
|
||||||
when:
|
|
||||||
repo: flutter/libcwtch-go
|
|
||||||
branch: trunk
|
|
||||||
event: [ push, pull_request ]
|
|
||||||
status: [ failure ]
|
|
||||||
notify-gogs:
|
|
||||||
image: openpriv/drone-gogs
|
|
||||||
when:
|
|
||||||
repo: flutter/libcwtch-go
|
|
||||||
branch: trunk
|
|
||||||
event: pull_request
|
|
||||||
status: [ success, changed, failure ]
|
|
||||||
secrets: [gogs_account_token]
|
|
||||||
gogs_url: https://git.openprivacy.ca
|
|
22
lib.go
22
lib.go
|
@ -1,4 +1,5 @@
|
||||||
//package cwtch
|
//package cwtch
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "C"
|
import "C"
|
||||||
|
@ -37,8 +38,8 @@ func c_StartCwtch(dir_c *C.char, len C.int, tor_c *C.char, torLen C.int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartCwtch(appDir string, torPath string) {
|
func StartCwtch(appDir string, torPath string) {
|
||||||
log.SetLevel(log.LevelDebug)
|
log.SetLevel(log.LevelInfo)
|
||||||
//log.ExcludeFromPattern("service.go")
|
log.ExcludeFromPattern("service.go")
|
||||||
|
|
||||||
utils.InitGlobalSettingsFile(appDir, "be gay do crime")
|
utils.InitGlobalSettingsFile(appDir, "be gay do crime")
|
||||||
|
|
||||||
|
@ -68,6 +69,7 @@ func StartCwtch(appDir string, torPath string) {
|
||||||
acnQueue = event.NewQueue()
|
acnQueue = event.NewQueue()
|
||||||
newApp.GetPrimaryBus().Subscribe(event.ACNStatus, acnQueue)
|
newApp.GetPrimaryBus().Subscribe(event.ACNStatus, acnQueue)
|
||||||
newApp.GetPrimaryBus().Subscribe(utils.UpdateGlobalSettings, acnQueue)
|
newApp.GetPrimaryBus().Subscribe(utils.UpdateGlobalSettings, acnQueue)
|
||||||
|
newApp.GetPrimaryBus().Subscribe(utils.SetLoggingLevel, acnQueue)
|
||||||
|
|
||||||
eventHandler = utils.NewEventHandler(newApp)
|
eventHandler = utils.NewEventHandler(newApp)
|
||||||
|
|
||||||
|
@ -134,6 +136,22 @@ func SendAppEvent(eventJson string) {
|
||||||
}
|
}
|
||||||
log.Debugf("New Settings %v", globalSettings)
|
log.Debugf("New Settings %v", globalSettings)
|
||||||
utils.WriteGlobalSettings(globalSettings)
|
utils.WriteGlobalSettings(globalSettings)
|
||||||
|
case utils.SetLoggingLevel:
|
||||||
|
_, warn := new_event.Data[utils.Warn]
|
||||||
|
_, error := new_event.Data[utils.Error]
|
||||||
|
_, debug := new_event.Data[utils.Debug]
|
||||||
|
_, info := new_event.Data[utils.Info]
|
||||||
|
// Assign logging level in priority order. The highest logging level wins in the
|
||||||
|
// event of multiple fields.
|
||||||
|
if info {
|
||||||
|
log.SetLevel(log.LevelInfo)
|
||||||
|
} else if warn {
|
||||||
|
log.SetLevel(log.LevelWarn)
|
||||||
|
} else if error {
|
||||||
|
log.SetLevel(log.LevelError)
|
||||||
|
} else if debug {
|
||||||
|
log.SetLevel(log.LevelDebug)
|
||||||
|
}
|
||||||
default: // do nothing
|
default: // do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
type Contact struct {
|
type Contact struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Onion string `json:"onion"`
|
Onion string `json:"onion"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Picture string `json:"picture"`
|
Picture string `json:"picture"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
}
|
}
|
||||||
cpicPath := GetPicturePath(cpic)
|
cpicPath := GetPicturePath(cpic)
|
||||||
contactInfo := profile.GetContact(contact)
|
contactInfo := profile.GetContact(contact)
|
||||||
contacts = append(contacts, Contact{Name: contactInfo.Name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath,})
|
contacts = append(contacts, Contact{Name: contactInfo.Name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath})
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes, _ := json.Marshal(contacts)
|
bytes, _ := json.Marshal(contacts)
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package utils
|
||||||
|
|
||||||
|
import "cwtch.im/cwtch/event"
|
||||||
|
|
||||||
|
// An event to set the logging level dynamically from the UI
|
||||||
|
const (
|
||||||
|
SetLoggingLevel = event.Type("SetLoggingLevel")
|
||||||
|
)
|
||||||
|
|
||||||
|
// Logging Levels as Event Fields. Note: Unlike most event we don't cae about
|
||||||
|
// the *value* of the field, only the presence. If more than one of these fields is
|
||||||
|
// present in a single SetLoggingLevel event then the highest logging level is used. INFO < WARN < ERROR < DEBUG
|
||||||
|
const (
|
||||||
|
Warn = event.Field("Warn")
|
||||||
|
Error = event.Field("Error")
|
||||||
|
Debug = event.Field("Debug")
|
||||||
|
Info = event.Field("Info")
|
||||||
|
)
|
Loading…
Reference in New Issue