diff --git a/apps/ssb.json b/apps/ssb.json index 52a95833..63f62ff6 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&wOd/+1l5wpywBlfxC1Lm0i+HhYidrgSfrn9LRX7qy2w=.sha256" + "previous": "&1odTdQMYLeIjmLDEIAxcoabT7D5cXYWcDO4nNJH9KRY=.sha256" } diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index 12f99e80..f4de2144 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -184,9 +184,9 @@ class TfElement extends LitElement { json_each(?1) AS following WHERE messages.author = following.value AND + messages.content ->> 'type' = 'about' AND messages.rowid > ?3 AND - messages.rowid <= ?4 AND - json_extract(messages.content, '$.type') = 'about' + messages.rowid <= ?4 UNION SELECT messages.author, json(messages.content) AS content, messages.sequence @@ -195,8 +195,8 @@ class TfElement extends LitElement { json_each(?2) AS following WHERE messages.author = following.value AND - messages.rowid <= ?4 AND - json_extract(messages.content, '$.type') = 'about' + messages.content ->> 'type' = 'about' AND + messages.rowid <= ?4 ORDER BY messages.author, messages.sequence `, [ @@ -382,7 +382,6 @@ class TfElement extends LitElement { '🔐': latest[0], }); console.log('private took', (new Date() - start_time) / 1000.0); - console.log(latest); self.private_messages = latest[1]; }); } diff --git a/apps/ssb/tf-tab-news-feed.js b/apps/ssb/tf-tab-news-feed.js index 6cecdbc1..ecae27d6 100644 --- a/apps/ssb/tf-tab-news-feed.js +++ b/apps/ssb/tf-tab-news-feed.js @@ -172,17 +172,13 @@ class TfTabNewsFeedElement extends LitElement { WHERE (?2 IS NULL OR all_news.timestamp >= ?2) AND all_news.timestamp < ?3 ORDER BY timestamp DESC LIMIT 20 ) - SELECT FALSE AS is_primary, messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature - FROM news - JOIN messages_refs ON news.id = messages_refs.ref - JOIN messages ON messages_refs.message = messages.id - UNION - SELECT FALSE AS is_primary, messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature - FROM news - JOIN messages_refs ON news.id = messages_refs.message - JOIN messages ON messages_refs.ref = messages.id - UNION SELECT TRUE AS is_primary, news.* FROM news + UNION + SELECT FALSE AS is_primary, messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature + FROM news + JOIN messages_refs refs_in ON news.id = refs_in.ref + JOIN messages_refs refs_out ON news.id = refs_out.message + JOIN messages ON (messages.id = refs_out.message OR messages.id = refs_in.ref) `, [JSON.stringify(this.following), start_time, end_time] ); diff --git a/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java b/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java index a8cb829c..53f18fa8 100644 --- a/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java +++ b/src/android/com/unprompted/tildefriends/TildeFriendsActivity.java @@ -347,7 +347,6 @@ public class TildeFriendsActivity extends Activity { } catch (NumberFormatException e) { e.printStackTrace(); } catch (java.io.FileNotFoundException e) { - Log.w("tildefriends", "Port file does not yet exist."); } catch (java.io.IOException e) { e.printStackTrace(); } diff --git a/src/ssb.db.c b/src/ssb.db.c index 54b08f5e..ff180edc 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -176,13 +176,16 @@ void tf_ssb_db_init(tf_ssb_t* ssb) _tf_ssb_db_exec(db, "ALTER TABLE messages RENAME COLUMN sequence_before_author TO flags"); } - _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_id_index ON messages (author, id)"); + _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_id_index ON messages (id)"); _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_sequence_index ON messages (author, sequence)"); _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_timestamp_index ON messages (author, timestamp)"); _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_timestamp_index ON messages (timestamp)"); _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_type_timestamp_index ON messages (content ->> 'type', timestamp)"); _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_size_by_author_index ON messages (author, length(content))"); - _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_type_author_channel_index ON messages (content ->> 'type', author, content ->> 'channel');"); + _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_type_author_channel_index ON messages (content ->> 'type', author, content ->> 'channel')"); + _tf_ssb_db_exec(db, "DROP INDEX IF EXISTS messages_author_id_index"); + _tf_ssb_db_exec(db, "DROP INDEX IF EXISTS messages_by_author_index"); + _tf_ssb_db_exec(db, "DROP INDEX IF EXISTS messages_timestamp_author_index"); _tf_ssb_db_exec(db, "CREATE TABLE IF NOT EXISTS blobs (" " id TEXT PRIMARY KEY,"