feat: Move Tenor Api to status_go (#2505)
This commit is contained in:
parent
ac31ccc080
commit
6e1eece545
|
@ -1,6 +1,7 @@
|
|||
// Code generated by go-bindata.
|
||||
// sources:
|
||||
// 1640111208_dummy.up.sql
|
||||
// 1901001000_gif_api_key_setting.up.sql
|
||||
// doc.go
|
||||
// DO NOT EDIT!
|
||||
|
||||
|
@ -84,7 +85,27 @@ func _1640111208_dummyUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __1901001000_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 _1901001000_gif_api_key_settingUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__1901001000_gif_api_key_settingUpSql,
|
||||
"1901001000_gif_api_key_setting.up.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _1901001000_gif_api_key_settingUpSql() (*asset, error) {
|
||||
bytes, err := _1901001000_gif_api_key_settingUpSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1901001000_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(436), modTime: time.Unix(1643224299, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -104,7 +125,7 @@ func docGo() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(436), modTime: time.Unix(1641317704, 0)}
|
||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -162,6 +183,7 @@ func AssetNames() []string {
|
|||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"1640111208_dummy.up.sql": _1640111208_dummyUpSql,
|
||||
"1901001000_gif_api_key_setting.up.sql": _1901001000_gif_api_key_settingUpSql,
|
||||
"doc.go": docGo,
|
||||
}
|
||||
|
||||
|
@ -206,6 +228,7 @@ type bintree struct {
|
|||
}
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"1640111208_dummy.up.sql": &bintree{_1640111208_dummyUpSql, map[string]*bintree{}},
|
||||
"1901001000_gif_api_key_setting.up.sql": &bintree{_1901001000_gif_api_key_settingUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE settings ADD COLUMN gif_api_key TEXT NOT NULL DEFAULT "";
|
||||
UPDATE settings SET gif_api_key = "";
|
|
@ -136,7 +136,7 @@ func _0001_appDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0001_app.down.sql", size: 356, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0001_app.down.sql", size: 356, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ func _0001_appUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0001_app.up.sql", size: 2967, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0001_app.up.sql", size: 2967, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ func _0002_tokensDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ func _0002_tokensUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ func _0003_settingsDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ func _0003_settingsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ func _0004_pending_stickersDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0004_pending_stickers.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0004_pending_stickers.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ func _0004_pending_stickersUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0004_pending_stickers.up.sql", size: 61, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0004_pending_stickers.up.sql", size: 61, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ func _0005_waku_modeDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0005_waku_mode.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0005_waku_mode.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ func _0005_waku_modeUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0005_waku_mode.up.sql", size: 146, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0005_waku_mode.up.sql", size: 146, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ func _0006_appearanceUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -356,7 +356,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0007_enable_waku_default.up.sql", size: 38, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -376,7 +376,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0008_add_push_notifications.up.sql", size: 349, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -396,7 +396,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0009_enable_sending_push_notifications.down.sql", size: 49, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -416,7 +416,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0009_enable_sending_push_notifications.up.sql", size: 49, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -436,7 +436,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0010_add_block_mentions.down.sql", size: 83, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -456,7 +456,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0010_add_block_mentions.up.sql", size: 89, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -476,7 +476,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0011_allow_webview_permission_requests.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -496,7 +496,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0011_allow_webview_permission_requests.up.sql", size: 88, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ func _0012_pending_transactionsDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0012_pending_transactions.down.sql", size: 33, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0012_pending_transactions.down.sql", size: 33, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ func _0012_pending_transactionsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0012_pending_transactions.up.sql", size: 321, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0012_pending_transactions.up.sql", size: 321, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ func _0013_favouritesDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0013_favourites.down.sql", size: 23, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0013_favourites.down.sql", size: 23, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ func _0013_favouritesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0013_favourites.up.sql", size: 132, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0013_favourites.up.sql", size: 132, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -596,7 +596,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0014_add_use_mailservers.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -616,7 +616,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0014_add_use_mailservers.up.sql", size: 111, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ func _0015_link_previewsDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0015_link_previews.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0015_link_previews.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ func _0015_link_previewsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0015_link_previews.up.sql", size: 203, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0015_link_previews.up.sql", size: 203, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -676,7 +676,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0016_local_notifications_preferences.down.sql", size: 43, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -696,7 +696,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0016_local_notifications_preferences.up.sql", size: 204, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ func _0017_bookmarksDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0017_bookmarks.down.sql", size: 22, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0017_bookmarks.down.sql", size: 22, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ func _0017_bookmarksUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0017_bookmarks.up.sql", size: 147, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0017_bookmarks.up.sql", size: 147, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -756,7 +756,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0018_profile_pictures_visibility.up.sql", size: 84, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -776,7 +776,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0019_blocks_ranges_extra_data.up.sql", size: 89, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ func _0020_metricsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0020_metrics.up.sql", size: 235, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0020_metrics.up.sql", size: 235, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -816,7 +816,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0021_add_session_id_to_metrics.up.sql", size: 55, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -836,7 +836,7 @@ func _0022_pending_transfersUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "0022_pending_transfers.up.sql", size: 706, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "0022_pending_transfers.up.sql", size: 706, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -856,7 +856,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1618237885_settings_anon_metrics_should_send.up.sql", size: 80, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -876,7 +876,7 @@ func _1618395756_contacts_onlyUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1618395756_contacts_only.up.sql", size: 136, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1618395756_contacts_only.up.sql", size: 136, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -896,7 +896,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1622184614_add_default_sync_period.up.sql", size: 125, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -916,7 +916,7 @@ func _1625872445_user_statusUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1625872445_user_status.up.sql", size: 351, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1625872445_user_status.up.sql", size: 351, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -936,7 +936,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1627983977_add_gif_to_settings.up.sql", size: 102, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -956,7 +956,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1628580203_add_hidden_account.up.sql", size: 67, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -976,7 +976,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1629123384_add_id_to_app_metrics.up.sql", size: 589, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -996,7 +996,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1630401853_add_opensea_enabled_to_settings.up.sql", size: 70, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1016,7 +1016,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1630464455_create-saved_addresses-table.down.sql", size: 28, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1036,7 +1036,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1630464455_create-saved_addresses-table.up.sql", size: 187, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1056,7 +1056,7 @@ func _1630485153_networksDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1630485153_networks.down.sql", size: 21, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1630485153_networks.down.sql", size: 21, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1076,7 +1076,7 @@ func _1630485153_networksUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1630485153_networks.up.sql", size: 394, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1630485153_networks.up.sql", size: 394, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1096,7 +1096,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1632262444_profile_pictures_show_to.up.sql", size: 81, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1116,7 +1116,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1635942153_add_telemetry_server_url_to_settings.up.sql", size: 128, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1136,7 +1136,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1635942154_add_backup_setting.up.sql", size: 287, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1156,7 +1156,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(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "1637745568_add_auto_message_setting.up.sql", size: 122, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1176,7 +1176,7 @@ func _1640111208_nodeconfigUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1640111208_nodeconfig.up.sql", size: 7659, mode: os.FileMode(436), modTime: time.Unix(1642016840, 0)}
|
||||
info := bindataFileInfo{name: "1640111208_nodeconfig.up.sql", size: 7659, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1196,7 +1196,7 @@ func docGo() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "doc.go", size: 85, mode: os.FileMode(436), modTime: time.Unix(1642016353, 0)}
|
||||
info := bindataFileInfo{name: "doc.go", size: 85, mode: os.FileMode(436), modTime: time.Unix(1643103821, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
|
|
@ -142,6 +142,7 @@ type Settings struct {
|
|||
LastBackup uint64 `json:"last-backup,omitempty"`
|
||||
BackupEnabled bool `json:"backup-enabled?,omitempty"`
|
||||
AutoMessageEnabled bool `json:"auto-message-enabled?,omitempty"`
|
||||
GifAPIKey string `json:"gifs/api-key"`
|
||||
}
|
||||
|
||||
func NewDB(db *sql.DB) *Database {
|
||||
|
@ -480,7 +481,12 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
|
|||
}
|
||||
|
||||
update, err = db.db.Prepare("UPDATE settings SET auto_message_enabled = ? WHERE synthetic_id = 'id'")
|
||||
|
||||
case "gifs/api-key":
|
||||
_, ok := value.(string)
|
||||
if !ok {
|
||||
return ErrInvalidConfig
|
||||
}
|
||||
update, err = db.db.Prepare("UPDATE settings SET gif_api_key = ? WHERE synthetic_id = 'id'")
|
||||
default:
|
||||
return ErrInvalidConfig
|
||||
}
|
||||
|
@ -494,7 +500,7 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
|
|||
|
||||
func (db *Database) GetSettings() (Settings, error) {
|
||||
var s Settings
|
||||
err := db.db.QueryRow("SELECT address, anon_metrics_should_send, chaos_mode, currency, current_network, custom_bootnodes, custom_bootnodes_enabled, dapps_address, eip1581_address, fleet, hide_home_tooltip, installation_id, key_uid, keycard_instance_uid, keycard_paired_on, keycard_pairing, last_updated, latest_derived_path, link_preview_request_enabled, link_previews_enabled_sites, log_level, mnemonic, name, networks, notifications_enabled, push_notifications_server_enabled, push_notifications_from_contacts_only, remote_push_notifications_enabled, send_push_notifications, push_notifications_block_mentions, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_packs_pending, stickers_recent_stickers, syncing_on_mobile_network, default_sync_period, use_mailservers, messages_from_contacts_only, usernames, appearance, profile_pictures_show_to, profile_pictures_visibility, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens, waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents, gif_favorites, opensea_enabled, last_backup, backup_enabled, telemetry_server_url, auto_message_enabled FROM settings WHERE synthetic_id = 'id'").Scan(
|
||||
err := db.db.QueryRow("SELECT address, anon_metrics_should_send, chaos_mode, currency, current_network, custom_bootnodes, custom_bootnodes_enabled, dapps_address, eip1581_address, fleet, hide_home_tooltip, installation_id, key_uid, keycard_instance_uid, keycard_paired_on, keycard_pairing, last_updated, latest_derived_path, link_preview_request_enabled, link_previews_enabled_sites, log_level, mnemonic, name, networks, notifications_enabled, push_notifications_server_enabled, push_notifications_from_contacts_only, remote_push_notifications_enabled, send_push_notifications, push_notifications_block_mentions, photo_path, pinned_mailservers, preferred_name, preview_privacy, public_key, remember_syncing_choice, signing_phrase, stickers_packs_installed, stickers_packs_pending, stickers_recent_stickers, syncing_on_mobile_network, default_sync_period, use_mailservers, messages_from_contacts_only, usernames, appearance, profile_pictures_show_to, profile_pictures_visibility, wallet_root_address, wallet_set_up_passed, wallet_visible_tokens, waku_bloom_filter_mode, webview_allow_permission_requests, current_user_status, send_status_updates, gif_recents, gif_favorites, opensea_enabled, last_backup, backup_enabled, telemetry_server_url, auto_message_enabled, gif_api_key FROM settings WHERE synthetic_id = 'id'").Scan(
|
||||
&s.Address,
|
||||
&s.AnonMetricsShouldSend,
|
||||
&s.ChaosMode,
|
||||
|
@ -557,6 +563,7 @@ func (db *Database) GetSettings() (Settings, error) {
|
|||
&s.BackupEnabled,
|
||||
&s.TelemetryServerURL,
|
||||
&s.AutoMessageEnabled,
|
||||
&s.GifAPIKey,
|
||||
)
|
||||
|
||||
return s, err
|
||||
|
@ -885,3 +892,31 @@ func (db *Database) ENSName() (string, error) {
|
|||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
func (db *Database) GifAPIKey() (string, error) {
|
||||
var result sql.NullString
|
||||
err := db.db.QueryRow("SELECT gif_api_key FROM settings WHERE synthetic_id = 'id'").Scan(&result)
|
||||
if err == sql.ErrNoRows {
|
||||
return "", nil
|
||||
}
|
||||
if result.Valid {
|
||||
return result.String, nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
func (db *Database) GifRecents() (recents json.RawMessage, err error) {
|
||||
err = db.db.QueryRow("SELECT gif_recents FROM settings WHERE synthetic_id = 'id'").Scan(&sqlite.JSONBlob{Data: &recents})
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, err
|
||||
}
|
||||
return recents, nil
|
||||
}
|
||||
|
||||
func (db *Database) GifFavorites() (favorites json.RawMessage, err error) {
|
||||
err = db.db.QueryRow("SELECT gif_favorites FROM settings WHERE synthetic_id = 'id'").Scan(&sqlite.JSONBlob{Data: &favorites})
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, err
|
||||
}
|
||||
return favorites, nil
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import (
|
|||
appmetricsservice "github.com/status-im/status-go/services/appmetrics"
|
||||
"github.com/status-im/status-go/services/browsers"
|
||||
"github.com/status-im/status-go/services/ens"
|
||||
"github.com/status-im/status-go/services/gif"
|
||||
localnotifications "github.com/status-im/status-go/services/local-notifications"
|
||||
"github.com/status-im/status-go/services/mailservers"
|
||||
"github.com/status-im/status-go/services/peer"
|
||||
|
@ -111,6 +112,7 @@ type StatusNode struct {
|
|||
wakuV2Srvc *wakuv2.Waku
|
||||
wakuV2ExtSrvc *wakuv2ext.Service
|
||||
ensSrvc *ens.Service
|
||||
gifSrvc *gif.Service
|
||||
}
|
||||
|
||||
// New makes new instance of StatusNode.
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
"github.com/status-im/status-go/services/browsers"
|
||||
"github.com/status-im/status-go/services/ens"
|
||||
"github.com/status-im/status-go/services/ext"
|
||||
"github.com/status-im/status-go/services/gif"
|
||||
localnotifications "github.com/status-im/status-go/services/local-notifications"
|
||||
"github.com/status-im/status-go/services/mailservers"
|
||||
"github.com/status-im/status-go/services/peer"
|
||||
|
@ -71,6 +72,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig) error {
|
|||
services = appendIf(config.PermissionsConfig.Enabled, services, b.permissionsService())
|
||||
services = appendIf(config.MailserversConfig.Enabled, services, b.mailserversService())
|
||||
services = appendIf(config.Web3ProviderConfig.Enabled, services, b.providerService())
|
||||
services = append(services, b.gifService())
|
||||
|
||||
if config.WakuConfig.Enabled {
|
||||
wakuService, err := b.wakuService(&config.WakuConfig, &config.ClusterConfig)
|
||||
|
@ -368,6 +370,13 @@ func (b *StatusNode) ensService() *ens.Service {
|
|||
return b.ensSrvc
|
||||
}
|
||||
|
||||
func (b *StatusNode) gifService() *gif.Service {
|
||||
if b.gifSrvc == nil {
|
||||
b.gifSrvc = gif.NewService(accounts.NewDB(b.appDB))
|
||||
}
|
||||
return b.gifSrvc
|
||||
}
|
||||
|
||||
func (b *StatusNode) permissionsService() *permissions.Service {
|
||||
if b.permissionsSrvc == nil {
|
||||
b.permissionsSrvc = permissions.NewService(permissions.NewDB(b.appDB))
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
package gif
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/status-im/status-go/multiaccounts/accounts"
|
||||
)
|
||||
|
||||
type Gif struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
URL string `json:"url"`
|
||||
TinyURL string `json:"tinyUrl"`
|
||||
Height int `json:"height"`
|
||||
IsFavorite bool `json:"isFavorite"`
|
||||
}
|
||||
|
||||
type Container struct {
|
||||
Items []Gif `json:"items"`
|
||||
}
|
||||
|
||||
var tenorAPIKey = ""
|
||||
var defaultParams = "&media_filter=minimal&limit=50&key="
|
||||
|
||||
const maxRetry = 3
|
||||
const baseURL = "https://g.tenor.com/v1/"
|
||||
|
||||
func NewGifAPI(db *accounts.Database) *API {
|
||||
return &API{db, &http.Client{Timeout: time.Minute}}
|
||||
}
|
||||
|
||||
// API is class with methods available over RPC.
|
||||
type API struct {
|
||||
db *accounts.Database
|
||||
httpClient *http.Client
|
||||
}
|
||||
|
||||
func (api *API) SetTenorAPIKey(key string) (err error) {
|
||||
log.Info("[GifAPI::SetTenorAPIKey]")
|
||||
err = api.db.SaveSetting("gifs/api-key", key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tenorAPIKey = key
|
||||
return nil
|
||||
}
|
||||
|
||||
func (api *API) GetContentWithRetry(path string) (value string, err error) {
|
||||
var currentRetry = 0
|
||||
var response *http.Response
|
||||
|
||||
for currentRetry < maxRetry {
|
||||
response, err = api.httpClient.Get(baseURL + path + defaultParams + tenorAPIKey)
|
||||
if err != nil {
|
||||
log.Error("can't get content from path %s", path)
|
||||
currentRetry++
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
defer response.Body.Close()
|
||||
|
||||
if response.StatusCode != http.StatusOK {
|
||||
return "", fmt.Errorf("Status error: %v", response.StatusCode)
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Read body: %v", err)
|
||||
}
|
||||
|
||||
return string(data), nil
|
||||
}
|
||||
|
||||
func (api *API) FetchGifs(path string) (value string, err error) {
|
||||
log.Info("[GifAPI::fetchGifs]")
|
||||
return api.GetContentWithRetry(path)
|
||||
}
|
||||
|
||||
func (api *API) UpdateRecentGifs(updatedGifs json.RawMessage) (err error) {
|
||||
log.Info("[GifAPI::updateRecentGifs]")
|
||||
recentGifsContainer := Container{}
|
||||
err = json.Unmarshal(updatedGifs, &recentGifsContainer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = api.db.SaveSetting("gifs/recent-gifs", recentGifsContainer.Items)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (api *API) UpdateFavoriteGifs(updatedGifs json.RawMessage) (err error) {
|
||||
log.Info("[GifAPI::updateFavoriteGifs]", updatedGifs)
|
||||
favsGifsContainer := Container{}
|
||||
err = json.Unmarshal(updatedGifs, &favsGifsContainer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = api.db.SaveSetting("gifs/favorite-gifs", favsGifsContainer.Items)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (api *API) GetRecentGifs() (recentGifs []Gif, err error) {
|
||||
log.Info("[GifAPI::getRecentGifs]")
|
||||
gifs, err := api.db.GifRecents()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
savedRecentGifs := []Gif{}
|
||||
err = json.Unmarshal(gifs, &savedRecentGifs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
recentGifs = savedRecentGifs
|
||||
return recentGifs, nil
|
||||
}
|
||||
|
||||
func (api *API) GetFavoriteGifs() (favoriteGifs []Gif, err error) {
|
||||
log.Info("[GifAPI::getFavoriteGifs]")
|
||||
gifs, err := api.db.GifFavorites()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
savedFavGifs := []Gif{}
|
||||
err = json.Unmarshal(gifs, &savedFavGifs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
favoriteGifs = savedFavGifs
|
||||
return favoriteGifs, nil
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package gif
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/p2p"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
|
||||
"github.com/status-im/status-go/multiaccounts/accounts"
|
||||
)
|
||||
|
||||
// Service represents out own implementation of personal sign operations.
|
||||
type Service struct {
|
||||
accountsDB *accounts.Database
|
||||
}
|
||||
|
||||
// New returns a new Service.
|
||||
func NewService(db *accounts.Database) *Service {
|
||||
return &Service{accountsDB: db}
|
||||
}
|
||||
|
||||
// Protocols returns a new protocols list. In this case, there are none.
|
||||
func (s *Service) Protocols() []p2p.Protocol {
|
||||
return []p2p.Protocol{}
|
||||
}
|
||||
|
||||
// APIs returns a list of new APIs.
|
||||
func (s *Service) APIs() []rpc.API {
|
||||
return []rpc.API{
|
||||
{
|
||||
Namespace: "gif",
|
||||
Version: "0.1.0",
|
||||
Service: NewGifAPI(s.accountsDB),
|
||||
Public: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Start is run when a service is started.
|
||||
func (s *Service) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop is run when a service is stopped.
|
||||
func (s *Service) Stop() error {
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue