settings api fixes (#1758)

This commit is contained in:
yenda 2020-01-02 18:01:38 +01:00 committed by GitHub
parent 1d4b3b9241
commit cf2d16d186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 25 deletions

View File

@ -5,7 +5,7 @@
// 0002_tokens.down.sql (19B) // 0002_tokens.down.sql (19B)
// 0002_tokens.up.sql (248B) // 0002_tokens.up.sql (248B)
// 0003_settings.down.sql (118B) // 0003_settings.down.sql (118B)
// 0003_settings.up.sql (1.341kB) // 0003_settings.up.sql (1.311kB)
// doc.go (74B) // doc.go (74B)
package migrations package migrations
@ -90,7 +90,7 @@ func _0001_appDownSql() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "0001_app.down.sql", size: 387, mode: os.FileMode(0644), modTime: time.Unix(1575624282, 0)} info := bindataFileInfo{name: "0001_app.down.sql", size: 387, mode: os.FileMode(0644), modTime: time.Unix(1568971614, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbc, 0x9c, 0xd2, 0xe1, 0x1d, 0x8, 0x34, 0x6a, 0xc8, 0x37, 0x13, 0xb3, 0x9f, 0x26, 0x23, 0x33, 0xd4, 0x25, 0x8, 0xed, 0x53, 0xe6, 0xd, 0x46, 0xc9, 0xf4, 0x24, 0xf8, 0x1, 0x1f, 0xf5, 0xc8}} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbc, 0x9c, 0xd2, 0xe1, 0x1d, 0x8, 0x34, 0x6a, 0xc8, 0x37, 0x13, 0xb3, 0x9f, 0x26, 0x23, 0x33, 0xd4, 0x25, 0x8, 0xed, 0x53, 0xe6, 0xd, 0x46, 0xc9, 0xf4, 0x24, 0xf8, 0x1, 0x1f, 0xf5, 0xc8}}
return a, nil return a, nil
} }
@ -110,7 +110,7 @@ func _0001_appUpSql() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "0001_app.up.sql", size: 3088, mode: os.FileMode(0644), modTime: time.Unix(1576607640, 0)} info := bindataFileInfo{name: "0001_app.up.sql", size: 3088, mode: os.FileMode(0644), modTime: time.Unix(1577451469, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x93, 0xb8, 0x68, 0x17, 0x49, 0x51, 0xc0, 0xe8, 0xbc, 0x36, 0xa4, 0x29, 0xc9, 0x93, 0x6c, 0x3e, 0xdf, 0x3d, 0x23, 0x22, 0xab, 0x18, 0x49, 0xbd, 0x6, 0xf, 0xc5, 0xec, 0xf8, 0xcf, 0x1b, 0x6a}} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x93, 0xb8, 0x68, 0x17, 0x49, 0x51, 0xc0, 0xe8, 0xbc, 0x36, 0xa4, 0x29, 0xc9, 0x93, 0x6c, 0x3e, 0xdf, 0x3d, 0x23, 0x22, 0xab, 0x18, 0x49, 0xbd, 0x6, 0xf, 0xc5, 0xec, 0xf8, 0xcf, 0x1b, 0x6a}}
return a, nil return a, nil
} }
@ -130,7 +130,7 @@ func _0002_tokensDownSql() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(0644), modTime: time.Unix(1576607640, 0)} info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(0644), modTime: time.Unix(1577451469, 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}} 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 return a, nil
} }
@ -150,7 +150,7 @@ func _0002_tokensUpSql() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(0644), modTime: time.Unix(1576607640, 0)} info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(0644), modTime: time.Unix(1577451469, 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}} 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 return a, nil
} }
@ -170,12 +170,12 @@ func _0003_settingsDownSql() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(0644), modTime: time.Unix(1576866163, 0)} info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(0644), modTime: time.Unix(1577451469, 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}} 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 return a, nil
} }
var __0003_settingsUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x94\xbd\x6e\xdb\x30\x10\xc7\x77\x3f\x05\xb7\xb4\x40\x87\x66\x28\x50\x20\x93\x1c\xab\x89\x50\x57\x0a\x54\xb9\x41\x26\x82\x26\xcf\xd6\xc1\x14\x8f\xe0\x51\x36\xfc\xf6\x85\x1c\x59\x56\x53\xd9\xa3\x78\xbf\xfb\xbe\xbf\x16\x65\xf1\x22\xaa\x64\xbe\x4c\x05\x43\x8c\xe8\xb6\xfc\x30\x7b\x2c\xd3\xa4\x4a\x3f\x3c\x8b\x4f\x33\x21\x94\x31\x01\x98\xc5\x9f\xa4\x7c\x7c\x4e\x4a\x91\x17\x95\xc8\x57\xcb\xe5\x97\x99\x10\xba\x56\xc4\xb2\x21\x03\x62\x5e\x14\xcb\x34\xc9\xc5\x22\xfd\x91\xac\x96\x95\xd8\x28\xcb\x70\x62\xda\x10\xc0\xe9\xe3\x10\xe0\x4c\xdc\xb5\x6c\xee\x2e\x44\x94\x0e\xe2\x81\xc2\x6e\x3a\x53\xcb\x91\x1a\xb9\x26\x8a\x8e\x0c\xb0\x98\x2f\x8b\xf9\x94\x41\x82\x53\x6b\x0b\x66\x00\x8c\xf2\x9e\xe5\xad\x2e\x00\xfd\xfd\xb7\xef\xf7\x37\x99\x8d\x05\x88\x67\x4b\xf7\x50\xa3\x01\x59\x53\x03\x32\x12\xd9\x88\xfe\xfa\x04\xd0\x71\x54\xd6\xaa\x88\xe4\x24\x9a\xc9\xf8\x3b\x38\xca\xf6\xba\x4d\xab\x60\xe4\x29\x8e\xd3\x30\x06\xc7\x76\xaf\x30\x80\x91\xe4\xc4\x2a\xff\x9d\x3d\xe5\xe9\x42\xcc\xb3\xa7\x2c\xaf\x3e\x42\xe8\xb6\x63\x7f\xab\x38\xca\xd6\x1b\x15\xc1\x4c\xb9\x5a\x15\x81\xa3\x34\x10\x70\x0f\x5d\x84\x58\x5f\xb0\x2c\xaf\x86\x8e\xbf\x9e\x68\xda\x4a\x0b\x7b\xb0\xe3\x14\x8d\x83\x86\x1c\xea\xf1\x9b\x53\x0d\x4c\xf6\xdb\xdf\xc1\xfb\x8e\xff\xb5\x90\x01\xa9\xc9\x6d\x70\x3b\xec\xd7\x51\xc4\x0d\xea\xd3\x74\x47\xdb\xbf\xb6\x0c\x5f\x53\xa4\xf7\x1e\xfe\x0b\xef\xd1\x39\x30\xb2\x51\x68\x19\xc2\x1e\xc2\xe5\xcc\x7c\x80\x0d\x84\x6e\xbc\xe3\xb2\x7b\xcb\x1e\xe1\x20\x7d\xc0\xbd\xd2\xc7\x1b\x99\xdb\xb5\x45\x2d\x77\x70\x9c\xec\x3a\x40\x03\xcd\x1a\x82\xe4\xa3\xd3\xe8\xb6\x52\xd7\x84\xfa\x86\xb0\xb8\xa6\xc3\x7b\x35\x3d\x72\x7a\xc4\xad\xeb\x9c\x7d\x1d\x14\x4f\x8f\x97\x23\xea\x1d\x04\x96\x5e\xe9\x1d\xcb\xfe\x3a\x47\x8a\x19\x80\x00\xba\xd3\xe5\xf9\xfb\x02\xf4\x15\x92\x93\x0d\xad\xd1\xc2\x20\xdd\xeb\xc5\x1e\x5d\xac\x21\xa2\x1e\x0b\x60\xf8\x13\xa0\xb9\x13\x2f\x65\xf6\x2b\x29\xdf\xc4\xcf\xf4\xad\x73\x68\x19\x42\xd7\xdc\x25\xeb\xa1\xab\x32\xca\x40\x14\x6f\x4a\xb5\xe7\x18\xba\xa3\x96\x5e\x31\xdf\xba\x87\x9e\xde\x23\xe3\xda\x76\x62\xde\x81\x1b\xe2\xce\x3e\x8b\xd7\xac\x7a\x2e\x56\x95\x28\x8b\xd7\x6c\xf1\x30\xfb\x1b\x00\x00\xff\xff\xa5\xef\xfe\xe7\x3d\x05\x00\x00") var __0003_settingsUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x93\xbd\x6e\xdb\x30\x10\xc7\x77\x3f\x05\xb7\xb4\x40\x87\x66\x28\x50\x20\x93\x1c\xab\x89\x50\x57\x0a\x54\xb9\x41\xa6\x03\x4d\x9e\xad\x83\x29\x92\xe0\x51\x0e\xf4\xf6\x85\x1c\x45\x56\x53\xd9\x23\x79\xbf\xfb\xbe\xff\xaa\x2c\x9e\x44\x95\x2c\xd7\xa9\x60\x8c\x91\xec\x9e\xef\x16\xf7\x65\x9a\x54\xe9\x87\x6f\xf1\x69\x21\x84\xd4\x3a\x20\xb3\xf8\x93\x94\xf7\x8f\x49\x29\xf2\xa2\x12\xf9\x66\xbd\xfe\xb2\x10\x42\xd5\xd2\x31\x34\x4e\xa3\x58\x16\xc5\x3a\x4d\x72\xb1\x4a\x7f\x24\x9b\x75\x25\x76\xd2\x30\x9e\x98\x36\x04\xb4\xaa\x1b\x03\xbc\x13\x37\x2d\xeb\x9b\x33\x11\xc1\x62\x7c\x75\xe1\x30\x9f\xa9\xe5\xe8\x1a\xd8\x3a\x17\xad\xd3\xc8\x62\xb9\x2e\x96\x73\x06\x40\x2b\xb7\x06\xf5\x08\x68\xe9\x3d\xc3\xb5\x2e\x90\xfc\xed\xb7\xef\xb7\x1f\x99\xde\xb4\x33\x88\x71\xfa\x51\x93\x46\xa8\x5d\x83\x10\x9d\x33\x91\xfc\xe5\xc6\xc9\x72\x94\xc6\xc8\x48\xce\x02\xe9\xd9\xd4\x07\xec\xa0\xbd\x6c\x53\x32\x68\x38\xc5\xb1\x0a\xa7\xe0\xd4\xee\x25\x05\xd4\xe0\xac\xd8\xe4\xbf\xb3\x87\x3c\x5d\x89\x65\xf6\x90\xe5\xd5\x47\x88\xec\x7e\xea\x6f\x24\x47\x68\xbd\x96\x11\xf5\x9c\xab\x91\x11\x39\x82\xc6\x40\x47\xec\x23\xc4\xfa\x8c\x65\x79\x35\x76\xfc\xf5\x44\xbb\x3d\x18\x3c\xa2\x99\xa6\x68\x2c\x36\xce\x92\x9a\xfe\x59\xd9\xe0\x6c\xbf\xc3\xfa\xdf\x56\xfb\xaf\xc5\x69\x04\xe5\xec\x8e\xf6\xe3\x5a\xad\x8b\xb4\x23\x75\x9a\xee\x64\xe9\x97\x96\xe1\x6b\x17\xdd\x5b\x0f\xff\x85\xf7\x64\x2d\x6a\x68\x24\x19\xc6\x70\xc4\x70\xbe\x2e\x1f\x70\x87\xa1\x1f\xef\xb4\xec\xc1\x72\x24\x7c\x05\x1f\xe8\x28\x55\x77\x25\x73\xbb\x35\xa4\xe0\x80\xdd\x6c\xd7\x01\x1b\x6c\xb6\x18\x80\x3b\xab\xc8\xee\x41\xd5\x8e\xd4\x15\x3d\x31\xed\x6d\xcf\xf9\x3a\x48\x9e\x9f\x24\x47\x52\x07\x0c\x0c\x5e\xaa\x03\xc3\x70\x88\x13\x4d\x8c\x40\x40\xd5\x2b\xef\xfd\x7d\x06\x86\x62\x9c\x85\xc6\x6d\xc9\xe0\x28\xce\xcb\x75\x75\x36\xd6\x18\x49\x4d\x6f\x7d\xd4\x3a\xe9\x1b\xf1\x54\x66\xbf\x92\xf2\x45\xfc\x4c\x5f\x7a\x87\x96\x31\xf4\x53\x3d\x67\x7d\xed\xab\x8c\x10\x9c\x8b\x57\x05\x3b\x70\x8c\xfd\xfd\x82\x97\xcc\xd7\x56\x3f\xd0\x47\x62\xda\x9a\x5e\xb7\x07\xb4\x63\xdc\xc5\x67\xf1\x9c\x55\x8f\xc5\xa6\x12\x65\xf1\x9c\xad\xee\x16\x7f\x03\x00\x00\xff\xff\xa5\xa1\x7b\x78\x1f\x05\x00\x00")
func _0003_settingsUpSqlBytes() ([]byte, error) { func _0003_settingsUpSqlBytes() ([]byte, error) {
return bindataRead( return bindataRead(
@ -190,8 +190,8 @@ func _0003_settingsUpSql() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "0003_settings.up.sql", size: 1341, mode: os.FileMode(0644), modTime: time.Unix(1576866163, 0)} info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(0644), modTime: time.Unix(1577752862, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xcb, 0x11, 0x7, 0x32, 0x73, 0xa0, 0x71, 0x99, 0x31, 0x49, 0xd0, 0x8, 0x34, 0x54, 0xc7, 0x8c, 0x8, 0x2e, 0x27, 0x91, 0xc7, 0x9d, 0x33, 0x32, 0xe, 0xd8, 0x4e, 0x3f, 0x3f, 0x63, 0x1e, 0x44}} 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 return a, nil
} }
@ -210,7 +210,7 @@ func docGo() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1575624282, 0)} info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1568971614, 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}} 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 return a, nil
} }

