From d216d961442524d549f637a61f0b78e88c63ae8b Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 14 Sep 2022 23:49:25 +0000 Subject: [PATCH] Expandable image mentions. Do a faster fts validation at startup. Hide the news test button. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3983 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/cory/ssblit.json | 2 +- apps/cory/ssblit/tf-app.js | 2 +- apps/cory/ssblit/tf-message.js | 30 +++++++++++++++++++++++++++++- src/ssb.db.c | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/apps/cory/ssblit.json b/apps/cory/ssblit.json index 58006a15..d7b53498 100644 --- a/apps/cory/ssblit.json +++ b/apps/cory/ssblit.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&viCT+Sz8weP/j5V47w0wA4sk46HM4uy6lajX5NtoqHE=.sha256","lit-all.min.js":"&N4A12AsifdQgwdpII0SFtG513BfoLpmPjdJ9VTDftpg=.sha256","index.html":"&WH8A5tF25xlfPDGei2TCQc2/HJFJf5DuRN1GRSYQhhk=.sha256","script.js":"&G8puK9Q4MngHy3D4ppcKyT49WKbHD2OCeUcAw2ghTDE=.sha256","lit-all.min.js.map":"&oFY9wO4MnujgfGNGv4VggHc5V5JwX4C8csqKZ6KJYbE=.sha256","tf-id-picker.js":"&pg1gLK150HFai73TcmAe5E/dMpMqmbhyre/+/J4XmHo=.sha256","tf-app.js":"&F64EHiKTMf/65Cc0w/F7oFbBcUOn7uTAjFBPd5rymSs=.sha256","tf-message.js":"&AFDKCN+hxYDs7zG8PBKmle11gE/2AIMzYr3FYz1hCto=.sha256","tf-user.js":"&L6+7BnBq+UOoTMO6o8+u5JFTl0UBtCPDw8bb8ppDrkA=.sha256","tf-utils.js":"&N2yKZwFnb2GbPeipgQtu6xFvezENNOgud9G7EhCQ/K0=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&oo0iWvT+c2rU91zWpBIfPePRzmU8qmSnVOm+QCQqG/I=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&pqYLDE/13PyEt2ceeFqvnwZ8NqWfPfpDBt4vP8SeHbs=.sha256","tf-styles.js":"&Ab+SjsySJ74kwK3EQD/j72yXYJlFAhkJ5EqyJfYpJEk=.sha256","tf-profile.js":"&vRKjsnYvOiHCQahzEfznCvP5YDwUPtltlpWf+pxwZ1Y=.sha256","commonmark-linkify.js":"&X+hNNkmSRvKY86khyAun+cXksquXbMakZdINbGbx30g=.sha256","tf-tab-search.js":"&NUGpMnLR3eYwrdjZaJAd8s4Rj+WPazJhWWX5jkMdNRI=.sha256","tf-tab-news.js":"&ehXkzOR+kQmiTHRtu5GPDMwrB4a4Z9vVsTo4ldhdu/E=.sha256","tf-tab-connections.js":"&jSnF/5NmgqxRze1XQAEGOW5mPzOV1/8aCyrDRZu34IQ=.sha256","tf-news.js":"&C1dKe98kQOkClnAbGvcreC15IdlTrD9J4RFohspnsSE=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&viCT+Sz8weP/j5V47w0wA4sk46HM4uy6lajX5NtoqHE=.sha256","lit-all.min.js":"&N4A12AsifdQgwdpII0SFtG513BfoLpmPjdJ9VTDftpg=.sha256","index.html":"&WH8A5tF25xlfPDGei2TCQc2/HJFJf5DuRN1GRSYQhhk=.sha256","script.js":"&G8puK9Q4MngHy3D4ppcKyT49WKbHD2OCeUcAw2ghTDE=.sha256","lit-all.min.js.map":"&oFY9wO4MnujgfGNGv4VggHc5V5JwX4C8csqKZ6KJYbE=.sha256","tf-id-picker.js":"&pg1gLK150HFai73TcmAe5E/dMpMqmbhyre/+/J4XmHo=.sha256","tf-app.js":"&Thhwiobap0GeGxpH9r7lJAPM8r+v72Ra6xyDM/RlVnA=.sha256","tf-message.js":"&RaNXP146n6Q4wLqlf8YYaL1vIxhKT3k5RCQ6G0k5VXs=.sha256","tf-user.js":"&L6+7BnBq+UOoTMO6o8+u5JFTl0UBtCPDw8bb8ppDrkA=.sha256","tf-utils.js":"&N2yKZwFnb2GbPeipgQtu6xFvezENNOgud9G7EhCQ/K0=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&oo0iWvT+c2rU91zWpBIfPePRzmU8qmSnVOm+QCQqG/I=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&pqYLDE/13PyEt2ceeFqvnwZ8NqWfPfpDBt4vP8SeHbs=.sha256","tf-styles.js":"&Ab+SjsySJ74kwK3EQD/j72yXYJlFAhkJ5EqyJfYpJEk=.sha256","tf-profile.js":"&vRKjsnYvOiHCQahzEfznCvP5YDwUPtltlpWf+pxwZ1Y=.sha256","commonmark-linkify.js":"&X+hNNkmSRvKY86khyAun+cXksquXbMakZdINbGbx30g=.sha256","tf-tab-search.js":"&NUGpMnLR3eYwrdjZaJAd8s4Rj+WPazJhWWX5jkMdNRI=.sha256","tf-tab-news.js":"&ehXkzOR+kQmiTHRtu5GPDMwrB4a4Z9vVsTo4ldhdu/E=.sha256","tf-tab-connections.js":"&jSnF/5NmgqxRze1XQAEGOW5mPzOV1/8aCyrDRZu34IQ=.sha256","tf-news.js":"&C1dKe98kQOkClnAbGvcreC15IdlTrD9J4RFohspnsSE=.sha256"}} \ No newline at end of file diff --git a/apps/cory/ssblit/tf-app.js b/apps/cory/ssblit/tf-app.js index d85a34ee..992f69bb 100644 --- a/apps/cory/ssblit/tf-app.js +++ b/apps/cory/ssblit/tf-app.js @@ -291,7 +291,7 @@ class TfElement extends LitElement { return html` ${id_picker} ${tabs} - + ${contents} `; } diff --git a/apps/cory/ssblit/tf-message.js b/apps/cory/ssblit/tf-message.js index aebf7fbd..c051bbaa 100644 --- a/apps/cory/ssblit/tf-message.js +++ b/apps/cory/ssblit/tf-message.js @@ -73,11 +73,39 @@ class TfMessageElement extends LitElement { emojis.picker(x => this.vote(x)); } + show_image(link) { + let div = document.createElement('div'); + div.style.left = 0; + div.style.top = 0; + div.style.width = '100%'; + div.style.height = '100%'; + div.style.position = 'fixed'; + div.style.background = '#000'; + div.style.zIndex = 100; + div.style.display = 'grid'; + let img = document.createElement('img'); + img.src = link; + img.style.maxWidth = '100%'; + img.style.maxHeight = '100%'; + img.style.display = 'block'; + img.style.margin = 'auto'; + img.style.objectFit = 'contain'; + img.style.width = '100%'; + div.appendChild(img); + function image_close(event) { + document.body.removeChild(div); + window.removeEventListener('keydown', image_close); + } + div.onclick = image_close; + window.addEventListener('keydown', image_close); + document.body.appendChild(div); + } + render_mention(mention) { if (mention.link?.startsWith('&') && mention.type?.startsWith('image/')) { return html` - + this.show_image('/' + mention.link + '/view')}> `; } else if (mention.link?.startsWith('&') && mention.name?.startsWith('audio:')) { diff --git a/src/ssb.db.c b/src/ssb.db.c index 20fa0db2..1417459c 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -108,7 +108,7 @@ void tf_ssb_db_init(tf_ssb_t* ssb) _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS identities_user ON identities (user, public_key)"); if (!_tf_ssb_db_has_rows(db, "PRAGMA table_list('messages_fts')") || - sqlite3_exec(db, "INSERT INTO messages_fts(messages_fts, rank) VALUES ('integrity-check', 1)", NULL, NULL, NULL) == SQLITE_CORRUPT_VTAB) + sqlite3_exec(db, "INSERT INTO messages_fts(messages_fts, rank) VALUES ('integrity-check', 0)", NULL, NULL, NULL) == SQLITE_CORRUPT_VTAB) { _tf_ssb_db_exec(db, "CREATE VIRTUAL TABLE IF NOT EXISTS messages_fts USING fts5(content, content=messages, content_rowid=rowid)"); printf("Populating full-text search...\n");