From c95c29bba5fc3609efe209e5498b9a58ee666a51 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Wed, 3 Nov 2021 13:38:37 +0100 Subject: [PATCH] feat: Push messages to telemetry server when receiving messages --- VERSION | 2 +- api/geth_backend.go | 4 +- appdatabase/migrations/bindata.go | 665 ++++++++---------- ...dd_telemetry_server_url_to_settings.up.sql | 2 + cmd/statusd/main.go | 8 +- multiaccounts/accounts/database.go | 6 +- protocol/communities_messenger_test.go | 1 + protocol/messenger.go | 16 +- protocol/messenger_config.go | 9 + protocol/messenger_test.go | 1 + services/ext/service.go | 7 +- services/wakuext/api_test.go | 4 +- telemetry/client.go | 55 ++ 13 files changed, 412 insertions(+), 368 deletions(-) create mode 100644 appdatabase/migrations/sql/1635942153_add_telemetry_server_url_to_settings.up.sql create mode 100644 telemetry/client.go diff --git a/VERSION b/VERSION index 086706636..1e85434a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.89.18 +0.89.19 diff --git a/api/geth_backend.go b/api/geth_backend.go index 41d18797e..e5430fa6e 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -1116,7 +1116,7 @@ func (b *GethStatusBackend) injectAccountsIntoServices() error { st := b.statusNode.WakuExtService() if st != nil { - if err := st.InitProtocol(identity, b.appDB, b.multiaccountsDB, acc, logutils.ZapLogger()); err != nil { + if err := st.InitProtocol(b.statusNode.GethNode().Config().Name, identity, b.appDB, b.multiaccountsDB, acc, logutils.ZapLogger()); err != nil { return err } // Set initial connection state @@ -1141,7 +1141,7 @@ func (b *GethStatusBackend) injectAccountsIntoServices() error { } st := b.statusNode.WakuV2ExtService() - if err := st.InitProtocol(identity, b.appDB, b.multiaccountsDB, acc, logutils.ZapLogger()); err != nil { + if err := st.InitProtocol(b.statusNode.GethNode().Config().Name, identity, b.appDB, b.multiaccountsDB, acc, logutils.ZapLogger()); err != nil { return err } } diff --git a/appdatabase/migrations/bindata.go b/appdatabase/migrations/bindata.go index b87280e0c..fd72fe9a5 100644 --- a/appdatabase/migrations/bindata.go +++ b/appdatabase/migrations/bindata.go @@ -1,62 +1,61 @@ -// Code generated by go-bindata. DO NOT EDIT. +// Package migrations Code generated by go-bindata. (@generated) DO NOT EDIT. // sources: -// 0001_app.down.sql (356B) -// 0001_app.up.sql (2.967kB) -// 0002_tokens.down.sql (19B) -// 0002_tokens.up.sql (248B) -// 0003_settings.down.sql (118B) -// 0003_settings.up.sql (1.311kB) -// 0004_pending_stickers.down.sql (0) -// 0004_pending_stickers.up.sql (61B) -// 0005_waku_mode.down.sql (0) -// 0005_waku_mode.up.sql (146B) -// 0006_appearance.up.sql (67B) -// 0007_enable_waku_default.up.sql (38B) -// 0008_add_push_notifications.up.sql (349B) -// 0009_enable_sending_push_notifications.down.sql (49B) -// 0009_enable_sending_push_notifications.up.sql (49B) -// 0010_add_block_mentions.down.sql (83B) -// 0010_add_block_mentions.up.sql (89B) -// 0011_allow_webview_permission_requests.down.sql (0) -// 0011_allow_webview_permission_requests.up.sql (88B) -// 0012_pending_transactions.down.sql (33B) -// 0012_pending_transactions.up.sql (321B) -// 0013_favourites.down.sql (23B) -// 0013_favourites.up.sql (132B) -// 0014_add_use_mailservers.down.sql (0) -// 0014_add_use_mailservers.up.sql (111B) -// 0015_link_previews.down.sql (0) -// 0015_link_previews.up.sql (203B) -// 0016_local_notifications_preferences.down.sql (43B) -// 0016_local_notifications_preferences.up.sql (204B) -// 0017_bookmarks.down.sql (22B) -// 0017_bookmarks.up.sql (147B) -// 0018_profile_pictures_visibility.up.sql (84B) -// 0019_blocks_ranges_extra_data.up.sql (89B) -// 0020_metrics.up.sql (235B) -// 0021_add_session_id_to_metrics.up.sql (55B) -// 0022_pending_transfers.up.sql (706B) -// 1618237885_settings_anon_metrics_should_send.up.sql (80B) -// 1618395756_contacts_only.up.sql (136B) -// 1622184614_add_default_sync_period.up.sql (125B) -// 1625872445_user_status.up.sql (351B) -// 1627983977_add_gif_to_settings.up.sql (102B) -// 1628580203_add_hidden_account.up.sql (67B) -// 1629123384_add_id_to_app_metrics.up.sql (589B) -// 1630401853_add_opensea_enabled_to_settings.up.sql (70B) -// 1630464455_create-saved_addresses-table.down.sql (28B) -// 1630464455_create-saved_addresses-table.up.sql (187B) -// 1630485153_networks.down.sql (21B) -// 1630485153_networks.up.sql (394B) -// 1632262444_profile_pictures_show_to.up.sql (81B) -// doc.go (74B) - +// 0001_app.down.sql +// 0001_app.up.sql +// 0002_tokens.down.sql +// 0002_tokens.up.sql +// 0003_settings.down.sql +// 0003_settings.up.sql +// 0004_pending_stickers.down.sql +// 0004_pending_stickers.up.sql +// 0005_waku_mode.down.sql +// 0005_waku_mode.up.sql +// 0006_appearance.up.sql +// 0007_enable_waku_default.up.sql +// 0008_add_push_notifications.up.sql +// 0009_enable_sending_push_notifications.down.sql +// 0009_enable_sending_push_notifications.up.sql +// 0010_add_block_mentions.down.sql +// 0010_add_block_mentions.up.sql +// 0011_allow_webview_permission_requests.down.sql +// 0011_allow_webview_permission_requests.up.sql +// 0012_pending_transactions.down.sql +// 0012_pending_transactions.up.sql +// 0013_favourites.down.sql +// 0013_favourites.up.sql +// 0014_add_use_mailservers.down.sql +// 0014_add_use_mailservers.up.sql +// 0015_link_previews.down.sql +// 0015_link_previews.up.sql +// 0016_local_notifications_preferences.down.sql +// 0016_local_notifications_preferences.up.sql +// 0017_bookmarks.down.sql +// 0017_bookmarks.up.sql +// 0018_profile_pictures_visibility.up.sql +// 0019_blocks_ranges_extra_data.up.sql +// 0020_metrics.up.sql +// 0021_add_session_id_to_metrics.up.sql +// 0022_pending_transfers.up.sql +// 1618237885_settings_anon_metrics_should_send.up.sql +// 1618395756_contacts_only.up.sql +// 1622184614_add_default_sync_period.up.sql +// 1625872445_user_status.up.sql +// 1627983977_add_gif_to_settings.up.sql +// 1628580203_add_hidden_account.up.sql +// 1629123384_add_id_to_app_metrics.up.sql +// 1630401853_add_opensea_enabled_to_settings.up.sql +// 1630464455_create-saved_addresses-table.down.sql +// 1630464455_create-saved_addresses-table.up.sql +// 1630485153_networks.down.sql +// 1630485153_networks.up.sql +// 1632262444_profile_pictures_show_to.up.sql +// 1635942153_add_telemetry_server_url_to_settings.up.sql +// doc.go package migrations import ( "bytes" "compress/gzip" - "crypto/sha256" "fmt" "io" "io/ioutil" @@ -87,9 +86,8 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte + bytes []byte + info os.FileInfo } type bindataFileInfo struct { @@ -99,21 +97,32 @@ type bindataFileInfo struct { modTime time.Time } +// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } + +// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } + +// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } + +// ModTime return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } + +// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return false + return fi.mode&os.ModeDir != 0 } + +// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } @@ -133,8 +142,8 @@ func _0001_appDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0001_app.down.sql", size: 356, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb5, 0x25, 0xa0, 0xf8, 0x7d, 0x2d, 0xd, 0xcf, 0x18, 0xe4, 0x73, 0xc3, 0x95, 0xf5, 0x24, 0x20, 0xa9, 0xe6, 0x9e, 0x1d, 0x93, 0xe5, 0xc5, 0xad, 0x93, 0x8f, 0x5e, 0x40, 0xb5, 0x30, 0xaa, 0x25}} + info := bindataFileInfo{name: "0001_app.down.sql", size: 356, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -153,8 +162,8 @@ func _0001_appUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0001_app.up.sql", size: 2967, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf7, 0x3a, 0xa7, 0xf2, 0x8f, 0xfa, 0x82, 0x7c, 0xc5, 0x49, 0xac, 0xac, 0xf, 0xc, 0x77, 0xe2, 0xba, 0xe8, 0x4d, 0xe, 0x6f, 0x5d, 0x2c, 0x2c, 0x18, 0x80, 0xc2, 0x1d, 0xe, 0x25, 0xe, 0x18}} + info := bindataFileInfo{name: "0001_app.up.sql", size: 2967, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -173,8 +182,8 @@ func _0002_tokensDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0x31, 0x2, 0xcc, 0x2f, 0x38, 0x90, 0xf7, 0x58, 0x37, 0x47, 0xf4, 0x18, 0xf7, 0x72, 0x74, 0x67, 0x14, 0x7e, 0xf3, 0xb1, 0xd6, 0x5f, 0xb0, 0xd5, 0xe7, 0x91, 0xf4, 0x26, 0x77, 0x8e, 0x68}} + info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -193,8 +202,8 @@ func _0002_tokensUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xcc, 0xd6, 0xde, 0xd3, 0x7b, 0xee, 0x92, 0x11, 0x38, 0xa4, 0xeb, 0x84, 0xca, 0xcb, 0x37, 0x75, 0x5, 0x77, 0x7f, 0x14, 0x39, 0xee, 0xa1, 0x8b, 0xd4, 0x5c, 0x6e, 0x55, 0x6, 0x50, 0x16, 0xd4}} + info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -213,8 +222,8 @@ func _0003_settingsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe5, 0xa6, 0xf5, 0xc0, 0x60, 0x64, 0x77, 0xe2, 0xe7, 0x3c, 0x9b, 0xb1, 0x52, 0xa9, 0x95, 0x16, 0xf8, 0x60, 0x2f, 0xa5, 0xeb, 0x46, 0xb9, 0xb9, 0x8f, 0x4c, 0xf4, 0xfd, 0xbb, 0xe7, 0xe5, 0xe5}} + info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -233,8 +242,8 @@ func _0003_settingsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xea, 0x35, 0x0, 0xeb, 0xe2, 0x33, 0x68, 0xb9, 0xf4, 0xf6, 0x8e, 0x9e, 0x10, 0xe9, 0x58, 0x68, 0x28, 0xb, 0xcd, 0xec, 0x74, 0x71, 0xa7, 0x9a, 0x5a, 0x77, 0x59, 0xb1, 0x13, 0x1c, 0xa1, 0x5b}} + info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -253,8 +262,8 @@ func _0004_pending_stickersDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0004_pending_stickers.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} + info := bindataFileInfo{name: "0004_pending_stickers.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -273,8 +282,8 @@ func _0004_pending_stickersUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0004_pending_stickers.up.sql", size: 61, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3c, 0xed, 0x25, 0xdf, 0x75, 0x2, 0x6c, 0xf0, 0xa2, 0xa8, 0x37, 0x62, 0x65, 0xad, 0xfd, 0x98, 0xa0, 0x9d, 0x63, 0x94, 0xdf, 0x6b, 0x46, 0xe0, 0x68, 0xec, 0x9c, 0x7f, 0x77, 0xdd, 0xb3, 0x6}} + info := bindataFileInfo{name: "0004_pending_stickers.up.sql", size: 61, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -293,8 +302,8 @@ func _0005_waku_modeDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0005_waku_mode.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} + info := bindataFileInfo{name: "0005_waku_mode.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -313,8 +322,8 @@ func _0005_waku_modeUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0005_waku_mode.up.sql", size: 146, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa6, 0x91, 0xc, 0xd7, 0x89, 0x61, 0x2e, 0x4c, 0x5a, 0xb6, 0x67, 0xd1, 0xc1, 0x42, 0x24, 0x38, 0xd6, 0x1b, 0x75, 0x41, 0x9c, 0x23, 0xb0, 0xca, 0x5c, 0xf1, 0x5c, 0xd0, 0x13, 0x92, 0x3e, 0xe1}} + info := bindataFileInfo{name: "0005_waku_mode.up.sql", size: 146, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -333,8 +342,8 @@ func _0006_appearanceUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xae, 0x6, 0x25, 0x6c, 0xe4, 0x9d, 0xa7, 0x72, 0xe8, 0xbc, 0xe4, 0x1f, 0x1e, 0x2d, 0x7c, 0xb7, 0xf6, 0xa3, 0xec, 0x3b, 0x4e, 0x93, 0x2e, 0xa4, 0xec, 0x6f, 0xe5, 0x95, 0x94, 0xe8, 0x4, 0xfb}} + info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -353,8 +362,8 @@ func _0007_enable_waku_defaultUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0007_enable_waku_default.up.sql", size: 38, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd4, 0x42, 0xb6, 0xe5, 0x48, 0x41, 0xeb, 0xc0, 0x7e, 0x3b, 0xe6, 0x8e, 0x96, 0x33, 0x20, 0x92, 0x24, 0x5a, 0x60, 0xfa, 0xa0, 0x3, 0x5e, 0x76, 0x4b, 0x89, 0xaa, 0x37, 0x66, 0xbc, 0x26, 0x11}} + info := bindataFileInfo{name: "0007_enable_waku_default.up.sql", size: 38, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -373,8 +382,8 @@ func _0008_add_push_notificationsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0008_add_push_notifications.up.sql", size: 349, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5a, 0x0, 0xbf, 0xd0, 0xdd, 0xcd, 0x73, 0xe0, 0x7c, 0x56, 0xef, 0xdc, 0x57, 0x61, 0x94, 0x64, 0x70, 0xb9, 0xfa, 0xa1, 0x2a, 0x36, 0xc, 0x2f, 0xf8, 0x95, 0xa, 0x57, 0x3e, 0x7a, 0xd7, 0x12}} + info := bindataFileInfo{name: "0008_add_push_notifications.up.sql", size: 349, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -393,8 +402,8 @@ func _0009_enable_sending_push_notificationsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0009_enable_sending_push_notifications.down.sql", size: 49, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe9, 0xae, 0x1b, 0x41, 0xcb, 0x9c, 0x2c, 0x93, 0xc6, 0x2a, 0x77, 0x3, 0xb9, 0x51, 0xe0, 0x68, 0x68, 0x0, 0xf7, 0x5b, 0xb3, 0x1e, 0x94, 0x44, 0xba, 0x9c, 0xd0, 0x3b, 0x80, 0x21, 0x6f, 0xb5}} + info := bindataFileInfo{name: "0009_enable_sending_push_notifications.down.sql", size: 49, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -413,8 +422,8 @@ func _0009_enable_sending_push_notificationsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0009_enable_sending_push_notifications.up.sql", size: 49, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1b, 0x80, 0xe4, 0x9c, 0xc8, 0xb8, 0xd5, 0xef, 0xce, 0x74, 0x9b, 0x7b, 0xdd, 0xa, 0x99, 0x1e, 0xef, 0x7f, 0xb8, 0x99, 0x84, 0x4, 0x0, 0x6b, 0x1d, 0x2c, 0xa, 0xf8, 0x2c, 0x4f, 0xb5, 0x44}} + info := bindataFileInfo{name: "0009_enable_sending_push_notifications.up.sql", size: 49, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -433,8 +442,8 @@ func _0010_add_block_mentionsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0010_add_block_mentions.down.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6d, 0x9e, 0x27, 0x1e, 0xba, 0x9f, 0xca, 0xae, 0x98, 0x2e, 0x6e, 0xe3, 0xdd, 0xac, 0x73, 0x34, 0x4e, 0x69, 0x92, 0xb5, 0xf6, 0x9, 0xab, 0x50, 0x35, 0xd, 0xee, 0xeb, 0x3e, 0xcc, 0x7e, 0xce}} + info := bindataFileInfo{name: "0010_add_block_mentions.down.sql", size: 83, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -453,8 +462,8 @@ func _0010_add_block_mentionsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0010_add_block_mentions.up.sql", size: 89, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd7, 0x23, 0x85, 0xa2, 0xb5, 0xb6, 0xb4, 0x3f, 0xdc, 0x4e, 0xff, 0xe2, 0x6b, 0x66, 0x68, 0x5e, 0xb2, 0xb4, 0x14, 0xb2, 0x1b, 0x4d, 0xb1, 0xce, 0xf7, 0x6, 0x58, 0xa7, 0xaf, 0x93, 0x3f, 0x25}} + info := bindataFileInfo{name: "0010_add_block_mentions.up.sql", size: 89, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -473,8 +482,8 @@ func _0011_allow_webview_permission_requestsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0011_allow_webview_permission_requests.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} + info := bindataFileInfo{name: "0011_allow_webview_permission_requests.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -493,8 +502,8 @@ func _0011_allow_webview_permission_requestsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0011_allow_webview_permission_requests.up.sql", size: 88, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x43, 0x5f, 0x22, 0x4c, 0x98, 0x1d, 0xc6, 0xf4, 0x89, 0xaf, 0xf4, 0x44, 0xba, 0xf8, 0x28, 0xa7, 0xb5, 0xb9, 0xf0, 0xf2, 0xcb, 0x5, 0x59, 0x7a, 0xc, 0xdf, 0xd3, 0x38, 0xa4, 0xb8, 0x98, 0xc2}} + info := bindataFileInfo{name: "0011_allow_webview_permission_requests.up.sql", size: 88, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -513,8 +522,8 @@ func _0012_pending_transactionsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0012_pending_transactions.down.sql", size: 33, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7e, 0x41, 0xfe, 0x5c, 0xd8, 0xc3, 0x29, 0xfd, 0x31, 0x78, 0x99, 0x7a, 0xeb, 0x17, 0x62, 0x88, 0x41, 0xb3, 0xe7, 0xb5, 0x5, 0x0, 0x90, 0xa1, 0x7, 0x1a, 0x23, 0x88, 0x81, 0xba, 0x56, 0x9d}} + info := bindataFileInfo{name: "0012_pending_transactions.down.sql", size: 33, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -533,8 +542,8 @@ func _0012_pending_transactionsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0012_pending_transactions.up.sql", size: 321, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd, 0x17, 0xff, 0xd7, 0xa7, 0x49, 0x1e, 0x7b, 0x34, 0x63, 0x7c, 0x53, 0xaa, 0x6b, 0x2d, 0xc8, 0xe0, 0x82, 0x21, 0x90, 0x3a, 0x94, 0xf1, 0xa6, 0xe4, 0x70, 0xe5, 0x85, 0x1a, 0x48, 0x25, 0xb}} + info := bindataFileInfo{name: "0012_pending_transactions.up.sql", size: 321, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -553,8 +562,8 @@ func _0013_favouritesDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0013_favourites.down.sql", size: 23, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x32, 0xf8, 0x55, 0x13, 0x4f, 0x4a, 0x19, 0x83, 0x9c, 0xda, 0x34, 0xb8, 0x3, 0x54, 0x82, 0x1e, 0x99, 0x36, 0x6b, 0x42, 0x3, 0xf6, 0x43, 0xde, 0xe6, 0x32, 0xb6, 0xdf, 0xe2, 0x59, 0x8c, 0x84}} + info := bindataFileInfo{name: "0013_favourites.down.sql", size: 23, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -573,8 +582,8 @@ func _0013_favouritesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0013_favourites.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbe, 0x1, 0x27, 0x38, 0x76, 0xf5, 0xcb, 0x61, 0xda, 0x5b, 0xce, 0xd9, 0x8b, 0x18, 0x77, 0x61, 0x84, 0xe7, 0x22, 0xe2, 0x13, 0x99, 0xab, 0x32, 0xbc, 0xbe, 0xed, 0x1f, 0x2f, 0xb0, 0xe4, 0x8d}} + info := bindataFileInfo{name: "0013_favourites.up.sql", size: 132, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -593,8 +602,8 @@ func _0014_add_use_mailserversDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0014_add_use_mailservers.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} + info := bindataFileInfo{name: "0014_add_use_mailservers.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -613,8 +622,8 @@ func _0014_add_use_mailserversUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0014_add_use_mailservers.up.sql", size: 111, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc9, 0xba, 0x65, 0xbf, 0x1b, 0xc9, 0x6d, 0x45, 0xf2, 0xf5, 0x30, 0x7c, 0xc1, 0xde, 0xb8, 0xe3, 0x3f, 0xa9, 0x2f, 0x9f, 0xea, 0x1, 0x29, 0x29, 0x65, 0xe7, 0x38, 0xab, 0xa4, 0x62, 0xf, 0xd0}} + info := bindataFileInfo{name: "0014_add_use_mailservers.up.sql", size: 111, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -633,8 +642,8 @@ func _0015_link_previewsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0015_link_previews.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} + info := bindataFileInfo{name: "0015_link_previews.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -653,8 +662,8 @@ func _0015_link_previewsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0015_link_previews.up.sql", size: 203, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb1, 0xf7, 0x38, 0x25, 0xa6, 0xfc, 0x6b, 0x9, 0xe4, 0xd9, 0xbf, 0x58, 0x7b, 0x80, 0xd8, 0x48, 0x63, 0xde, 0xa5, 0x5e, 0x30, 0xa3, 0xeb, 0x68, 0x8e, 0x6a, 0x9f, 0xfd, 0xf4, 0x46, 0x41, 0x34}} + info := bindataFileInfo{name: "0015_link_previews.up.sql", size: 203, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -673,8 +682,8 @@ func _0016_local_notifications_preferencesDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0016_local_notifications_preferences.down.sql", size: 43, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe0, 0x50, 0xc7, 0xdd, 0x53, 0x9c, 0x5d, 0x1e, 0xb5, 0x71, 0x25, 0x50, 0x58, 0xcf, 0x6d, 0xbe, 0x5a, 0x8, 0x12, 0xc9, 0x13, 0xd, 0x9a, 0x3d, 0x4b, 0x7a, 0x2f, 0x1b, 0xe5, 0x23, 0x52, 0x78}} + info := bindataFileInfo{name: "0016_local_notifications_preferences.down.sql", size: 43, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -693,8 +702,8 @@ func _0016_local_notifications_preferencesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0016_local_notifications_preferences.up.sql", size: 204, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3f, 0x3a, 0x16, 0x25, 0xdf, 0xba, 0x62, 0xd3, 0x81, 0x73, 0xc, 0x10, 0x85, 0xbc, 0x8d, 0xe, 0x1d, 0x62, 0xcb, 0xb, 0x6d, 0x8c, 0x4f, 0x63, 0x5f, 0xe2, 0xd, 0xc5, 0x46, 0xa8, 0x35, 0x5b}} + info := bindataFileInfo{name: "0016_local_notifications_preferences.up.sql", size: 204, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -713,8 +722,8 @@ func _0017_bookmarksDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0017_bookmarks.down.sql", size: 22, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9a, 0x13, 0x2a, 0x44, 0xb0, 0x3, 0x18, 0x63, 0xb8, 0x33, 0xda, 0x3a, 0xeb, 0xb8, 0xcb, 0xd1, 0x98, 0x29, 0xa7, 0xf0, 0x6, 0x9d, 0xc9, 0x62, 0xe7, 0x89, 0x7f, 0x77, 0xaf, 0xec, 0x6b, 0x8f}} + info := bindataFileInfo{name: "0017_bookmarks.down.sql", size: 22, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -733,8 +742,8 @@ func _0017_bookmarksUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0017_bookmarks.up.sql", size: 147, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbc, 0x47, 0xe1, 0xe3, 0xd8, 0xc6, 0x4, 0x6d, 0x5f, 0x2f, 0xa, 0x51, 0xa6, 0x8c, 0x6a, 0xe0, 0x3d, 0x8c, 0x91, 0x47, 0xbc, 0x1, 0x75, 0x46, 0x92, 0x2, 0x18, 0x6e, 0xe3, 0x4f, 0x18, 0x57}} + info := bindataFileInfo{name: "0017_bookmarks.up.sql", size: 147, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -753,8 +762,8 @@ func _0018_profile_pictures_visibilityUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0018_profile_pictures_visibility.up.sql", size: 84, mode: os.FileMode(0644), modTime: time.Unix(1611563400, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc9, 0xe3, 0xc5, 0xec, 0x83, 0x55, 0x45, 0x57, 0x7a, 0xaa, 0xd2, 0xa7, 0x59, 0xa7, 0x87, 0xef, 0x63, 0x19, 0x9c, 0x46, 0x9c, 0xc5, 0x32, 0x89, 0xa4, 0x68, 0x70, 0xd8, 0x83, 0x43, 0xa4, 0x72}} + info := bindataFileInfo{name: "0018_profile_pictures_visibility.up.sql", size: 84, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -773,8 +782,8 @@ func _0019_blocks_ranges_extra_dataUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0019_blocks_ranges_extra_data.up.sql", size: 89, mode: os.FileMode(0644), modTime: time.Unix(1615818452, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa3, 0x96, 0x32, 0x58, 0xf0, 0xb9, 0xe1, 0x70, 0x81, 0xca, 0x8d, 0x45, 0x57, 0x8a, 0x7, 0x5d, 0x9e, 0x2a, 0x30, 0xb, 0xad, 0x5f, 0xf8, 0xd4, 0x30, 0x94, 0x73, 0x37, 0x8d, 0xc1, 0x9a, 0xed}} + info := bindataFileInfo{name: "0019_blocks_ranges_extra_data.up.sql", size: 89, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -793,8 +802,8 @@ func _0020_metricsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0020_metrics.up.sql", size: 235, mode: os.FileMode(0644), modTime: time.Unix(1616080546, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe8, 0x32, 0xbc, 0xb6, 0x9b, 0x5a, 0x8f, 0x9f, 0x4c, 0x90, 0x81, 0x3e, 0x2e, 0xd1, 0x23, 0xcd, 0xf1, 0x83, 0x35, 0xca, 0x66, 0x87, 0x52, 0x4e, 0x30, 0x3e, 0x4f, 0xa8, 0xfd, 0x30, 0x16, 0xbd}} + info := bindataFileInfo{name: "0020_metrics.up.sql", size: 235, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -813,8 +822,8 @@ func _0021_add_session_id_to_metricsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0021_add_session_id_to_metrics.up.sql", size: 55, mode: os.FileMode(0644), modTime: time.Unix(1618308307, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb7, 0x81, 0xfc, 0x97, 0xd1, 0x8b, 0xea, 0x8e, 0xd7, 0xc2, 0x53, 0x62, 0xe9, 0xbc, 0xf, 0x8c, 0x46, 0x41, 0x41, 0xb7, 0x6, 0x35, 0xf5, 0xba, 0xbb, 0x28, 0x50, 0x48, 0xbf, 0x36, 0x90, 0x5c}} + info := bindataFileInfo{name: "0021_add_session_id_to_metrics.up.sql", size: 55, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -833,8 +842,8 @@ func _0022_pending_transfersUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0022_pending_transfers.up.sql", size: 706, mode: os.FileMode(0644), modTime: time.Unix(1619191989, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6a, 0x9, 0xe6, 0x6, 0xae, 0x60, 0xdd, 0xbb, 0x76, 0xac, 0xe0, 0x57, 0x30, 0x67, 0x37, 0x93, 0x40, 0x13, 0xec, 0xf2, 0x6e, 0x61, 0xa, 0x14, 0xb2, 0xb1, 0xbd, 0x91, 0xf8, 0x89, 0xb3, 0xe3}} + info := bindataFileInfo{name: "0022_pending_transfers.up.sql", size: 706, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -853,8 +862,8 @@ func _1618237885_settings_anon_metrics_should_sendUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1618237885_settings_anon_metrics_should_send.up.sql", size: 80, mode: os.FileMode(0644), modTime: time.Unix(1618475496, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xea, 0x6c, 0x1d, 0x1f, 0x54, 0x62, 0x18, 0x22, 0x5c, 0xa7, 0x8c, 0x59, 0x24, 0xd3, 0x4d, 0x55, 0xc4, 0x2a, 0x9e, 0x4c, 0x37, 0x6b, 0xfd, 0xac, 0xec, 0xb7, 0x68, 0x21, 0x26, 0x26, 0xf3, 0x92}} + info := bindataFileInfo{name: "1618237885_settings_anon_metrics_should_send.up.sql", size: 80, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -873,8 +882,8 @@ func _1618395756_contacts_onlyUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1618395756_contacts_only.up.sql", size: 136, mode: os.FileMode(0644), modTime: time.Unix(1618824585, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1, 0xe3, 0xd0, 0xe7, 0xf2, 0x6e, 0xbf, 0x27, 0xf6, 0xe2, 0x2e, 0x16, 0x4b, 0x52, 0x3b, 0xcf, 0x63, 0x52, 0xfc, 0x1d, 0x43, 0xba, 0x42, 0xf9, 0x1e, 0x1e, 0x39, 0x40, 0xed, 0x0, 0x20, 0xa8}} + info := bindataFileInfo{name: "1618395756_contacts_only.up.sql", size: 136, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -893,8 +902,8 @@ func _1622184614_add_default_sync_periodUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1622184614_add_default_sync_period.up.sql", size: 125, mode: os.FileMode(0644), modTime: time.Unix(1623420243, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x60, 0x39, 0xeb, 0x8f, 0xdc, 0x1, 0x56, 0xc1, 0x9b, 0xaa, 0xda, 0x44, 0xe0, 0xdb, 0xda, 0x2c, 0xe7, 0x71, 0x8d, 0xbc, 0xc1, 0x9a, 0x4f, 0x48, 0xe0, 0x5e, 0x81, 0x1e, 0x8e, 0x6a, 0x4d, 0x3}} + info := bindataFileInfo{name: "1622184614_add_default_sync_period.up.sql", size: 125, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -913,8 +922,8 @@ func _1625872445_user_statusUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1625872445_user_status.up.sql", size: 351, mode: os.FileMode(0644), modTime: time.Unix(1628358701, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf5, 0xa, 0xfe, 0x7a, 0xcc, 0x9e, 0x35, 0x26, 0xb, 0xc8, 0xf2, 0x7d, 0xfa, 0x4b, 0xcf, 0x53, 0x20, 0x76, 0xc7, 0xd, 0xbc, 0x78, 0x4f, 0x74, 0x2d, 0x2e, 0x2e, 0x7e, 0x62, 0xae, 0x78, 0x1f}} + info := bindataFileInfo{name: "1625872445_user_status.up.sql", size: 351, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -933,8 +942,8 @@ func _1627983977_add_gif_to_settingsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1627983977_add_gif_to_settings.up.sql", size: 102, mode: os.FileMode(0644), modTime: time.Unix(1628585229, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x63, 0xe6, 0xe1, 0x97, 0x64, 0x4c, 0xe2, 0x14, 0xb1, 0x96, 0x3a, 0xb0, 0xb9, 0xb7, 0xb5, 0x78, 0x4a, 0x39, 0x69, 0x89, 0xb7, 0x89, 0x19, 0xb8, 0x89, 0x1, 0xc5, 0xc2, 0x85, 0x53, 0xe2, 0x83}} + info := bindataFileInfo{name: "1627983977_add_gif_to_settings.up.sql", size: 102, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -953,8 +962,8 @@ func _1628580203_add_hidden_accountUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1628580203_add_hidden_account.up.sql", size: 67, mode: os.FileMode(0644), modTime: time.Unix(1629274485, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xcb, 0x30, 0xf1, 0xd4, 0x60, 0xe2, 0x28, 0x14, 0xcb, 0x16, 0xb, 0x9, 0xea, 0x17, 0xa, 0x9e, 0x89, 0xa8, 0x32, 0x32, 0xf8, 0x4d, 0xa0, 0xe1, 0xe5, 0x79, 0xbd, 0x7d, 0x79, 0xe9, 0x4c, 0x9e}} + info := bindataFileInfo{name: "1628580203_add_hidden_account.up.sql", size: 67, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -973,8 +982,8 @@ func _1629123384_add_id_to_app_metricsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1629123384_add_id_to_app_metrics.up.sql", size: 589, mode: os.FileMode(0644), modTime: time.Unix(1630503875, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdf, 0x66, 0xc0, 0x69, 0xb, 0xad, 0x49, 0x7c, 0x8c, 0x67, 0xb8, 0xd6, 0x8d, 0x5d, 0x86, 0x1f, 0xa4, 0x53, 0xf5, 0x8, 0x1, 0xfd, 0x38, 0x49, 0xee, 0x84, 0xc0, 0xd8, 0x17, 0x72, 0x3, 0xb3}} + info := bindataFileInfo{name: "1629123384_add_id_to_app_metrics.up.sql", size: 589, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -993,8 +1002,8 @@ func _1630401853_add_opensea_enabled_to_settingsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1630401853_add_opensea_enabled_to_settings.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1630657596, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6, 0x91, 0x86, 0x15, 0xc8, 0x99, 0xe3, 0xae, 0xa, 0x6e, 0x94, 0x48, 0x51, 0x5b, 0x18, 0xe0, 0xbc, 0xaf, 0x34, 0x75, 0x55, 0x61, 0xd4, 0xc1, 0x85, 0xc7, 0x3d, 0x99, 0x9e, 0x1f, 0x37, 0x56}} + info := bindataFileInfo{name: "1630401853_add_opensea_enabled_to_settings.up.sql", size: 70, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1013,8 +1022,8 @@ func _1630464455_createSaved_addressesTableDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1630464455_create-saved_addresses-table.down.sql", size: 28, mode: os.FileMode(0644), modTime: time.Unix(1631531422, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x23, 0x52, 0x39, 0xb5, 0x42, 0xac, 0xcb, 0xa1, 0x44, 0xb7, 0x94, 0x26, 0x24, 0xb2, 0x12, 0xc, 0xc5, 0xbf, 0x63, 0x13, 0x6f, 0x3c, 0x4, 0x7b, 0xf0, 0xd, 0xfa, 0x55, 0x9e, 0x51, 0xf9, 0x7a}} + info := bindataFileInfo{name: "1630464455_create-saved_addresses-table.down.sql", size: 28, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1033,8 +1042,8 @@ func _1630464455_createSaved_addressesTableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1630464455_create-saved_addresses-table.up.sql", size: 187, mode: os.FileMode(0644), modTime: time.Unix(1631531422, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x32, 0xf, 0x56, 0x18, 0xeb, 0x4e, 0xac, 0xd8, 0xd6, 0x91, 0xae, 0x83, 0xcf, 0x91, 0x9e, 0x4, 0x4b, 0x2, 0x1f, 0x6d, 0xba, 0xf6, 0x3, 0xf2, 0x98, 0x72, 0xf6, 0x91, 0x29, 0x96, 0x0, 0x35}} + info := bindataFileInfo{name: "1630464455_create-saved_addresses-table.up.sql", size: 187, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1053,8 +1062,8 @@ func _1630485153_networksDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1630485153_networks.down.sql", size: 21, mode: os.FileMode(0644), modTime: time.Unix(1631531422, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbb, 0x3e, 0x57, 0xb7, 0xf7, 0x8, 0xbd, 0xb5, 0xc2, 0xea, 0xc, 0x45, 0xb7, 0x7, 0x9, 0xca, 0xe7, 0x48, 0x7e, 0x56, 0x4e, 0x44, 0x78, 0x8e, 0xe3, 0x87, 0x63, 0xaf, 0x16, 0x3f, 0xf9, 0x71}} + info := bindataFileInfo{name: "1630485153_networks.down.sql", size: 21, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1073,8 +1082,8 @@ func _1630485153_networksUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1630485153_networks.up.sql", size: 394, mode: os.FileMode(0644), modTime: time.Unix(1631531422, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0x9, 0x1d, 0x3, 0x86, 0xbd, 0xc5, 0xde, 0x3c, 0x1b, 0x40, 0x41, 0x7c, 0x61, 0x8, 0x80, 0x53, 0x87, 0x1b, 0x5a, 0x56, 0xd, 0x88, 0x1d, 0x60, 0x24, 0xce, 0x7b, 0x8f, 0xff, 0xaf, 0x36}} + info := bindataFileInfo{name: "1630485153_networks.up.sql", size: 394, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1093,8 +1102,28 @@ func _1632262444_profile_pictures_show_toUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1632262444_profile_pictures_show_to.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1633515512, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc3, 0xa2, 0x5a, 0x94, 0xde, 0x86, 0x2a, 0x29, 0xf5, 0xb3, 0x36, 0xe7, 0x53, 0x81, 0x55, 0xc9, 0xb5, 0xc3, 0xf4, 0x8c, 0x65, 0x2c, 0x4c, 0x48, 0xfd, 0x3c, 0xb7, 0x14, 0xb4, 0xea, 0x7a, 0x13}} + info := bindataFileInfo{name: "1632262444_profile_pictures_show_to.up.sql", size: 81, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __1635942153_add_telemetry_server_url_to_settingsUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xcc\xb1\x0a\xc2\x40\x0c\x06\xe0\xdd\xa7\xf8\xe9\x6b\x88\x43\xec\x45\x1c\xe2\x55\xce\xc4\xb5\x53\x10\xa1\x3a\xe4\xa2\xe0\xdb\x8b\x9b\x43\xf7\x8f\x8f\x44\xb9\x41\x69\x2f\x8c\xee\x99\xf7\xe7\xad\x83\x4a\xc1\x38\x89\x9d\x2a\xd2\x17\x7f\x78\xc6\x67\xee\x1e\x6f\x8f\xf9\x15\x0b\xae\xd4\xc6\x23\x35\xd4\x49\x51\x4d\x04\x85\x0f\x64\xa2\x18\x86\xed\xc6\xce\x85\xf4\x2f\xbb\xb0\xae\x2f\xbb\x1f\xff\x06\x00\x00\xff\xff\xfb\x7a\x10\xdd\x80\x00\x00\x00") + +func _1635942153_add_telemetry_server_url_to_settingsUpSqlBytes() ([]byte, error) { + return bindataRead( + __1635942153_add_telemetry_server_url_to_settingsUpSql, + "1635942153_add_telemetry_server_url_to_settings.up.sql", + ) +} + +func _1635942153_add_telemetry_server_url_to_settingsUpSql() (*asset, error) { + bytes, err := _1635942153_add_telemetry_server_url_to_settingsUpSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "1635942153_add_telemetry_server_url_to_settings.up.sql", size: 128, mode: os.FileMode(436), modTime: time.Unix(1636370813, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1113,8 +1142,8 @@ func docGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1607354881, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}} + info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(436), modTime: time.Unix(1636032164, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -1122,8 +1151,8 @@ func docGo() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -1133,12 +1162,6 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -1150,18 +1173,12 @@ func MustAsset(name string) []byte { return a } -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -1171,33 +1188,6 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -1209,105 +1199,57 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "0001_app.down.sql": _0001_appDownSql, - - "0001_app.up.sql": _0001_appUpSql, - - "0002_tokens.down.sql": _0002_tokensDownSql, - - "0002_tokens.up.sql": _0002_tokensUpSql, - - "0003_settings.down.sql": _0003_settingsDownSql, - - "0003_settings.up.sql": _0003_settingsUpSql, - - "0004_pending_stickers.down.sql": _0004_pending_stickersDownSql, - - "0004_pending_stickers.up.sql": _0004_pending_stickersUpSql, - - "0005_waku_mode.down.sql": _0005_waku_modeDownSql, - - "0005_waku_mode.up.sql": _0005_waku_modeUpSql, - - "0006_appearance.up.sql": _0006_appearanceUpSql, - - "0007_enable_waku_default.up.sql": _0007_enable_waku_defaultUpSql, - - "0008_add_push_notifications.up.sql": _0008_add_push_notificationsUpSql, - - "0009_enable_sending_push_notifications.down.sql": _0009_enable_sending_push_notificationsDownSql, - - "0009_enable_sending_push_notifications.up.sql": _0009_enable_sending_push_notificationsUpSql, - - "0010_add_block_mentions.down.sql": _0010_add_block_mentionsDownSql, - - "0010_add_block_mentions.up.sql": _0010_add_block_mentionsUpSql, - - "0011_allow_webview_permission_requests.down.sql": _0011_allow_webview_permission_requestsDownSql, - - "0011_allow_webview_permission_requests.up.sql": _0011_allow_webview_permission_requestsUpSql, - - "0012_pending_transactions.down.sql": _0012_pending_transactionsDownSql, - - "0012_pending_transactions.up.sql": _0012_pending_transactionsUpSql, - - "0013_favourites.down.sql": _0013_favouritesDownSql, - - "0013_favourites.up.sql": _0013_favouritesUpSql, - - "0014_add_use_mailservers.down.sql": _0014_add_use_mailserversDownSql, - - "0014_add_use_mailservers.up.sql": _0014_add_use_mailserversUpSql, - - "0015_link_previews.down.sql": _0015_link_previewsDownSql, - - "0015_link_previews.up.sql": _0015_link_previewsUpSql, - - "0016_local_notifications_preferences.down.sql": _0016_local_notifications_preferencesDownSql, - - "0016_local_notifications_preferences.up.sql": _0016_local_notifications_preferencesUpSql, - - "0017_bookmarks.down.sql": _0017_bookmarksDownSql, - - "0017_bookmarks.up.sql": _0017_bookmarksUpSql, - - "0018_profile_pictures_visibility.up.sql": _0018_profile_pictures_visibilityUpSql, - - "0019_blocks_ranges_extra_data.up.sql": _0019_blocks_ranges_extra_dataUpSql, - - "0020_metrics.up.sql": _0020_metricsUpSql, - - "0021_add_session_id_to_metrics.up.sql": _0021_add_session_id_to_metricsUpSql, - - "0022_pending_transfers.up.sql": _0022_pending_transfersUpSql, - - "1618237885_settings_anon_metrics_should_send.up.sql": _1618237885_settings_anon_metrics_should_sendUpSql, - - "1618395756_contacts_only.up.sql": _1618395756_contacts_onlyUpSql, - - "1622184614_add_default_sync_period.up.sql": _1622184614_add_default_sync_periodUpSql, - - "1625872445_user_status.up.sql": _1625872445_user_statusUpSql, - - "1627983977_add_gif_to_settings.up.sql": _1627983977_add_gif_to_settingsUpSql, - - "1628580203_add_hidden_account.up.sql": _1628580203_add_hidden_accountUpSql, - - "1629123384_add_id_to_app_metrics.up.sql": _1629123384_add_id_to_app_metricsUpSql, - - "1630401853_add_opensea_enabled_to_settings.up.sql": _1630401853_add_opensea_enabled_to_settingsUpSql, - - "1630464455_create-saved_addresses-table.down.sql": _1630464455_createSaved_addressesTableDownSql, - - "1630464455_create-saved_addresses-table.up.sql": _1630464455_createSaved_addressesTableUpSql, - - "1630485153_networks.down.sql": _1630485153_networksDownSql, - - "1630485153_networks.up.sql": _1630485153_networksUpSql, - - "1632262444_profile_pictures_show_to.up.sql": _1632262444_profile_pictures_show_toUpSql, - - "doc.go": docGo, + "0001_app.down.sql": _0001_appDownSql, + "0001_app.up.sql": _0001_appUpSql, + "0002_tokens.down.sql": _0002_tokensDownSql, + "0002_tokens.up.sql": _0002_tokensUpSql, + "0003_settings.down.sql": _0003_settingsDownSql, + "0003_settings.up.sql": _0003_settingsUpSql, + "0004_pending_stickers.down.sql": _0004_pending_stickersDownSql, + "0004_pending_stickers.up.sql": _0004_pending_stickersUpSql, + "0005_waku_mode.down.sql": _0005_waku_modeDownSql, + "0005_waku_mode.up.sql": _0005_waku_modeUpSql, + "0006_appearance.up.sql": _0006_appearanceUpSql, + "0007_enable_waku_default.up.sql": _0007_enable_waku_defaultUpSql, + "0008_add_push_notifications.up.sql": _0008_add_push_notificationsUpSql, + "0009_enable_sending_push_notifications.down.sql": _0009_enable_sending_push_notificationsDownSql, + "0009_enable_sending_push_notifications.up.sql": _0009_enable_sending_push_notificationsUpSql, + "0010_add_block_mentions.down.sql": _0010_add_block_mentionsDownSql, + "0010_add_block_mentions.up.sql": _0010_add_block_mentionsUpSql, + "0011_allow_webview_permission_requests.down.sql": _0011_allow_webview_permission_requestsDownSql, + "0011_allow_webview_permission_requests.up.sql": _0011_allow_webview_permission_requestsUpSql, + "0012_pending_transactions.down.sql": _0012_pending_transactionsDownSql, + "0012_pending_transactions.up.sql": _0012_pending_transactionsUpSql, + "0013_favourites.down.sql": _0013_favouritesDownSql, + "0013_favourites.up.sql": _0013_favouritesUpSql, + "0014_add_use_mailservers.down.sql": _0014_add_use_mailserversDownSql, + "0014_add_use_mailservers.up.sql": _0014_add_use_mailserversUpSql, + "0015_link_previews.down.sql": _0015_link_previewsDownSql, + "0015_link_previews.up.sql": _0015_link_previewsUpSql, + "0016_local_notifications_preferences.down.sql": _0016_local_notifications_preferencesDownSql, + "0016_local_notifications_preferences.up.sql": _0016_local_notifications_preferencesUpSql, + "0017_bookmarks.down.sql": _0017_bookmarksDownSql, + "0017_bookmarks.up.sql": _0017_bookmarksUpSql, + "0018_profile_pictures_visibility.up.sql": _0018_profile_pictures_visibilityUpSql, + "0019_blocks_ranges_extra_data.up.sql": _0019_blocks_ranges_extra_dataUpSql, + "0020_metrics.up.sql": _0020_metricsUpSql, + "0021_add_session_id_to_metrics.up.sql": _0021_add_session_id_to_metricsUpSql, + "0022_pending_transfers.up.sql": _0022_pending_transfersUpSql, + "1618237885_settings_anon_metrics_should_send.up.sql": _1618237885_settings_anon_metrics_should_sendUpSql, + "1618395756_contacts_only.up.sql": _1618395756_contacts_onlyUpSql, + "1622184614_add_default_sync_period.up.sql": _1622184614_add_default_sync_periodUpSql, + "1625872445_user_status.up.sql": _1625872445_user_statusUpSql, + "1627983977_add_gif_to_settings.up.sql": _1627983977_add_gif_to_settingsUpSql, + "1628580203_add_hidden_account.up.sql": _1628580203_add_hidden_accountUpSql, + "1629123384_add_id_to_app_metrics.up.sql": _1629123384_add_id_to_app_metricsUpSql, + "1630401853_add_opensea_enabled_to_settings.up.sql": _1630401853_add_opensea_enabled_to_settingsUpSql, + "1630464455_create-saved_addresses-table.down.sql": _1630464455_createSaved_addressesTableDownSql, + "1630464455_create-saved_addresses-table.up.sql": _1630464455_createSaved_addressesTableUpSql, + "1630485153_networks.down.sql": _1630485153_networksDownSql, + "1630485153_networks.up.sql": _1630485153_networksUpSql, + "1632262444_profile_pictures_show_to.up.sql": _1632262444_profile_pictures_show_toUpSql, + "1635942153_add_telemetry_server_url_to_settings.up.sql": _1635942153_add_telemetry_server_url_to_settingsUpSql, + "doc.go": docGo, } // AssetDir returns the file names below a certain @@ -1319,15 +1261,15 @@ var _bindata = map[string]func() (*asset, error){ // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -1351,59 +1293,60 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "0001_app.down.sql": &bintree{_0001_appDownSql, map[string]*bintree{}}, - "0001_app.up.sql": &bintree{_0001_appUpSql, map[string]*bintree{}}, - "0002_tokens.down.sql": &bintree{_0002_tokensDownSql, map[string]*bintree{}}, - "0002_tokens.up.sql": &bintree{_0002_tokensUpSql, map[string]*bintree{}}, - "0003_settings.down.sql": &bintree{_0003_settingsDownSql, map[string]*bintree{}}, - "0003_settings.up.sql": &bintree{_0003_settingsUpSql, map[string]*bintree{}}, - "0004_pending_stickers.down.sql": &bintree{_0004_pending_stickersDownSql, map[string]*bintree{}}, - "0004_pending_stickers.up.sql": &bintree{_0004_pending_stickersUpSql, map[string]*bintree{}}, - "0005_waku_mode.down.sql": &bintree{_0005_waku_modeDownSql, map[string]*bintree{}}, - "0005_waku_mode.up.sql": &bintree{_0005_waku_modeUpSql, map[string]*bintree{}}, - "0006_appearance.up.sql": &bintree{_0006_appearanceUpSql, map[string]*bintree{}}, - "0007_enable_waku_default.up.sql": &bintree{_0007_enable_waku_defaultUpSql, map[string]*bintree{}}, - "0008_add_push_notifications.up.sql": &bintree{_0008_add_push_notificationsUpSql, map[string]*bintree{}}, - "0009_enable_sending_push_notifications.down.sql": &bintree{_0009_enable_sending_push_notificationsDownSql, map[string]*bintree{}}, - "0009_enable_sending_push_notifications.up.sql": &bintree{_0009_enable_sending_push_notificationsUpSql, map[string]*bintree{}}, - "0010_add_block_mentions.down.sql": &bintree{_0010_add_block_mentionsDownSql, map[string]*bintree{}}, - "0010_add_block_mentions.up.sql": &bintree{_0010_add_block_mentionsUpSql, map[string]*bintree{}}, - "0011_allow_webview_permission_requests.down.sql": &bintree{_0011_allow_webview_permission_requestsDownSql, map[string]*bintree{}}, - "0011_allow_webview_permission_requests.up.sql": &bintree{_0011_allow_webview_permission_requestsUpSql, map[string]*bintree{}}, - "0012_pending_transactions.down.sql": &bintree{_0012_pending_transactionsDownSql, map[string]*bintree{}}, - "0012_pending_transactions.up.sql": &bintree{_0012_pending_transactionsUpSql, map[string]*bintree{}}, - "0013_favourites.down.sql": &bintree{_0013_favouritesDownSql, map[string]*bintree{}}, - "0013_favourites.up.sql": &bintree{_0013_favouritesUpSql, map[string]*bintree{}}, - "0014_add_use_mailservers.down.sql": &bintree{_0014_add_use_mailserversDownSql, map[string]*bintree{}}, - "0014_add_use_mailservers.up.sql": &bintree{_0014_add_use_mailserversUpSql, map[string]*bintree{}}, - "0015_link_previews.down.sql": &bintree{_0015_link_previewsDownSql, map[string]*bintree{}}, - "0015_link_previews.up.sql": &bintree{_0015_link_previewsUpSql, map[string]*bintree{}}, - "0016_local_notifications_preferences.down.sql": &bintree{_0016_local_notifications_preferencesDownSql, map[string]*bintree{}}, - "0016_local_notifications_preferences.up.sql": &bintree{_0016_local_notifications_preferencesUpSql, map[string]*bintree{}}, - "0017_bookmarks.down.sql": &bintree{_0017_bookmarksDownSql, map[string]*bintree{}}, - "0017_bookmarks.up.sql": &bintree{_0017_bookmarksUpSql, map[string]*bintree{}}, - "0018_profile_pictures_visibility.up.sql": &bintree{_0018_profile_pictures_visibilityUpSql, map[string]*bintree{}}, - "0019_blocks_ranges_extra_data.up.sql": &bintree{_0019_blocks_ranges_extra_dataUpSql, map[string]*bintree{}}, - "0020_metrics.up.sql": &bintree{_0020_metricsUpSql, map[string]*bintree{}}, - "0021_add_session_id_to_metrics.up.sql": &bintree{_0021_add_session_id_to_metricsUpSql, map[string]*bintree{}}, - "0022_pending_transfers.up.sql": &bintree{_0022_pending_transfersUpSql, map[string]*bintree{}}, - "1618237885_settings_anon_metrics_should_send.up.sql": &bintree{_1618237885_settings_anon_metrics_should_sendUpSql, map[string]*bintree{}}, - "1618395756_contacts_only.up.sql": &bintree{_1618395756_contacts_onlyUpSql, map[string]*bintree{}}, - "1622184614_add_default_sync_period.up.sql": &bintree{_1622184614_add_default_sync_periodUpSql, map[string]*bintree{}}, - "1625872445_user_status.up.sql": &bintree{_1625872445_user_statusUpSql, map[string]*bintree{}}, - "1627983977_add_gif_to_settings.up.sql": &bintree{_1627983977_add_gif_to_settingsUpSql, map[string]*bintree{}}, - "1628580203_add_hidden_account.up.sql": &bintree{_1628580203_add_hidden_accountUpSql, map[string]*bintree{}}, - "1629123384_add_id_to_app_metrics.up.sql": &bintree{_1629123384_add_id_to_app_metricsUpSql, map[string]*bintree{}}, - "1630401853_add_opensea_enabled_to_settings.up.sql": &bintree{_1630401853_add_opensea_enabled_to_settingsUpSql, map[string]*bintree{}}, - "1630464455_create-saved_addresses-table.down.sql": &bintree{_1630464455_createSaved_addressesTableDownSql, map[string]*bintree{}}, - "1630464455_create-saved_addresses-table.up.sql": &bintree{_1630464455_createSaved_addressesTableUpSql, map[string]*bintree{}}, - "1630485153_networks.down.sql": &bintree{_1630485153_networksDownSql, map[string]*bintree{}}, - "1630485153_networks.up.sql": &bintree{_1630485153_networksUpSql, map[string]*bintree{}}, - "1632262444_profile_pictures_show_to.up.sql": &bintree{_1632262444_profile_pictures_show_toUpSql, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, + "0001_app.down.sql": &bintree{_0001_appDownSql, map[string]*bintree{}}, + "0001_app.up.sql": &bintree{_0001_appUpSql, map[string]*bintree{}}, + "0002_tokens.down.sql": &bintree{_0002_tokensDownSql, map[string]*bintree{}}, + "0002_tokens.up.sql": &bintree{_0002_tokensUpSql, map[string]*bintree{}}, + "0003_settings.down.sql": &bintree{_0003_settingsDownSql, map[string]*bintree{}}, + "0003_settings.up.sql": &bintree{_0003_settingsUpSql, map[string]*bintree{}}, + "0004_pending_stickers.down.sql": &bintree{_0004_pending_stickersDownSql, map[string]*bintree{}}, + "0004_pending_stickers.up.sql": &bintree{_0004_pending_stickersUpSql, map[string]*bintree{}}, + "0005_waku_mode.down.sql": &bintree{_0005_waku_modeDownSql, map[string]*bintree{}}, + "0005_waku_mode.up.sql": &bintree{_0005_waku_modeUpSql, map[string]*bintree{}}, + "0006_appearance.up.sql": &bintree{_0006_appearanceUpSql, map[string]*bintree{}}, + "0007_enable_waku_default.up.sql": &bintree{_0007_enable_waku_defaultUpSql, map[string]*bintree{}}, + "0008_add_push_notifications.up.sql": &bintree{_0008_add_push_notificationsUpSql, map[string]*bintree{}}, + "0009_enable_sending_push_notifications.down.sql": &bintree{_0009_enable_sending_push_notificationsDownSql, map[string]*bintree{}}, + "0009_enable_sending_push_notifications.up.sql": &bintree{_0009_enable_sending_push_notificationsUpSql, map[string]*bintree{}}, + "0010_add_block_mentions.down.sql": &bintree{_0010_add_block_mentionsDownSql, map[string]*bintree{}}, + "0010_add_block_mentions.up.sql": &bintree{_0010_add_block_mentionsUpSql, map[string]*bintree{}}, + "0011_allow_webview_permission_requests.down.sql": &bintree{_0011_allow_webview_permission_requestsDownSql, map[string]*bintree{}}, + "0011_allow_webview_permission_requests.up.sql": &bintree{_0011_allow_webview_permission_requestsUpSql, map[string]*bintree{}}, + "0012_pending_transactions.down.sql": &bintree{_0012_pending_transactionsDownSql, map[string]*bintree{}}, + "0012_pending_transactions.up.sql": &bintree{_0012_pending_transactionsUpSql, map[string]*bintree{}}, + "0013_favourites.down.sql": &bintree{_0013_favouritesDownSql, map[string]*bintree{}}, + "0013_favourites.up.sql": &bintree{_0013_favouritesUpSql, map[string]*bintree{}}, + "0014_add_use_mailservers.down.sql": &bintree{_0014_add_use_mailserversDownSql, map[string]*bintree{}}, + "0014_add_use_mailservers.up.sql": &bintree{_0014_add_use_mailserversUpSql, map[string]*bintree{}}, + "0015_link_previews.down.sql": &bintree{_0015_link_previewsDownSql, map[string]*bintree{}}, + "0015_link_previews.up.sql": &bintree{_0015_link_previewsUpSql, map[string]*bintree{}}, + "0016_local_notifications_preferences.down.sql": &bintree{_0016_local_notifications_preferencesDownSql, map[string]*bintree{}}, + "0016_local_notifications_preferences.up.sql": &bintree{_0016_local_notifications_preferencesUpSql, map[string]*bintree{}}, + "0017_bookmarks.down.sql": &bintree{_0017_bookmarksDownSql, map[string]*bintree{}}, + "0017_bookmarks.up.sql": &bintree{_0017_bookmarksUpSql, map[string]*bintree{}}, + "0018_profile_pictures_visibility.up.sql": &bintree{_0018_profile_pictures_visibilityUpSql, map[string]*bintree{}}, + "0019_blocks_ranges_extra_data.up.sql": &bintree{_0019_blocks_ranges_extra_dataUpSql, map[string]*bintree{}}, + "0020_metrics.up.sql": &bintree{_0020_metricsUpSql, map[string]*bintree{}}, + "0021_add_session_id_to_metrics.up.sql": &bintree{_0021_add_session_id_to_metricsUpSql, map[string]*bintree{}}, + "0022_pending_transfers.up.sql": &bintree{_0022_pending_transfersUpSql, map[string]*bintree{}}, + "1618237885_settings_anon_metrics_should_send.up.sql": &bintree{_1618237885_settings_anon_metrics_should_sendUpSql, map[string]*bintree{}}, + "1618395756_contacts_only.up.sql": &bintree{_1618395756_contacts_onlyUpSql, map[string]*bintree{}}, + "1622184614_add_default_sync_period.up.sql": &bintree{_1622184614_add_default_sync_periodUpSql, map[string]*bintree{}}, + "1625872445_user_status.up.sql": &bintree{_1625872445_user_statusUpSql, map[string]*bintree{}}, + "1627983977_add_gif_to_settings.up.sql": &bintree{_1627983977_add_gif_to_settingsUpSql, map[string]*bintree{}}, + "1628580203_add_hidden_account.up.sql": &bintree{_1628580203_add_hidden_accountUpSql, map[string]*bintree{}}, + "1629123384_add_id_to_app_metrics.up.sql": &bintree{_1629123384_add_id_to_app_metricsUpSql, map[string]*bintree{}}, + "1630401853_add_opensea_enabled_to_settings.up.sql": &bintree{_1630401853_add_opensea_enabled_to_settingsUpSql, map[string]*bintree{}}, + "1630464455_create-saved_addresses-table.down.sql": &bintree{_1630464455_createSaved_addressesTableDownSql, map[string]*bintree{}}, + "1630464455_create-saved_addresses-table.up.sql": &bintree{_1630464455_createSaved_addressesTableUpSql, map[string]*bintree{}}, + "1630485153_networks.down.sql": &bintree{_1630485153_networksDownSql, map[string]*bintree{}}, + "1630485153_networks.up.sql": &bintree{_1630485153_networksUpSql, map[string]*bintree{}}, + "1632262444_profile_pictures_show_to.up.sql": &bintree{_1632262444_profile_pictures_show_toUpSql, map[string]*bintree{}}, + "1635942153_add_telemetry_server_url_to_settings.up.sql": &bintree{_1635942153_add_telemetry_server_url_to_settingsUpSql, map[string]*bintree{}}, + "doc.go": &bintree{docGo, map[string]*bintree{}}, }} -// RestoreAsset restores an asset under the given directory. +// RestoreAsset restores an asset under the given directory func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -1421,10 +1364,14 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil } -// RestoreAssets restores an asset under the given directory recursively. +// RestoreAssets restores an asset under the given directory recursively func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -1442,6 +1389,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } diff --git a/appdatabase/migrations/sql/1635942153_add_telemetry_server_url_to_settings.up.sql b/appdatabase/migrations/sql/1635942153_add_telemetry_server_url_to_settings.up.sql new file mode 100644 index 000000000..64946b26e --- /dev/null +++ b/appdatabase/migrations/sql/1635942153_add_telemetry_server_url_to_settings.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE settings ADD COLUMN telemetry_server_url VARCHAR NOT NULL DEFAULT ""; +UPDATE settings SET telemetry_server_url = ""; \ No newline at end of file diff --git a/cmd/statusd/main.go b/cmd/statusd/main.go index ab717ac8e..65b089a8d 100644 --- a/cmd/statusd/main.go +++ b/cmd/statusd/main.go @@ -211,7 +211,13 @@ func main() { protocol.WithDatabase(db), } - messenger, err := protocol.NewMessenger(identity, gethbridge.NewNodeBridge(backend.StatusNode().GethNode(), backend.StatusNode().WakuService(), backend.StatusNode().WakuV2Service()), installationID.String(), options...) + messenger, err := protocol.NewMessenger( + config.Name, + identity, + gethbridge.NewNodeBridge(backend.StatusNode().GethNode(), backend.StatusNode().WakuService(), backend.StatusNode().WakuV2Service()), + installationID.String(), + options..., + ) if err != nil { logger.Error("failed to create messenger", "error", err) return diff --git a/multiaccounts/accounts/database.go b/multiaccounts/accounts/database.go index 9a6a77839..8a74c7aa8 100644 --- a/multiaccounts/accounts/database.go +++ b/multiaccounts/accounts/database.go @@ -136,6 +136,7 @@ type Settings struct { GifRecents *json.RawMessage `json:"gifs/recent-gifs"` GifFavorites *json.RawMessage `json:"gifs/favorite-gifs"` OpenseaEnabled bool `json:"opensea-enabled?,omitempty"` + TelemetryServerURL string `json:"telemetry-server-url,omitempty"` } func NewDB(db *sql.DB) *Database { @@ -427,6 +428,8 @@ func (db *Database) SaveSetting(setting string, value interface{}) error { return ErrInvalidConfig } update, err = db.db.Prepare("UPDATE settings SET opensea_enabled = ? WHERE synthetic_id = 'id'") + case "telemetry-server-url": + update, err = db.db.Prepare("UPDATE settings SET telemetry_server_url = ? WHERE synthetic_id = 'id'") default: return ErrInvalidConfig } @@ -443,7 +446,7 @@ func (db *Database) GetNodeConfig(nodecfg interface{}) error { func (db *Database) GetSettings() (Settings, error) { var s Settings - err := db.db.QueryRow("SELECT address, anon_metrics_should_send, chaos_mode, currency, current_network, custom_bootnodes, custom_bootnodes_enabled, dapps_address, eip1581_address, fleet, hide_home_tooltip, installation_id, key_uid, keycard_instance_uid, keycard_paired_on, keycard_pairing, last_updated, latest_derived_path, link_preview_request_enabled, link_previews_enabled_sites, log_level, mnemonic, name, networks, notifications_enabled, push_notifications_server_enabled, push_notifications_from_contacts_only, remote_push_notifications_enabled, send_push_notifications, push_notifications_block_mentions, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_packs_pending, stickers_recent_stickers, syncing_on_mobile_network, default_sync_period, use_mailservers, messages_from_contacts_only, usernames, appearance, profile_pictures_show_to, profile_pictures_visibility, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens, waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents, gif_favorites, opensea_enabled FROM settings WHERE synthetic_id = 'id'").Scan( + err := db.db.QueryRow("SELECT address, anon_metrics_should_send, chaos_mode, currency, current_network, custom_bootnodes, custom_bootnodes_enabled, dapps_address, eip1581_address, fleet, hide_home_tooltip, installation_id, key_uid, keycard_instance_uid, keycard_paired_on, keycard_pairing, last_updated, latest_derived_path, link_preview_request_enabled, link_previews_enabled_sites, log_level, mnemonic, name, networks, notifications_enabled, push_notifications_server_enabled, push_notifications_from_contacts_only, remote_push_notifications_enabled, send_push_notifications, push_notifications_block_mentions, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_packs_pending, stickers_recent_stickers, syncing_on_mobile_network, default_sync_period, use_mailservers, messages_from_contacts_only, usernames, appearance, profile_pictures_show_to, profile_pictures_visibility, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens, waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents, gif_favorites, opensea_enabled, telemetry_server_url FROM settings WHERE synthetic_id = 'id'").Scan( &s.Address, &s.AnonMetricsShouldSend, &s.ChaosMode, @@ -502,6 +505,7 @@ func (db *Database) GetSettings() (Settings, error) { &sqlite.JSONBlob{Data: &s.GifRecents}, &sqlite.JSONBlob{Data: &s.GifFavorites}, &s.OpenseaEnabled, + &s.TelemetryServerURL, ) return s, err } diff --git a/protocol/communities_messenger_test.go b/protocol/communities_messenger_test.go index 129a2300a..61d6d9d3f 100644 --- a/protocol/communities_messenger_test.go +++ b/protocol/communities_messenger_test.go @@ -68,6 +68,7 @@ func (s *MessengerCommunitiesSuite) TearDownTest() { func (s *MessengerCommunitiesSuite) newMessengerWithOptions(shh types.Waku, privateKey *ecdsa.PrivateKey, options []Option) *Messenger { m, err := NewMessenger( + "Test", privateKey, &testNode{shh: shh}, uuid.New().String(), diff --git a/protocol/messenger.go b/protocol/messenger.go index e4d3a1a0b..c273e22fc 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -47,6 +47,8 @@ import ( "github.com/status-im/status-go/protocol/transport" v1protocol "github.com/status-im/status-go/protocol/v1" "github.com/status-im/status-go/services/mailservers" + + "github.com/status-im/status-go/telemetry" ) //todo: kozieiev: get rid of wakutransp word @@ -110,6 +112,7 @@ type Messenger struct { quit chan struct{} requestedCommunities map[string]*transport.Filter connectionState connection.State + telemetryClient *telemetry.Client // TODO(samyoul) Determine if/how the remaining usage of this mutex can be removed mutex sync.Mutex @@ -160,6 +163,7 @@ func (interceptor EnvelopeEventsInterceptor) MailServerRequestExpired(hash types } func NewMessenger( + nodeName string, identity *ecdsa.PrivateKey, node types.Node, installationID string, @@ -299,6 +303,11 @@ func NewMessenger( anonMetricsServer.Logger = logger } + var telemetryClient *telemetry.Client + if c.telemetryServerURL != "" { + telemetryClient = telemetry.NewClient(logger, c.telemetryServerURL, c.account.KeyUID, nodeName) + } + // Initialize push notification server var pushNotificationServer *pushnotificationserver.Server if c.pushNotificationServerConfig != nil && c.pushNotificationServerConfig.Enabled { @@ -339,6 +348,7 @@ func NewMessenger( sender: sender, anonMetricsClient: anonMetricsClient, anonMetricsServer: anonMetricsServer, + telemetryClient: telemetryClient, pushNotificationClient: pushNotificationClient, pushNotificationServer: pushNotificationServer, communitiesManager: communitiesManager, @@ -2682,7 +2692,7 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte logger := m.logger.With(zap.String("site", "RetrieveAll")) - for _, messages := range chatWithMessages { + for filter, messages := range chatWithMessages { var processedMessages []string for _, shhMessage := range messages { logger := logger.With(zap.String("hash", types.EncodeHex(shhMessage.Hash))) @@ -2693,6 +2703,10 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte logger.Info("failed to decode messages", zap.Error(err)) continue } + + if m.telemetryClient != nil { + go m.telemetryClient.PushReceivedMessages(filter, shhMessage, statusMessages) + } m.markDeliveredMessages(acks) logger.Debug("processing messages further", zap.Int("count", len(statusMessages))) diff --git a/protocol/messenger_config.go b/protocol/messenger_config.go index 7c2dbfa06..78f911465 100644 --- a/protocol/messenger_config.go +++ b/protocol/messenger_config.go @@ -67,6 +67,8 @@ type config struct { logger *zap.Logger messengerSignalsHandler MessengerSignalsHandler + + telemetryServerURL string } type Option func(*config) error @@ -171,6 +173,13 @@ func WithAnonMetricsServerConfig(anonMetricsServerConfig *anonmetrics.ServerConf } } +func WithTelemetry(serverURL string) Option { + return func(c *config) error { + c.telemetryServerURL = serverURL + return nil + } +} + func WithPushNotificationServerConfig(pushNotificationServerConfig *pushnotificationserver.Config) Option { return func(c *config) error { c.pushNotificationServerConfig = pushNotificationServerConfig diff --git a/protocol/messenger_test.go b/protocol/messenger_test.go index d2066af03..40d431d52 100644 --- a/protocol/messenger_test.go +++ b/protocol/messenger_test.go @@ -138,6 +138,7 @@ func newMessengerWithKey(shh types.Waku, privateKey *ecdsa.PrivateKey, logger *z options = append(options, extraOptions...) m, err := NewMessenger( + "Test", privateKey, &testNode{shh: shh}, uuid.New().String(), diff --git a/services/ext/service.go b/services/ext/service.go index db274d57e..4b9e60383 100644 --- a/services/ext/service.go +++ b/services/ext/service.go @@ -102,7 +102,7 @@ func (s *Service) GetPeer(rawURL string) (*enode.Node, error) { return enode.ParseV4(rawURL) } -func (s *Service) InitProtocol(identity *ecdsa.PrivateKey, db *sql.DB, multiAccountDb *multiaccounts.Database, acc *multiaccounts.Account, logger *zap.Logger) error { +func (s *Service) InitProtocol(nodeName string, identity *ecdsa.PrivateKey, db *sql.DB, multiAccountDb *multiaccounts.Database, acc *multiaccounts.Account, logger *zap.Logger) error { if !s.config.PFSEnabled { return nil } @@ -143,6 +143,7 @@ func (s *Service) InitProtocol(identity *ecdsa.PrivateKey, db *sql.DB, multiAcco } messenger, err := protocol.NewMessenger( + nodeName, identity, s.n, s.config.InstallationID, @@ -454,6 +455,10 @@ func buildMessengerOptions( options = append(options, protocol.WithAnonMetricsServerConfig(amsc)) } + if settings.TelemetryServerURL != "" { + options = append(options, protocol.WithTelemetry(settings.TelemetryServerURL)) + } + if settings.PushNotificationsServerEnabled { config := &pushnotificationserver.Config{ Enabled: true, diff --git a/services/wakuext/api_test.go b/services/wakuext/api_test.go index 25522ba1b..3f3f2d368 100644 --- a/services/wakuext/api_test.go +++ b/services/wakuext/api_test.go @@ -132,7 +132,7 @@ func TestInitProtocol(t *testing.T) { acc := &multiaccounts.Account{KeyUID: "0xdeadbeef"} - err = service.InitProtocol(privateKey, sqlDB, multiAccounts, acc, zap.NewNop()) + err = service.InitProtocol("Test", privateKey, sqlDB, multiAccounts, acc, zap.NewNop()) require.NoError(t, err) } @@ -195,7 +195,7 @@ func (s *ShhExtSuite) createAndAddNode() { acc := &multiaccounts.Account{KeyUID: "0xdeadbeef"} - err = service.InitProtocol(privateKey, sqlDB, multiAccounts, acc, zap.NewNop()) + err = service.InitProtocol("Test", privateKey, sqlDB, multiAccounts, acc, zap.NewNop()) s.NoError(err) stack.RegisterLifecycle(service) diff --git a/telemetry/client.go b/telemetry/client.go new file mode 100644 index 000000000..d0c95e306 --- /dev/null +++ b/telemetry/client.go @@ -0,0 +1,55 @@ +package telemetry + +import ( + "bytes" + "encoding/json" + "fmt" + "net/http" + "time" + + "go.uber.org/zap" + + "github.com/status-im/status-go/eth-node/types" + "github.com/status-im/status-go/protocol/transport" + v1protocol "github.com/status-im/status-go/protocol/v1" +) + +type Client struct { + serverURL string + httpClient *http.Client + logger *zap.Logger + keyUID string + nodeName string +} + +func NewClient(logger *zap.Logger, serverURL string, keyUID string, nodeName string) *Client { + return &Client{ + serverURL: serverURL, + httpClient: &http.Client{Timeout: time.Minute}, + logger: logger, + keyUID: keyUID, + nodeName: nodeName, + } +} + +func (c *Client) PushReceivedMessages(filter transport.Filter, sshMessage *types.Message, messages []*v1protocol.StatusMessage) { + c.logger.Debug("Pushing received messages to telemetry server") + url := fmt.Sprintf("%s/received-messages", c.serverURL) + var postBody []map[string]interface{} + for _, message := range messages { + postBody = append(postBody, map[string]interface{}{ + "chatId": filter.ChatID, + "messageHash": types.EncodeHex(sshMessage.Hash), + "messageId": message.ID, + "sentAt": sshMessage.Timestamp, + "topic": filter.Topic.String(), + "receiverKeyUID": c.keyUID, + "nodeName": c.nodeName, + }) + } + body, _ := json.Marshal(postBody) + _, err := c.httpClient.Post(url, "application/json", bytes.NewBuffer(body)) + if err != nil { + c.logger.Error("Error sending message to telemetry server", zap.Error(err)) + } +}