From 4cc53630d5cbe10ce28103154bd4cfe926176ccc Mon Sep 17 00:00:00 2001 From: frank Date: Mon, 17 Jan 2022 11:42:11 +0800 Subject: [PATCH] Sync bookmarks --- VERSION | 2 +- appdatabase/migrations/bindata.go | 36 +++- ...6031_add_removed_clock_to_bookmarks.up.sql | 2 + appdatabase/migrationsprevnodecfg/bindata.go | 108 +++++----- protocol/messenger.go | 94 ++++++++- protocol/messenger_config.go | 16 ++ protocol/messenger_installations_test.go | 17 ++ protocol/messenger_response.go | 17 ++ protocol/messenger_sync_bookmark_test.go | 156 +++++++++++++++ protocol/messenger_test.go | 1 + .../application_metadata_message.pb.go | 93 ++++----- .../application_metadata_message.proto | 1 + protocol/protobuf/pairing.pb.go | 187 ++++++++++++------ protocol/protobuf/pairing.proto | 8 + protocol/v1/status_message.go | 2 + services/browsers/api.go | 7 + services/browsers/api_test.go | 33 ++++ services/browsers/database.go | 113 ++++++++++- services/ext/api.go | 6 + services/ext/service.go | 3 + 20 files changed, 732 insertions(+), 170 deletions(-) create mode 100644 appdatabase/migrations/sql/1642666031_add_removed_clock_to_bookmarks.up.sql create mode 100644 protocol/messenger_sync_bookmark_test.go diff --git a/VERSION b/VERSION index 4c85439f9..0a4eab771 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.94.3 +0.94.4 diff --git a/appdatabase/migrations/bindata.go b/appdatabase/migrations/bindata.go index f0907e0af..1e7befc6b 100644 --- a/appdatabase/migrations/bindata.go +++ b/appdatabase/migrations/bindata.go @@ -1,6 +1,7 @@ // Code generated by go-bindata. DO NOT EDIT. // sources: // 1640111208_dummy.up.sql (258B) +// 1642666031_add_removed_clock_to_bookmarks.up.sql (117B) // 1643644541_gif_api_key_setting.up.sql (108B) // doc.go (74B) @@ -86,11 +87,31 @@ func _1640111208_dummyUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xf0, 0xae, 0x20, 0x6e, 0x75, 0xd1, 0x36, 0x14, 0xf2, 0x40, 0xe5, 0xd6, 0x7a, 0xc4, 0xa5, 0x72, 0xaa, 0xb5, 0x4d, 0x71, 0x97, 0xb8, 0xe8, 0x95, 0x22, 0x95, 0xa2, 0xac, 0xaf, 0x48, 0x58}} return a, nil } +var __1642666031_add_removed_clock_to_bookmarksUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x48\xca\xcf\xcf\xce\x4d\x2c\xca\x2e\x56\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\x28\x4a\xcd\xcd\x2f\x4b\x4d\x51\x70\xf2\xf7\xf7\x71\x75\xf4\x53\x70\x71\x75\x73\x0c\xf5\x09\x51\x70\x73\xf4\x09\x76\xb5\xe6\x22\xa8\x3f\x39\x27\x3f\x39\x5b\xc1\xd3\x2f\x04\xae\xd3\xc0\x1a\x10\x00\x00\xff\xff\xe6\xf6\xbf\x66\x75\x00\x00\x00") + +func _1642666031_add_removed_clock_to_bookmarksUpSqlBytes() ([]byte, error) { + return bindataRead( + __1642666031_add_removed_clock_to_bookmarksUpSql, + "1642666031_add_removed_clock_to_bookmarks.up.sql", + ) +} + +func _1642666031_add_removed_clock_to_bookmarksUpSql() (*asset, error) { + bytes, err := _1642666031_add_removed_clock_to_bookmarksUpSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(0664), modTime: time.Unix(1644902983, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x4e, 0x38, 0x99, 0x7a, 0xc, 0x90, 0x13, 0xec, 0xfe, 0x2f, 0x55, 0xff, 0xb7, 0xb6, 0xaa, 0x96, 0xc6, 0x92, 0x79, 0xcc, 0xee, 0x4e, 0x99, 0x53, 0xfe, 0x1c, 0xbb, 0x32, 0x2, 0xa4, 0x27}} + return a, nil +} + var __1643644541_gif_api_key_settingUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x28\x4e\x2d\x29\xc9\xcc\x4b\x2f\x56\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\x48\xcf\x4c\x8b\x4f\x2c\xc8\x8c\xcf\x4e\xad\x54\x08\x71\x8d\x08\x51\xf0\xf3\x0f\x51\xf0\x0b\xf5\xf1\x51\x70\x71\x75\x73\x0c\xf5\x09\x51\x50\x52\xb2\xe6\x0a\x0d\x70\x71\x0c\x41\x32\x20\xd8\x35\x04\x45\xa7\x2d\x58\x15\x20\x00\x00\xff\xff\x59\x5f\x0d\x48\x6c\x00\x00\x00") func _1643644541_gif_api_key_settingUpSqlBytes() ([]byte, error) { @@ -106,7 +127,7 @@ func _1643644541_gif_api_key_settingUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1644591919, 0)} + info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0664), modTime: time.Unix(1644197385, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1b, 0x94, 0x28, 0xfb, 0x66, 0xd1, 0x7c, 0xb8, 0x89, 0xe2, 0xb4, 0x71, 0x65, 0x24, 0x57, 0x22, 0x95, 0x38, 0x97, 0x3, 0x9b, 0xc6, 0xa4, 0x41, 0x7b, 0xba, 0xf7, 0xdb, 0x70, 0xf7, 0x20, 0x3a}} return a, nil } @@ -126,7 +147,7 @@ func docGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1585751575, 0)} + info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1641859848, 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}} return a, nil } @@ -224,6 +245,8 @@ func AssetNames() []string { var _bindata = map[string]func() (*asset, error){ "1640111208_dummy.up.sql": _1640111208_dummyUpSql, + "1642666031_add_removed_clock_to_bookmarks.up.sql": _1642666031_add_removed_clock_to_bookmarksUpSql, + "1643644541_gif_api_key_setting.up.sql": _1643644541_gif_api_key_settingUpSql, "doc.go": docGo, @@ -270,9 +293,10 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "1640111208_dummy.up.sql": &bintree{_1640111208_dummyUpSql, map[string]*bintree{}}, - "1643644541_gif_api_key_setting.up.sql": &bintree{_1643644541_gif_api_key_settingUpSql, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, + "1640111208_dummy.up.sql": &bintree{_1640111208_dummyUpSql, map[string]*bintree{}}, + "1642666031_add_removed_clock_to_bookmarks.up.sql": &bintree{_1642666031_add_removed_clock_to_bookmarksUpSql, map[string]*bintree{}}, + "1643644541_gif_api_key_setting.up.sql": &bintree{_1643644541_gif_api_key_settingUpSql, map[string]*bintree{}}, + "doc.go": &bintree{docGo, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory. diff --git a/appdatabase/migrations/sql/1642666031_add_removed_clock_to_bookmarks.up.sql b/appdatabase/migrations/sql/1642666031_add_removed_clock_to_bookmarks.up.sql new file mode 100644 index 000000000..6f91fb33e --- /dev/null +++ b/appdatabase/migrations/sql/1642666031_add_removed_clock_to_bookmarks.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE bookmarks ADD COLUMN removed BOOLEAN DEFAULT FALSE; +ALTER TABLE bookmarks ADD COLUMN clock INT DEFAULT 0; \ No newline at end of file diff --git a/appdatabase/migrationsprevnodecfg/bindata.go b/appdatabase/migrationsprevnodecfg/bindata.go index cbee9fc7c..cb1665c9d 100644 --- a/appdatabase/migrationsprevnodecfg/bindata.go +++ b/appdatabase/migrationsprevnodecfg/bindata.go @@ -137,7 +137,7 @@ func _0001_appDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0001_app.down.sql", size: 356, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0001_app.down.sql", size: 356, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -157,7 +157,7 @@ func _0001_appUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0001_app.up.sql", size: 2967, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0001_app.up.sql", size: 2967, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -177,7 +177,7 @@ func _0002_tokensDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -197,7 +197,7 @@ func _0002_tokensUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -217,7 +217,7 @@ func _0003_settingsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -237,7 +237,7 @@ func _0003_settingsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -257,7 +257,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0004_pending_stickers.down.sql", size: 0, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -277,7 +277,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0004_pending_stickers.up.sql", size: 61, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -297,7 +297,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0005_waku_mode.down.sql", size: 0, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -317,7 +317,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0005_waku_mode.up.sql", size: 146, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -337,7 +337,7 @@ func _0006_appearanceUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -357,7 +357,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0007_enable_waku_default.up.sql", size: 38, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -377,7 +377,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0008_add_push_notifications.up.sql", size: 349, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -397,7 +397,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0009_enable_sending_push_notifications.down.sql", size: 49, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -417,7 +417,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0009_enable_sending_push_notifications.up.sql", size: 49, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -437,7 +437,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0010_add_block_mentions.down.sql", size: 83, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -457,7 +457,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0010_add_block_mentions.up.sql", size: 89, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -477,7 +477,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0011_allow_webview_permission_requests.down.sql", size: 0, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -497,7 +497,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0011_allow_webview_permission_requests.up.sql", size: 88, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -517,7 +517,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0012_pending_transactions.down.sql", size: 33, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -537,7 +537,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0012_pending_transactions.up.sql", size: 321, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -557,7 +557,7 @@ func _0013_favouritesDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0013_favourites.down.sql", size: 23, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0013_favourites.down.sql", size: 23, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -577,7 +577,7 @@ func _0013_favouritesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0013_favourites.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0013_favourites.up.sql", size: 132, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -597,7 +597,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0014_add_use_mailservers.down.sql", size: 0, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -617,7 +617,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0014_add_use_mailservers.up.sql", size: 111, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -637,7 +637,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0015_link_previews.down.sql", size: 0, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -657,7 +657,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0015_link_previews.up.sql", size: 203, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -677,7 +677,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0016_local_notifications_preferences.down.sql", size: 43, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -697,7 +697,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0016_local_notifications_preferences.up.sql", size: 204, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -717,7 +717,7 @@ func _0017_bookmarksDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0017_bookmarks.down.sql", size: 22, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0017_bookmarks.down.sql", size: 22, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -737,7 +737,7 @@ func _0017_bookmarksUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0017_bookmarks.up.sql", size: 147, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0017_bookmarks.up.sql", size: 147, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -757,7 +757,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0018_profile_pictures_visibility.up.sql", size: 84, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -777,7 +777,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0019_blocks_ranges_extra_data.up.sql", size: 89, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -797,7 +797,7 @@ func _0020_metricsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0020_metrics.up.sql", size: 235, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "0020_metrics.up.sql", size: 235, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -817,7 +817,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0021_add_session_id_to_metrics.up.sql", size: 55, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -837,7 +837,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "0022_pending_transfers.up.sql", size: 706, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -857,7 +857,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1618237885_settings_anon_metrics_should_send.up.sql", size: 80, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -877,7 +877,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1618395756_contacts_only.up.sql", size: 136, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -897,7 +897,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1622184614_add_default_sync_period.up.sql", size: 125, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -917,7 +917,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1625872445_user_status.up.sql", size: 351, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -937,7 +937,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1627983977_add_gif_to_settings.up.sql", size: 102, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -957,7 +957,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1628580203_add_hidden_account.up.sql", size: 67, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -977,7 +977,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1629123384_add_id_to_app_metrics.up.sql", size: 589, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -997,7 +997,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1630401853_add_opensea_enabled_to_settings.up.sql", size: 70, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -1017,7 +1017,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1630464455_create-saved_addresses-table.down.sql", size: 28, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -1037,7 +1037,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1630464455_create-saved_addresses-table.up.sql", size: 187, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -1057,7 +1057,7 @@ func _1630485153_networksDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1630485153_networks.down.sql", size: 21, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "1630485153_networks.down.sql", size: 21, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -1077,7 +1077,7 @@ func _1630485153_networksUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1630485153_networks.up.sql", size: 394, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "1630485153_networks.up.sql", size: 394, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -1097,7 +1097,7 @@ 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(1642505279, 0)} + info := bindataFileInfo{name: "1632262444_profile_pictures_show_to.up.sql", size: 81, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 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}} return a, nil } @@ -1117,7 +1117,7 @@ func _1635942153_add_telemetry_server_url_to_settingsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1635942153_add_telemetry_server_url_to_settings.up.sql", size: 128, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "1635942153_add_telemetry_server_url_to_settings.up.sql", size: 128, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6e, 0x9b, 0x1d, 0x39, 0x9c, 0x8d, 0x50, 0x86, 0xdf, 0xe5, 0x81, 0x55, 0xdc, 0x31, 0xcd, 0xb7, 0xc7, 0x5a, 0x67, 0x3b, 0x21, 0x99, 0xa5, 0x74, 0xb8, 0xd3, 0x58, 0xae, 0x29, 0x68, 0x2a, 0x8d}} return a, nil } @@ -1137,7 +1137,7 @@ func _1635942154_add_backup_settingUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1635942154_add_backup_setting.up.sql", size: 287, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "1635942154_add_backup_setting.up.sql", size: 287, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb7, 0xe7, 0xfb, 0x70, 0x80, 0x5, 0xb4, 0x7b, 0x67, 0x8, 0x6e, 0x5f, 0x45, 0x17, 0xd9, 0x5f, 0x18, 0x66, 0x2f, 0x8a, 0x4f, 0xd4, 0x15, 0xe5, 0x2b, 0xbb, 0x25, 0x7a, 0x30, 0xad, 0x4c, 0x1a}} return a, nil } @@ -1157,7 +1157,7 @@ func _1637745568_add_auto_message_settingUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1637745568_add_auto_message_setting.up.sql", size: 122, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "1637745568_add_auto_message_setting.up.sql", size: 122, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1d, 0xd8, 0xd2, 0xc2, 0x3a, 0xd7, 0xf1, 0x96, 0x6a, 0x35, 0xe5, 0x5c, 0xb9, 0xed, 0x4b, 0xf2, 0x5f, 0x80, 0x43, 0xca, 0x40, 0x57, 0x7e, 0xd7, 0x41, 0x9f, 0x70, 0x9f, 0xaf, 0x2a, 0xfc, 0x8f}} return a, nil } @@ -1177,7 +1177,7 @@ func _1640111208_nodeconfigUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1640111208_nodeconfig.up.sql", size: 7659, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "1640111208_nodeconfig.up.sql", size: 7659, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8e, 0x5a, 0xc6, 0xed, 0x6, 0xcb, 0x51, 0x8b, 0x78, 0xe9, 0x10, 0x37, 0xd1, 0xad, 0x9b, 0x76, 0x9a, 0xb9, 0x72, 0x85, 0xe7, 0x8a, 0x7f, 0xf0, 0x81, 0xf8, 0x33, 0x59, 0x67, 0x8e, 0xeb, 0xb1}} return a, nil } @@ -1197,7 +1197,7 @@ func docGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "doc.go", size: 85, mode: os.FileMode(0644), modTime: time.Unix(1642505279, 0)} + info := bindataFileInfo{name: "doc.go", size: 85, mode: os.FileMode(0664), modTime: time.Unix(1642389456, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe5, 0xd2, 0xea, 0xc5, 0xd, 0xc4, 0x7f, 0x95, 0x8e, 0xd5, 0xf5, 0x96, 0xf2, 0x1b, 0xcb, 0xc7, 0xc2, 0x46, 0x1, 0x78, 0x1d, 0x5d, 0x59, 0x19, 0x99, 0xdd, 0x5b, 0xf5, 0x63, 0xa5, 0x25, 0xb8}} return a, nil } diff --git a/protocol/messenger.go b/protocol/messenger.go index 71bec7a02..dc4828951 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -16,6 +16,9 @@ import ( "time" "github.com/libp2p/go-libp2p-core/peer" + + "github.com/status-im/status-go/services/browsers" + "github.com/pkg/errors" "go.uber.org/zap" @@ -120,6 +123,7 @@ type Messenger struct { settings *accounts.Database account *multiaccounts.Account mailserversDatabase *mailserversDB.Database + browserDatabase *browsers.Database imageServer *images.Server quit chan struct{} requestedCommunities map[string]*transport.Filter @@ -423,6 +427,7 @@ func NewMessenger( account: c.account, quit: make(chan struct{}), requestedCommunities: make(map[string]*transport.Filter), + browserDatabase: c.browserDatabase, imageServer: imageServer, shutdownTasks: []func() error{ ensVerifier.Stop, @@ -2489,6 +2494,16 @@ func (m *Messenger) SyncDevices(ctx context.Context, ensName, photoPath string) } } + bookmarks, err := m.browserDatabase.GetBookmarks() + if err != nil { + return err + } + for _, b := range bookmarks { + if err = m.SyncBookmark(ctx, b); err != nil { + return err + } + } + return err } @@ -2734,6 +2749,38 @@ func (m *Messenger) syncCommunity(ctx context.Context, community *communities.Co return m.saveChat(chat) } +func (m *Messenger) SyncBookmark(ctx context.Context, bookmark *browsers.Bookmark) error { + if !m.hasPairedDevices() { + return nil + } + + clock, chat := m.getLastClockWithRelatedChat() + + syncMessage := &protobuf.SyncBookmark{ + Clock: clock, + Url: bookmark.URL, + Name: bookmark.Name, + ImageUrl: bookmark.ImageURL, + Removed: bookmark.Removed, + } + encodedMessage, err := proto.Marshal(syncMessage) + if err != nil { + return err + } + + _, err = m.dispatchMessage(ctx, common.RawMessage{ + LocalChatID: chat.ID, + Payload: encodedMessage, + MessageType: protobuf.ApplicationMetadataMessage_SYNC_BOOKMARK, + ResendAutomatically: true, + }) + if err != nil { + return err + } + chat.LastClockValue = clock + return m.saveChat(chat) +} + // RetrieveAll retrieves messages from all filters, processes them and returns a // MessengerResponse to the client func (m *Messenger) RetrieveAll() (*MessengerResponse, error) { @@ -2785,7 +2832,8 @@ type ReceivedMessageState struct { // Response to the client Response *MessengerResponse // Timesource is a time source for clock values/timestamps. - Timesource common.TimeSource + Timesource common.TimeSource + AllBookmarks map[string]*browsers.Bookmark } func (m *Messenger) markDeliveredMessages(acks [][]byte) { @@ -2900,6 +2948,7 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte GroupChatInvitations: make(map[string]*GroupChatInvitation), Response: response, Timesource: m.getTimesource(), + AllBookmarks: make(map[string]*browsers.Bookmark), } logger := m.logger.With(zap.String("site", "RetrieveAll")) @@ -3083,6 +3132,21 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte continue } + case protobuf.SyncBookmark: + if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { + logger.Warn("not coming from us, ignoring") + continue + } + + p := msg.ParsedMessage.Interface().(protobuf.SyncBookmark) + logger.Debug("Handling SyncBookmark", zap.Any("message", p)) + err = m.handleSyncBookmark(messageState, p) + if err != nil { + logger.Warn("failed to handle SyncBookmark", zap.Error(err)) + allMessagesProcessed = false + continue + } + case protobuf.SyncClearHistory: if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { logger.Warn("not coming from us, ignoring") @@ -3667,9 +3731,25 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte // Reset installations m.modifiedInstallations = new(stringBoolMap) + if len(messageState.AllBookmarks) > 0 { + bookmarks, err := m.storeSyncBookmarks(messageState.AllBookmarks) + if err != nil { + return nil, err + } + messageState.Response.AddBookmarks(bookmarks) + } + return messageState.Response, nil } +func (m *Messenger) storeSyncBookmarks(bookmarkMap map[string]*browsers.Bookmark) ([]*browsers.Bookmark, error) { + var bookmarks []*browsers.Bookmark + for _, bookmark := range bookmarkMap { + bookmarks = append(bookmarks, bookmark) + } + return m.browserDatabase.StoreSyncBookmarks(bookmarks) +} + // SetMailserver sets the currently used mailserver func (m *Messenger) SetMailserver(peer []byte) { m.mailserver = peer @@ -5117,6 +5197,18 @@ func (m *Messenger) getSettings() (accounts.Settings, error) { return sDB.GetSettings() } +func (m *Messenger) handleSyncBookmark(state *ReceivedMessageState, message protobuf.SyncBookmark) error { + bookmark := &browsers.Bookmark{ + URL: message.Url, + Name: message.Name, + ImageURL: message.ImageUrl, + Removed: message.Removed, + Clock: message.Clock, + } + state.AllBookmarks[message.Url] = bookmark + return nil +} + func (m *Messenger) handleSyncClearHistory(state *ReceivedMessageState, message protobuf.SyncClearHistory) error { chatID := message.ChatId existingChat, ok := state.AllChats.Load(chatID) diff --git a/protocol/messenger_config.go b/protocol/messenger_config.go index 8fd7d512c..e182fb880 100644 --- a/protocol/messenger_config.go +++ b/protocol/messenger_config.go @@ -4,6 +4,8 @@ import ( "database/sql" "encoding/json" + "github.com/status-im/status-go/services/browsers" + "go.uber.org/zap" "github.com/status-im/status-go/appdatabase/migrations" @@ -55,6 +57,7 @@ type config struct { mailserversDatabase *mailservers.Database account *multiaccounts.Account clusterConfig params.ClusterConfig + browserDatabase *browsers.Database verifyTransactionClient EthClient verifyENSURL string @@ -161,6 +164,19 @@ func WithAccount(acc *multiaccounts.Account) Option { } } +func WithBrowserDatabase(bd *browsers.Database) Option { + return func(c *config) error { + c.browserDatabase = bd + if c.browserDatabase == nil { + c.afterDbCreatedHooks = append(c.afterDbCreatedHooks, func(c *config) error { + c.browserDatabase = browsers.NewDB(c.db) + return nil + }) + } + return nil + } +} + func WithAnonMetricsClientConfig(anonMetricsClientConfig *anonmetrics.ClientConfig) Option { return func(c *config) error { c.anonMetricsClientConfig = anonMetricsClientConfig diff --git a/protocol/messenger_installations_test.go b/protocol/messenger_installations_test.go index d9b261d65..a42d2e1bc 100644 --- a/protocol/messenger_installations_test.go +++ b/protocol/messenger_installations_test.go @@ -6,6 +6,8 @@ import ( "errors" "testing" + "github.com/status-im/status-go/services/browsers" + "github.com/stretchr/testify/suite" "go.uber.org/zap" @@ -151,6 +153,15 @@ func (s *MessengerInstallationSuite) TestSyncInstallation() { _, err = s.m.SetContactLocalNickname(&requests.SetContactLocalNickname{ID: types.Hex2Bytes(contact.ID), Nickname: contact.LocalNickname}) s.Require().NoError(err) + //add bookmark + bookmark := browsers.Bookmark{ + Name: "status official site", + URL: "https://status.im", + Removed: false, + } + _, err = s.m.browserDatabase.StoreBookmark(bookmark) + s.Require().NoError(err) + // add chat chat := CreatePublicChat(statusChatID, s.m.transport) err = s.m.SaveChat(chat) @@ -241,10 +252,16 @@ func (s *MessengerInstallationSuite) TestSyncInstallation() { s.Require().True(actualContact.Added) s.Require().Equal("Test Nickname", actualContact.LocalNickname) + + bookmarks, err := theirMessenger.browserDatabase.GetBookmarks() + s.Require().NoError(err) + s.Require().Equal(1, len(bookmarks)) + s.Require().NoError(theirMessenger.Shutdown()) s.Require().NotNil(removedChat) s.Require().False(removedChat.Active) + } func (s *MessengerInstallationSuite) TestSyncInstallationNewMessages() { diff --git a/protocol/messenger_response.go b/protocol/messenger_response.go index 5236b0caf..608ff6ef5 100644 --- a/protocol/messenger_response.go +++ b/protocol/messenger_response.go @@ -3,6 +3,8 @@ package protocol import ( "encoding/json" + "github.com/status-im/status-go/services/browsers" + "github.com/status-im/status-go/appmetrics" "github.com/status-im/status-go/protocol/common" "github.com/status-im/status-go/protocol/communities" @@ -30,6 +32,7 @@ type MessengerResponse struct { RequestsToJoinCommunity []*communities.RequestToJoin AnonymousMetrics []*appmetrics.AppMetric Mailservers []mailservers.Mailserver + Bookmarks []*browsers.Bookmark // notifications a list of notifications derived from messenger events // that are useful to notify the user about @@ -60,6 +63,7 @@ func (r *MessengerResponse) MarshalJSON() ([]byte, error) { CommunityChanges []*communities.CommunityChanges `json:"communityChanges,omitempty"` RequestsToJoinCommunity []*communities.RequestToJoin `json:"requestsToJoinCommunity,omitempty"` Mailservers []mailservers.Mailserver `json:"mailservers,omitempty"` + Bookmarks []*browsers.Bookmark `json:"bookmarks,omitempty"` ClearedHistories []*ClearedHistory `json:"clearedHistories,omitempty"` // Notifications a list of notifications derived from messenger events // that are useful to notify the user about @@ -76,6 +80,7 @@ func (r *MessengerResponse) MarshalJSON() ([]byte, error) { CommunityChanges: r.CommunityChanges, RequestsToJoinCommunity: r.RequestsToJoinCommunity, Mailservers: r.Mailservers, + Bookmarks: r.Bookmarks, CurrentStatus: r.currentStatus, } @@ -163,6 +168,7 @@ func (r *MessengerResponse) IsEmpty() bool { len(r.messages)+ len(r.pinMessages)+ len(r.Contacts)+ + len(r.Bookmarks)+ len(r.clearedHistories)+ len(r.Installations)+ len(r.Invitations)+ @@ -189,6 +195,7 @@ func (r *MessengerResponse) Merge(response *MessengerResponse) error { len(response.RequestsToJoinCommunity)+ len(response.Mailservers)+ len(response.EmojiReactions)+ + len(response.Bookmarks)+ len(response.clearedHistories)+ len(response.CommunityChanges) != 0 { return ErrNotImplemented @@ -220,6 +227,16 @@ func (r *MessengerResponse) AddCommunity(c *communities.Community) { r.communities[c.IDString()] = c } +func (r *MessengerResponse) AddBookmark(bookmark *browsers.Bookmark) { + r.Bookmarks = append(r.Bookmarks, bookmark) +} + +func (r *MessengerResponse) AddBookmarks(bookmarks []*browsers.Bookmark) { + for _, b := range bookmarks { + r.AddBookmark(b) + } +} + func (r *MessengerResponse) AddChat(c *Chat) { if r.chats == nil { r.chats = make(map[string]*Chat) diff --git a/protocol/messenger_sync_bookmark_test.go b/protocol/messenger_sync_bookmark_test.go new file mode 100644 index 000000000..02923c310 --- /dev/null +++ b/protocol/messenger_sync_bookmark_test.go @@ -0,0 +1,156 @@ +package protocol + +import ( + "context" + "crypto/ecdsa" + "errors" + "testing" + + gethbridge "github.com/status-im/status-go/eth-node/bridge/geth" + "github.com/status-im/status-go/eth-node/crypto" + "github.com/status-im/status-go/protocol/encryption/multidevice" + "github.com/status-im/status-go/protocol/tt" + "github.com/status-im/status-go/services/browsers" + "github.com/status-im/status-go/waku" + + "github.com/stretchr/testify/suite" + "go.uber.org/zap" + + "github.com/status-im/status-go/eth-node/types" +) + +func TestMessengerSyncBookmarkSuite(t *testing.T) { + suite.Run(t, new(MessengerSyncBookmarkSuite)) +} + +type MessengerSyncBookmarkSuite struct { + suite.Suite + m *Messenger // main instance of Messenger + privateKey *ecdsa.PrivateKey // private key for the main instance of Messenger + + // If one wants to send messages between different instances of Messenger, + // a single Waku service should be shared. + shh types.Waku + + logger *zap.Logger +} + +func (s *MessengerSyncBookmarkSuite) SetupTest() { + s.logger = tt.MustCreateTestLogger() + + config := waku.DefaultConfig + config.MinimumAcceptedPoW = 0 + shh := waku.New(&config, s.logger) + s.shh = gethbridge.NewGethWakuWrapper(shh) + s.Require().NoError(shh.Start()) + + s.m = s.newMessenger(s.shh) + s.privateKey = s.m.identity + // We start the messenger in order to receive installations + _, err := s.m.Start() + s.Require().NoError(err) +} + +func (s *MessengerSyncBookmarkSuite) TearDownTest() { + s.Require().NoError(s.m.Shutdown()) +} + +func (s *MessengerSyncBookmarkSuite) newMessenger(shh types.Waku) *Messenger { + privateKey, err := crypto.GenerateKey() + s.Require().NoError(err) + + messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil) + s.Require().NoError(err) + + return messenger +} + +func (s *MessengerSyncBookmarkSuite) TestSyncBookmark() { + //add bookmark + bookmark := browsers.Bookmark{ + Name: "status official site", + URL: "https://status.im", + Removed: false, + } + _, err := s.m.browserDatabase.StoreBookmark(bookmark) + s.Require().NoError(err) + + // pair + theirMessenger, err := newMessengerWithKey(s.shh, s.privateKey, s.logger, nil) + s.Require().NoError(err) + + err = theirMessenger.SetInstallationMetadata(theirMessenger.installationID, &multidevice.InstallationMetadata{ + Name: "their-name", + DeviceType: "their-device-type", + }) + s.Require().NoError(err) + response, err := theirMessenger.SendPairInstallation(context.Background()) + s.Require().NoError(err) + s.Require().NotNil(response) + s.Require().Len(response.Chats(), 1) + s.Require().False(response.Chats()[0].Active) + + // Wait for the message to reach its destination + response, err = WaitOnMessengerResponse( + s.m, + func(r *MessengerResponse) bool { return len(r.Installations) > 0 }, + "installation not received", + ) + + s.Require().NoError(err) + actualInstallation := response.Installations[0] + s.Require().Equal(theirMessenger.installationID, actualInstallation.ID) + s.Require().NotNil(actualInstallation.InstallationMetadata) + s.Require().Equal("their-name", actualInstallation.InstallationMetadata.Name) + s.Require().Equal("their-device-type", actualInstallation.InstallationMetadata.DeviceType) + + err = s.m.EnableInstallation(theirMessenger.installationID) + s.Require().NoError(err) + + // sync + err = s.m.SyncBookmark(context.Background(), &bookmark) + s.Require().NoError(err) + + // Wait for the message to reach its destination + err = tt.RetryWithBackOff(func() error { + response, err = theirMessenger.RetrieveAll() + if err != nil { + return err + } + if response.Bookmarks != nil { + return nil + } + return errors.New("Not received all bookmarks") + }) + + s.Require().NoError(err) + + bookmarks, err := theirMessenger.browserDatabase.GetBookmarks() + s.Require().NoError(err) + s.Require().Equal(1, len(bookmarks)) + s.Require().False(bookmarks[0].Removed) + + // sync removed state + bookmark.Removed = true + err = s.m.SyncBookmark(context.Background(), &bookmark) + s.Require().NoError(err) + + // Wait for the message to reach its destination + err = tt.RetryWithBackOff(func() error { + response, err = theirMessenger.RetrieveAll() + if err != nil { + return err + } + if response.Bookmarks != nil { + return nil + } + return errors.New("Not received all bookmarks") + }) + bookmarks, err = theirMessenger.browserDatabase.GetBookmarks() + s.Require().NoError(err) + s.Require().Equal(1, len(bookmarks)) + s.Require().True(bookmarks[0].Removed) + + s.Require().NoError(theirMessenger.Shutdown()) + +} diff --git a/protocol/messenger_test.go b/protocol/messenger_test.go index 6ac6453db..e2e2996c6 100644 --- a/protocol/messenger_test.go +++ b/protocol/messenger_test.go @@ -131,6 +131,7 @@ func newMessengerWithKey(shh types.Waku, privateKey *ecdsa.PrivateKey, logger *z WithDatasync(), WithToplevelDatabaseMigrations(), WithAppSettings(accounts.Settings{}, params.NodeConfig{}), + WithBrowserDatabase(nil), } options = append(options, extraOptions...) diff --git a/protocol/protobuf/application_metadata_message.pb.go b/protocol/protobuf/application_metadata_message.pb.go index e7f214c72..727da32bc 100644 --- a/protocol/protobuf/application_metadata_message.pb.go +++ b/protocol/protobuf/application_metadata_message.pb.go @@ -63,6 +63,7 @@ const ( ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_READ ApplicationMetadataMessage_Type = 37 ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_ACCEPTED ApplicationMetadataMessage_Type = 38 ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_DISMISSED ApplicationMetadataMessage_Type = 39 + ApplicationMetadataMessage_SYNC_BOOKMARK ApplicationMetadataMessage_Type = 40 ApplicationMetadataMessage_SYNC_CLEAR_HISTORY ApplicationMetadataMessage_Type = 41 ) @@ -107,6 +108,7 @@ var ApplicationMetadataMessage_Type_name = map[int32]string{ 37: "SYNC_ACTIVITY_CENTER_READ", 38: "SYNC_ACTIVITY_CENTER_ACCEPTED", 39: "SYNC_ACTIVITY_CENTER_DISMISSED", + 40: "SYNC_BOOKMARK", 41: "SYNC_CLEAR_HISTORY", } @@ -151,6 +153,7 @@ var ApplicationMetadataMessage_Type_value = map[string]int32{ "SYNC_ACTIVITY_CENTER_READ": 37, "SYNC_ACTIVITY_CENTER_ACCEPTED": 38, "SYNC_ACTIVITY_CENTER_DISMISSED": 39, + "SYNC_BOOKMARK": 40, "SYNC_CLEAR_HISTORY": 41, } @@ -230,49 +233,49 @@ func init() { } var fileDescriptor_ad09a6406fcf24c7 = []byte{ - // 692 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x4d, 0x53, 0x23, 0x37, - 0x10, 0x8d, 0x77, 0x09, 0x2c, 0x6d, 0x60, 0x85, 0x96, 0x0f, 0x63, 0x16, 0xf0, 0x1a, 0xc2, 0x47, - 0x52, 0xe5, 0x54, 0x25, 0xc7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0xbc, 0x41, 0xbe, 0x8d, 0xb6, 0x2a, 0x6b, 0xd9, 0x60, 0xa4, 0x5b, - 0x28, 0x48, 0x35, 0x4c, 0x6d, 0x1c, 0x1e, 0x94, 0xb2, 0x41, 0x40, 0x41, 0x76, 0x29, 0xc0, 0x6c, - 0x9d, 0xf1, 0xb3, 0x24, 0x26, 0x7b, 0x23, 0x47, 0x06, 0x65, 0x5b, 0xa1, 0x53, 0x8e, 0xca, 0xa1, - 0xc9, 0xa9, 0x3f, 0x8c, 0x1c, 0xf9, 0x12, 0xce, 0xb7, 0x11, 0x05, 0xd9, 0x0f, 0x8e, 0x9b, 0x4a, - 0x11, 0xd2, 0x46, 0xd2, 0x5a, 0x14, 0xe4, 0x80, 0xae, 0x01, 0xcd, 0x9f, 0xd3, 0x44, 0x66, 0x7c, - 0x43, 0x5a, 0xa7, 0x4d, 0x9b, 0x1c, 0xd5, 0x17, 0xff, 0x2c, 0xd6, 0x7e, 0xfe, 0x6d, 0xf8, 0xe9, - 0xba, 0x98, 0xcd, 0xfe, 0xfd, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x61, 0x34, 0xbb, - 0x61, 0x05, 0x00, 0x00, + // 704 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xdb, 0x52, 0x23, 0x37, + 0x10, 0x8d, 0x77, 0x09, 0x2c, 0x6d, 0x60, 0x85, 0x96, 0x8b, 0x31, 0x0b, 0x78, 0xbd, 0x1b, 0x2e, + 0x49, 0x95, 0x53, 0x95, 0x3c, 0xa6, 0xf2, 0x20, 0x4b, 0x0d, 0x16, 0xf6, 0x48, 0x83, 0xa4, 0x71, + 0xca, 0x79, 0x51, 0x0d, 0xc1, 0xa1, 0xa8, 0x02, 0xec, 0x02, 0xf3, 0xc0, 0x8f, 0xe4, 0x2b, 0xf2, + 0x91, 0x29, 0xcd, 0xf8, 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9, 0x36, 0x76, 0x64, 0x50, 0xb6, 0x1d, 0x3a, 0xe5, 0xa8, + 0x1c, 0x9a, 0x9c, 0xfa, 0xc3, 0xd8, 0x91, 0xcf, 0xe1, 0x7c, 0x1b, 0x51, 0x90, 0xfd, 0xe0, 0xb8, + 0x99, 0x14, 0x21, 0x6d, 0x24, 0xad, 0x45, 0x41, 0x0e, 0x32, 0x25, 0x02, 0xa7, 0xae, 0x75, 0x33, + 0x62, 0xa6, 0x49, 0x0e, 0xe9, 0x06, 0xd0, 0xfc, 0x85, 0x2d, 0x64, 0xc6, 0x37, 0xa4, 0x75, 0xda, + 0x74, 0xc8, 0x51, 0x7d, 0xf9, 0xcf, 0x62, 0xed, 0xe7, 0xdf, 0x46, 0x5f, 0xb3, 0xf3, 0xf9, 0xec, + 0xdf, 0xaf, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x84, 0x31, 0xd9, 0x7d, 0x74, 0x05, 0x00, 0x00, } diff --git a/protocol/protobuf/application_metadata_message.proto b/protocol/protobuf/application_metadata_message.proto index 324292efa..efaa2dfe9 100644 --- a/protocol/protobuf/application_metadata_message.proto +++ b/protocol/protobuf/application_metadata_message.proto @@ -53,6 +53,7 @@ message ApplicationMetadataMessage { SYNC_ACTIVITY_CENTER_READ = 37; SYNC_ACTIVITY_CENTER_ACCEPTED = 38; SYNC_ACTIVITY_CENTER_DISMISSED = 39; + SYNC_BOOKMARK = 40; SYNC_CLEAR_HISTORY = 41; } } diff --git a/protocol/protobuf/pairing.pb.go b/protocol/protobuf/pairing.pb.go index c3ecc6535..e05bb9011 100644 --- a/protocol/protobuf/pairing.pb.go +++ b/protocol/protobuf/pairing.pb.go @@ -934,6 +934,77 @@ func (m *SyncActivityCenterDismissed) GetIds() [][]byte { return nil } +type SyncBookmark struct { + Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + ImageUrl string `protobuf:"bytes,4,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"` + Removed bool `protobuf:"varint,5,opt,name=removed,proto3" json:"removed,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SyncBookmark) Reset() { *m = SyncBookmark{} } +func (m *SyncBookmark) String() string { return proto.CompactTextString(m) } +func (*SyncBookmark) ProtoMessage() {} +func (*SyncBookmark) Descriptor() ([]byte, []int) { + return fileDescriptor_d61ab7221f0b5518, []int{14} +} + +func (m *SyncBookmark) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SyncBookmark.Unmarshal(m, b) +} +func (m *SyncBookmark) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SyncBookmark.Marshal(b, m, deterministic) +} +func (m *SyncBookmark) XXX_Merge(src proto.Message) { + xxx_messageInfo_SyncBookmark.Merge(m, src) +} +func (m *SyncBookmark) XXX_Size() int { + return xxx_messageInfo_SyncBookmark.Size(m) +} +func (m *SyncBookmark) XXX_DiscardUnknown() { + xxx_messageInfo_SyncBookmark.DiscardUnknown(m) +} + +var xxx_messageInfo_SyncBookmark proto.InternalMessageInfo + +func (m *SyncBookmark) GetClock() uint64 { + if m != nil { + return m.Clock + } + return 0 +} + +func (m *SyncBookmark) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + +func (m *SyncBookmark) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SyncBookmark) GetImageUrl() string { + if m != nil { + return m.ImageUrl + } + return "" +} + +func (m *SyncBookmark) GetRemoved() bool { + if m != nil { + return m.Removed + } + return false +} + type SyncClearHistory struct { ChatId string `protobuf:"bytes,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` ClearedAt uint64 `protobuf:"varint,2,opt,name=cleared_at,json=clearedAt,proto3" json:"cleared_at,omitempty"` @@ -946,7 +1017,7 @@ func (m *SyncClearHistory) Reset() { *m = SyncClearHistory{} } func (m *SyncClearHistory) String() string { return proto.CompactTextString(m) } func (*SyncClearHistory) ProtoMessage() {} func (*SyncClearHistory) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{14} + return fileDescriptor_d61ab7221f0b5518, []int{15} } func (m *SyncClearHistory) XXX_Unmarshal(b []byte) error { @@ -996,6 +1067,7 @@ func init() { proto.RegisterType((*SyncActivityCenterRead)(nil), "protobuf.SyncActivityCenterRead") proto.RegisterType((*SyncActivityCenterAccepted)(nil), "protobuf.SyncActivityCenterAccepted") proto.RegisterType((*SyncActivityCenterDismissed)(nil), "protobuf.SyncActivityCenterDismissed") + proto.RegisterType((*SyncBookmark)(nil), "protobuf.SyncBookmark") proto.RegisterType((*SyncClearHistory)(nil), "protobuf.SyncClearHistory") } @@ -1004,59 +1076,62 @@ func init() { } var fileDescriptor_d61ab7221f0b5518 = []byte{ - // 850 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0x1f, 0xd9, 0x8e, 0xed, 0x3c, 0xcb, 0x69, 0x66, 0x27, 0xd3, 0x6c, 0xcb, 0x74, 0xea, 0xaa, - 0x74, 0xc8, 0x29, 0x30, 0xe5, 0xc0, 0x30, 0x85, 0x01, 0xc7, 0x65, 0xc0, 0x05, 0x4a, 0x47, 0xa4, - 0x1c, 0xb8, 0x68, 0x36, 0xab, 0x17, 0x67, 0x89, 0xa4, 0x15, 0xda, 0x95, 0x19, 0x7d, 0x01, 0x0e, - 0x1c, 0xe1, 0x83, 0xf1, 0x3d, 0xf8, 0x14, 0xcc, 0xee, 0xca, 0x8a, 0x9c, 0xe0, 0xc4, 0x1c, 0x7b, - 0x92, 0xde, 0x6f, 0xdf, 0xbf, 0xfd, 0xbd, 0xdf, 0x5b, 0x18,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0b, 0x77, 0x6b, 0x64, 0xaa, 0x4f, 0xc6, 0x3f, 0x8f, 0x8e, 0x3f, 0x7c, 0xb1, 0x9a, 0xdd, 0x59, - 0xdf, 0xfe, 0x7d, 0xfc, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9f, 0xa6, 0x11, 0x2d, 0xf0, 0x08, - 0x00, 0x00, + // 897 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x4f, 0x73, 0xdb, 0x44, + 0x14, 0x1f, 0x59, 0x8e, 0x2d, 0x3f, 0xcb, 0x69, 0x66, 0x27, 0xd3, 0xa8, 0xed, 0x74, 0xea, 0xaa, + 0x74, 0xc8, 0x29, 0x30, 0xe5, 0xc0, 0x30, 0x85, 0x01, 0xc7, 0x65, 0xc0, 0x05, 0x4a, 0x47, 0x24, + 0x1c, 0xb8, 0x68, 0x36, 0xab, 0x8d, 0xb3, 0x58, 0xd2, 0x8a, 0xdd, 0x95, 0x19, 0x1d, 0xb9, 0x70, + 0xe0, 0x08, 0x1f, 0x8c, 0xef, 0xc1, 0xa7, 0x60, 0x76, 0x57, 0x56, 0xe4, 0x04, 0x3b, 0xe6, 0xd8, + 0x93, 0xf6, 0xfd, 0xde, 0xdf, 0xfd, 0xed, 0x7b, 0x4f, 0x30, 0x2a, 0x30, 0x13, 0x2c, 0x9f, 0x9f, + 0x14, 0x82, 0x2b, 0x8e, 0x3c, 0xf3, 0xb9, 0x28, 0x2f, 0x43, 0x0e, 0xbd, 0x53, 0x4c, 0x16, 0x65, + 0x81, 0x0e, 0x61, 0x8f, 0xa4, 0x9c, 0x2c, 0x02, 0x67, 0xec, 0x1c, 0x77, 0x23, 0x2b, 0xa0, 0x7d, + 0xe8, 0xb0, 0x24, 0xe8, 0x8c, 0x9d, 0xe3, 0x41, 0xd4, 0x61, 0x09, 0xfa, 0x1c, 0x3c, 0xc2, 0x73, + 0x85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xfa, 0x69, 0x78, 0xf2, 0xc1, 0xcb, 0x55, 0xff, 0x5c, 0xf4, + 0xcc, 0xe9, 0xa3, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x77, 0xfe, 0x84, 0xb1, 0x74, 0x09, 0x00, + 0x00, } diff --git a/protocol/protobuf/pairing.proto b/protocol/protobuf/pairing.proto index 792298f62..f7a1691b9 100644 --- a/protocol/protobuf/pairing.proto +++ b/protocol/protobuf/pairing.proto @@ -106,6 +106,14 @@ message SyncActivityCenterDismissed { repeated bytes ids = 2; } +message SyncBookmark { + uint64 clock = 1; + string url = 2; + string name = 3; + string image_url = 4; + bool removed = 5; +} + message SyncClearHistory { string chat_id = 1; uint64 cleared_at = 2; diff --git a/protocol/v1/status_message.go b/protocol/v1/status_message.go index 642d6db54..2b3cd0962 100644 --- a/protocol/v1/status_message.go +++ b/protocol/v1/status_message.go @@ -263,6 +263,8 @@ func (m *StatusMessage) HandleApplication() error { return m.unmarshalProtobufData(new(protobuf.SyncActivityCenterAccepted)) case protobuf.ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_DISMISSED: return m.unmarshalProtobufData(new(protobuf.SyncActivityCenterDismissed)) + case protobuf.ApplicationMetadataMessage_SYNC_BOOKMARK: + return m.unmarshalProtobufData(new(protobuf.SyncBookmark)) case protobuf.ApplicationMetadataMessage_SYNC_CLEAR_HISTORY: return m.unmarshalProtobufData(new(protobuf.SyncClearHistory)) } diff --git a/services/browsers/api.go b/services/browsers/api.go index 38150ddf0..402ab5449 100644 --- a/services/browsers/api.go +++ b/services/browsers/api.go @@ -54,3 +54,10 @@ func (api *API) DeleteBookmark(ctx context.Context, url string) error { log.Debug("result from database for remove a bookmark", "err", err) return err } + +func (api *API) RemoveBookmark(ctx context.Context, url string) error { + log.Debug("call to remove a bookmark logically") + err := api.db.RemoveBookmark(url) + log.Debug("result from database for remove a bookmark logically", "err", err) + return err +} diff --git a/services/browsers/api_test.go b/services/browsers/api_test.go index 72b6d706d..0f504af73 100644 --- a/services/browsers/api_test.go +++ b/services/browsers/api_test.go @@ -148,8 +148,41 @@ func TestBookmarks(t *testing.T) { require.NoError(t, err) require.Len(t, rst, 1) + err = api.RemoveBookmark(context.TODO(), bookmark.URL) + require.NoError(t, err) + rst, err = api.GetBookmarks(context.TODO()) + require.NoError(t, err) + require.Len(t, rst, 1) + require.Equal(t, rst[0].Removed, true) + require.NoError(t, api.DeleteBookmark(context.TODO(), bookmark.URL)) rst, err = api.GetBookmarks(context.TODO()) require.NoError(t, err) require.Len(t, rst, 0) + +} + +func TestShouldSyncBookmark(t *testing.T) { + api, cancel := setupTestAPI(t) + defer cancel() + + bookmark := &Bookmark{ + Name: "MyBookmark", + URL: "https://status.im", + ImageURL: "", + Clock: 1, + } + + _, err := api.StoreBookmark(context.TODO(), *bookmark) + require.NoError(t, err) + + bookmark.Clock = 2 + shouldSync, err := api.db.shouldSyncBookmark(bookmark, nil) + require.NoError(t, err) + require.True(t, shouldSync) + + bookmark.Clock = 0 + shouldSync, err = api.db.shouldSyncBookmark(bookmark, nil) + require.NoError(t, err) + require.False(t, shouldSync) } diff --git a/services/browsers/database.go b/services/browsers/database.go index 9f72ee859..916030875 100644 --- a/services/browsers/database.go +++ b/services/browsers/database.go @@ -1,6 +1,7 @@ package browsers import ( + "context" "database/sql" "github.com/mat/besticon/besticon" @@ -133,10 +134,12 @@ type Bookmark struct { URL string `json:"url"` Name string `json:"name"` ImageURL string `json:"imageUrl"` + Removed bool `json:"removed"` + Clock uint64 `json:"-"` //used to sync } func (db *Database) GetBookmarks() ([]*Bookmark, error) { - rows, err := db.db.Query(`SELECT url, name, image_url FROM bookmarks`) + rows, err := db.db.Query(`SELECT url, name, image_url, removed FROM bookmarks`) if err != nil { return nil, err } @@ -145,7 +148,7 @@ func (db *Database) GetBookmarks() ([]*Bookmark, error) { var rst []*Bookmark for rows.Next() { bookmark := &Bookmark{} - err := rows.Scan(&bookmark.URL, &bookmark.Name, &bookmark.ImageURL) + err := rows.Scan(&bookmark.URL, &bookmark.Name, &bookmark.ImageURL, &bookmark.Removed) if err != nil { return nil, err } @@ -157,7 +160,7 @@ func (db *Database) GetBookmarks() ([]*Bookmark, error) { } func (db *Database) StoreBookmark(bookmark Bookmark) (Bookmark, error) { - insert, err := db.db.Prepare("INSERT OR REPLACE INTO bookmarks (url, name, image_url) VALUES (?, ?, ?)") + insert, err := db.db.Prepare("INSERT OR REPLACE INTO bookmarks (url, name, image_url, removed, clock) VALUES (?, ?, ?, ?, ?)") if err != nil { return bookmark, err @@ -178,16 +181,107 @@ func (db *Database) StoreBookmark(bookmark Bookmark) (Bookmark, error) { log.Error("error getting the bookmark icon", "iconError", iconError) } - _, err = insert.Exec(bookmark.URL, bookmark.Name, bookmark.ImageURL) + _, err = insert.Exec(bookmark.URL, bookmark.Name, bookmark.ImageURL, bookmark.Removed, bookmark.Clock) return bookmark, err } -func (db *Database) UpdateBookmark(originalURL string, bookmark Bookmark) error { - insert, err := db.db.Prepare("UPDATE bookmarks SET url = ?, name = ?, image_url = ? WHERE url = ?") +func (db *Database) StoreBookmarkWithoutFetchIcon(bookmark *Bookmark, tx *sql.Tx) (err error) { + if tx == nil { + tx, err = db.db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + defer func() { + if err == nil { + err = tx.Commit() + return + } + // don't shadow original error + _ = tx.Rollback() + }() + } + + insert, err := tx.Prepare("INSERT OR REPLACE INTO bookmarks (url, name, image_url, removed, clock) VALUES (?, ?, ?, ?, ?)") + if err != nil { return err } - _, err = insert.Exec(bookmark.URL, bookmark.Name, bookmark.ImageURL, originalURL) + + defer insert.Close() + + _, err = insert.Exec(bookmark.URL, bookmark.Name, bookmark.ImageURL, bookmark.Removed, bookmark.Clock) + return err +} + +func (db *Database) StoreSyncBookmarks(bookmarks []*Bookmark) ([]*Bookmark, error) { + tx, err := db.db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return nil, err + } + + defer func() { + if err == nil { + err = tx.Commit() + return + } + // don't shadow original error + _ = tx.Rollback() + }() + + var storedBookmarks []*Bookmark + for _, bookmark := range bookmarks { + shouldSync, err := db.shouldSyncBookmark(bookmark, tx) + if err != nil { + return storedBookmarks, err + } + if shouldSync { + err := db.StoreBookmarkWithoutFetchIcon(bookmark, tx) + if err != nil { + return storedBookmarks, err + } + storedBookmarks = append(storedBookmarks, bookmark) + } + } + return storedBookmarks, nil +} + +func (db *Database) shouldSyncBookmark(bookmark *Bookmark, tx *sql.Tx) (shouldSync bool, err error) { + if tx == nil { + tx, err = db.db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return false, err + } + defer func() { + if err == nil { + err = tx.Commit() + return + } + // don't shadow original error + _ = tx.Rollback() + }() + } + qr := tx.QueryRow(`SELECT 1 FROM bookmarks WHERE url = ? AND clock > ?`, bookmark.URL, bookmark.Clock) + var result int + err = qr.Scan(&result) + switch err { + case sql.ErrNoRows: + // Query does not match, therefore synced_at value is not older than the new clock value or id was not found + return true, nil + case nil: + // Error is nil, therefore query matched and synced_at is older than the new clock + return false, nil + default: + // Error is not nil and is not sql.ErrNoRows, therefore pass out the error + return false, err + } +} + +func (db *Database) UpdateBookmark(originalURL string, bookmark Bookmark) error { + insert, err := db.db.Prepare("UPDATE bookmarks SET url = ?, name = ?, image_url = ?, removed = ?, clock = ? WHERE url = ?") + if err != nil { + return err + } + _, err = insert.Exec(bookmark.URL, bookmark.Name, bookmark.ImageURL, bookmark.Removed, bookmark.Clock, originalURL) return err } @@ -195,3 +289,8 @@ func (db *Database) DeleteBookmark(url string) error { _, err := db.db.Exec(`DELETE FROM bookmarks WHERE url = ?`, url) return err } + +func (db *Database) RemoveBookmark(url string) error { + _, err := db.db.Exec(`UPDATE bookmarks SET removed = 1 WHERE url = ?`, url) + return err +} diff --git a/services/ext/api.go b/services/ext/api.go index 0ccea1dbd..8c57c2f85 100644 --- a/services/ext/api.go +++ b/services/ext/api.go @@ -8,6 +8,8 @@ import ( "math/big" "time" + "github.com/status-im/status-go/services/browsers" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p/enode" @@ -684,6 +686,10 @@ func (api *PublicAPI) SyncDevices(ctx context.Context, name, picture string) err return api.service.messenger.SyncDevices(ctx, name, picture) } +func (api *PublicAPI) SyncBookmark(ctx context.Context, bookmark browsers.Bookmark) error { + return api.service.messenger.SyncBookmark(ctx, &bookmark) +} + func (api *PublicAPI) SignMessageWithChatKey(ctx context.Context, message string) (types.HexBytes, error) { return api.service.messenger.SignMessage(message) } diff --git a/services/ext/service.go b/services/ext/service.go index 7a2aaafbc..936c02423 100644 --- a/services/ext/service.go +++ b/services/ext/service.go @@ -11,6 +11,8 @@ import ( "path/filepath" "time" + "github.com/status-im/status-go/services/browsers" + "github.com/syndtr/goleveldb/leveldb" commongethtypes "github.com/ethereum/go-ethereum/common" @@ -411,6 +413,7 @@ func buildMessengerOptions( protocol.WithMultiAccounts(multiAccounts), protocol.WithMailserversDatabase(mailserversDB.NewDB(db)), protocol.WithAccount(account), + protocol.WithBrowserDatabase(browsers.NewDB(db)), protocol.WithEnvelopesMonitorConfig(envelopesMonitorConfig), protocol.WithSignalsHandler(messengerSignalsHandler), protocol.WithENSVerificationConfig(publishMessengerResponse, config.ShhextConfig.VerifyENSURL, config.ShhextConfig.VerifyENSContractAddress),