View File

@ -7,7 +7,7 @@ CREATE TABLE settings (
custom_bootnodes BLOB, custom_bootnodes BLOB,
custom_bootnodes_enabled BLOB, custom_bootnodes_enabled BLOB,
dapps_address VARCHAR NOT NULL, dapps_address VARCHAR NOT NULL,
eip1581_address VARCHAR NOT NULL, eip1581_address VARCHAR,
fleet VARCHAR, fleet VARCHAR,
hide_home_tooltip BOOLEAN DEFAULT false, hide_home_tooltip BOOLEAN DEFAULT false,
installation_id VARCHAR NOT NULL, installation_id VARCHAR NOT NULL,
@ -29,7 +29,6 @@ CREATE TABLE settings (
preview_privacy BOOLEAN DEFAULT false, preview_privacy BOOLEAN DEFAULT false,
public_key VARCHAR NOT NULL, public_key VARCHAR NOT NULL,
remember_syncing_choice BOOLEAN DEFAULT false, remember_syncing_choice BOOLEAN DEFAULT false,
show_name BOOLEAN,
signing_phrase VARCHAR NOT NULL, signing_phrase VARCHAR NOT NULL,
stickers_packs_installed BLOB, stickers_packs_installed BLOB,
stickers_recent_stickers BLOB, stickers_recent_stickers BLOB,

View File

@ -42,8 +42,8 @@ type Settings struct {
ChaosMode bool `json:"chaos-mode?,omitempty"` ChaosMode bool `json:"chaos-mode?,omitempty"`
Currency string `json:"currency,omitempty"` Currency string `json:"currency,omitempty"`
CurrentNetwork string `json:"networks/current-network"` CurrentNetwork string `json:"networks/current-network"`
CustomBootnodes *json.RawMessage `json:"custom-boot-nodes,omitempty"` CustomBootnodes *json.RawMessage `json:"custom-bootnodes,omitempty"`
CustomBootnodesEnabled *json.RawMessage `json:"custom-boot-nodes-enabled,omitempty"` CustomBootnodesEnabled *json.RawMessage `json:"custom-bootnodes-enabled?,omitempty"`
DappsAddress types.Address `json:"dapps-address"` DappsAddress types.Address `json:"dapps-address"`
EIP1581Address types.Address `json:"eip1581-address"` EIP1581Address types.Address `json:"eip1581-address"`
Fleet *string `json:"fleet,omitempty"` Fleet *string `json:"fleet,omitempty"`
@ -54,7 +54,7 @@ type Settings struct {
KeycardPAiredOn int64 `json:"keycard-paired-on,omitempty"` KeycardPAiredOn int64 `json:"keycard-paired-on,omitempty"`
KeycardPairing string `json:"keycard-pairing,omitempty"` KeycardPairing string `json:"keycard-pairing,omitempty"`
LastUpdated *int64 `json:"last-updated,omitempty"` LastUpdated *int64 `json:"last-updated,omitempty"`
LatestDerivedPath uint `json:"last-derived-path"` LatestDerivedPath uint `json:"latest-derived-path"`
LogLevel *string `json:"log-level,omitempty"` LogLevel *string `json:"log-level,omitempty"`
Mnemonic string `json:"mnemonic,omitempty"` Mnemonic string `json:"mnemonic,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
@ -66,14 +66,13 @@ type Settings struct {
PreviewPrivacy bool `json:"preview-privacy?"` PreviewPrivacy bool `json:"preview-privacy?"`
PublicKey string `json:"public-key"` PublicKey string `json:"public-key"`
RememberSyncingChoice bool `json:"remember-syncing-choice?,omitempty"` RememberSyncingChoice bool `json:"remember-syncing-choice?,omitempty"`
ShowName *bool `json:"show-name?,omitempty"`
SigningPhrase string `json:"signing-phrase"` SigningPhrase string `json:"signing-phrase"`
StickerPacksInstalled *json.RawMessage `json:"stickers-packs-installed,omitempty"` StickerPacksInstalled *json.RawMessage `json:"stickers-packs-installed,omitempty"`
StickersRecentStickers *json.RawMessage `json:"stickers-recent-stickers,omitempty"` StickersRecentStickers *json.RawMessage `json:"stickers-recent-stickers,omitempty"`
SyncingOnMobileNetwork bool `json:"syncing-on-mobile-network?,omitempty"` SyncingOnMobileNetwork bool `json:"syncing-on-mobile-network?,omitempty"`
Usernames *[]string `json:"usernames,omitempty"` Usernames *json.RawMessage `json:"usernames,omitempty"`
WalletRootAddress types.Address `json:"wallet-root-address,omitempty"` WalletRootAddress types.Address `json:"wallet-root-address,omitempty"`
WalletSetupPassed bool `json:"wallet-setup-passed?,omitempty"` WalletSetUpPassed bool `json:"wallet-set-up-passed?,omitempty"`
WalletVisibleTokens *json.RawMessage `json:"wallet/visible-tokens,omitempty"` WalletVisibleTokens *json.RawMessage `json:"wallet/visible-tokens,omitempty"`
} }
@ -152,13 +151,17 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
switch setting { switch setting {
case "chaos-mode?": case "chaos-mode?":
_, ok := value.(bool)
if !ok {
return ErrInvalidConfig
}
update, err = db.db.Prepare("UPDATE settings SET chaos_mode = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET chaos_mode = ? WHERE synthetic_id = 'id'")
case "currency": case "currency":
update, err = db.db.Prepare("UPDATE settings SET currency = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET currency = ? WHERE synthetic_id = 'id'")
case "custom-bootnodes": case "custom-bootnodes":
value = &sqlite.JSONBlob{value} value = &sqlite.JSONBlob{value}
update, err = db.db.Prepare("UPDATE settings SET custom_bootnodes = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET custom_bootnodes = ? WHERE synthetic_id = 'id'")
case "custom-bootnodes-enabled": case "custom-bootnodes-enabled?":
value = &sqlite.JSONBlob{value} value = &sqlite.JSONBlob{value}
update, err = db.db.Prepare("UPDATE settings SET custom_bootnodes_enabled = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET custom_bootnodes_enabled = ? WHERE synthetic_id = 'id'")
case "dapps-address": case "dapps-address":
@ -168,6 +171,10 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
case "fleet": case "fleet":
update, err = db.db.Prepare("UPDATE settings SET fleet = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET fleet = ? WHERE synthetic_id = 'id'")
case "hide-home-tooltip?": case "hide-home-tooltip?":
_, ok := value.(bool)
if !ok {
return ErrInvalidConfig
}
update, err = db.db.Prepare("UPDATE settings SET hide_home_tooltip = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET hide_home_tooltip = ? WHERE synthetic_id = 'id'")
case "keycard-instance_uid": case "keycard-instance_uid":
update, err = db.db.Prepare("UPDATE settings SET keycard_instance_uid = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET keycard_instance_uid = ? WHERE synthetic_id = 'id'")
@ -194,6 +201,10 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
value = &sqlite.JSONBlob{value} value = &sqlite.JSONBlob{value}
update, err = db.db.Prepare("UPDATE settings SET node_config = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET node_config = ? WHERE synthetic_id = 'id'")
case "notifications-enabled?": case "notifications-enabled?":
_, ok := value.(bool)
if !ok {
return ErrInvalidConfig
}
update, err = db.db.Prepare("UPDATE settings SET notifications_enabled = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET notifications_enabled = ? WHERE synthetic_id = 'id'")
case "photo-path": case "photo-path":
update, err = db.db.Prepare("UPDATE settings SET photo_path = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET photo_path = ? WHERE synthetic_id = 'id'")
@ -203,13 +214,19 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
case "preferred-name": case "preferred-name":
update, err = db.db.Prepare("UPDATE settings SET preferred_name = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET preferred_name = ? WHERE synthetic_id = 'id'")
case "preview-privacy?": case "preview-privacy?":
_, ok := value.(bool)
if !ok {
return ErrInvalidConfig
}
update, err = db.db.Prepare("UPDATE settings SET preview_privacy = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET preview_privacy = ? WHERE synthetic_id = 'id'")
case "public-key": case "public-key":
update, err = db.db.Prepare("UPDATE settings SET public_key = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET public_key = ? WHERE synthetic_id = 'id'")
case "remember-syncing-choice?": case "remember-syncing-choice?":
_, ok := value.(bool)
if !ok {
return ErrInvalidConfig
}
update, err = db.db.Prepare("UPDATE settings SET remember_syncing_choice = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET remember_syncing_choice = ? WHERE synthetic_id = 'id'")
case "show-name?":
update, err = db.db.Prepare("UPDATE settings SET show_name = ? WHERE synthetic_id = 'id'")
case "stickers-packs-installed": case "stickers-packs-installed":
value = &sqlite.JSONBlob{value} value = &sqlite.JSONBlob{value}
update, err = db.db.Prepare("UPDATE settings SET stickers_packs_installed = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET stickers_packs_installed = ? WHERE synthetic_id = 'id'")
@ -217,11 +234,19 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
value = &sqlite.JSONBlob{value} value = &sqlite.JSONBlob{value}
update, err = db.db.Prepare("UPDATE settings SET stickers_recent_stickers = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET stickers_recent_stickers = ? WHERE synthetic_id = 'id'")
case "syncing-on-mobile-network?": case "syncing-on-mobile-network?":
_, ok := value.(bool)
if !ok {
return ErrInvalidConfig
}
update, err = db.db.Prepare("UPDATE settings SET syncing_on_mobile_network = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET syncing_on_mobile_network = ? WHERE synthetic_id = 'id'")
case "usernames": case "usernames":
value = &sqlite.JSONBlob{value} value = &sqlite.JSONBlob{value}
update, err = db.db.Prepare("UPDATE settings SET usernames = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET usernames = ? WHERE synthetic_id = 'id'")
case "wallet-set-up-passed?": case "wallet-set-up-passed?":
_, ok := value.(bool)
if !ok {
return ErrInvalidConfig
}
update, err = db.db.Prepare("UPDATE settings SET wallet_set_up_passed = ? WHERE synthetic_id = 'id'") update, err = db.db.Prepare("UPDATE settings SET wallet_set_up_passed = ? WHERE synthetic_id = 'id'")
case "wallet/visible-tokens": case "wallet/visible-tokens":
value = &sqlite.JSONBlob{value} value = &sqlite.JSONBlob{value}
@ -242,7 +267,7 @@ func (db *Database) GetNodeConfig(nodecfg interface{}) error {
func (db *Database) GetSettings() (Settings, error) { func (db *Database) GetSettings() (Settings, error) {
var s Settings var s Settings
err := db.db.QueryRow("SELECT address, 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, log_level, mnemonic, name, networks, notifications_enabled, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, show_name, signing_phrase, stickers_packs_installed, stickers_recent_stickers, syncing_on_mobile_network, usernames, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens FROM settings WHERE synthetic_id = 'id'").Scan( err := db.db.QueryRow("SELECT address, 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, log_level, mnemonic, name, networks, notifications_enabled, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_recent_stickers, syncing_on_mobile_network, usernames, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens FROM settings WHERE synthetic_id = 'id'").Scan(
&s.Address, &s.Address,
&s.ChaosMode, &s.ChaosMode,
&s.Currency, &s.Currency,
@ -271,14 +296,13 @@ func (db *Database) GetSettings() (Settings, error) {
&s.PreviewPrivacy, &s.PreviewPrivacy,
&s.PublicKey, &s.PublicKey,
&s.RememberSyncingChoice, &s.RememberSyncingChoice,
&s.ShowName,
&s.SigningPhrase, &s.SigningPhrase,
&s.StickerPacksInstalled, &s.StickerPacksInstalled,
&s.StickersRecentStickers, &s.StickersRecentStickers,
&s.SyncingOnMobileNetwork, &s.SyncingOnMobileNetwork,
&s.Usernames, &s.Usernames,
&s.WalletRootAddress, &s.WalletRootAddress,
&s.WalletSetupPassed, &s.WalletSetUpPassed,
&s.WalletVisibleTokens) &s.WalletVisibleTokens)
return s, err return s, err
} }

View File

@ -24,7 +24,6 @@ var (
Address: types.HexToAddress("0xdC540f3745Ff2964AFC1171a5A0DD726d1F6B472"), Address: types.HexToAddress("0xdC540f3745Ff2964AFC1171a5A0DD726d1F6B472"),
CurrentNetwork: "mainnet_rpc", CurrentNetwork: "mainnet_rpc",
DappsAddress: types.HexToAddress("0xD1300f99fDF7346986CbC766903245087394ecd0"), DappsAddress: types.HexToAddress("0xD1300f99fDF7346986CbC766903245087394ecd0"),
EIP1581Address: types.HexToAddress("0xB1DDDE9235a541d1344550d969715CF43982de9f"),
InstallationID: "d3efcff6-cffa-560e-a547-21d3858cbc51", InstallationID: "d3efcff6-cffa-560e-a547-21d3858cbc51",
KeyUID: "0x4e8129f3edfc004875be17bf468a784098a9f69b53c095be1f52deff286935ab", KeyUID: "0x4e8129f3edfc004875be17bf468a784098a9f69b53c095be1f52deff286935ab",
LatestDerivedPath: 0, LatestDerivedPath: 0,