Commit Graph

272 Commits

Author SHA1 Message Date
keyan a17b4d1f1a refine push notification ui and catch promises 2023-07-04 17:19:59 -05:00
ekzyis 388e00dd04
Service worker rework, Web Target Share API & Web Push API (#324)
* npm uninstall next-pwa

next-pwa was last updated in August 2022.
There is also an issue which mentions that next-pwa is abandoned (?): https://github.com/shadowwalker/next-pwa/issues/482

But the main reason for me uninstalling it is that it adds a lot of preconfigured stuff which is not necessary for us.
It even lead to a bug since pages were cached without our knowledge.

So I will go with a different PWA approach. This different approach should do the following:
- make it more transparent what the service worker is doing
- gives us more control to configure the service worker and thus making it easier

* Use workbox-webpack-plugin

Every other plugin (`next-offline`, `next-workbox-webpack-plugin`, `next-with-workbox`, ...) added unnecessary configuration which felt contrary to how PWAs should be built.
(PWAs should progressivly enhance the website in small steps, see https://web.dev/learn/pwa/getting-started/#focus-on-a-feature)

These default configurations even lead to worse UX since they made invalid assumptions about stacker.news:
We _do not_ want to cache our start url and we _do not_ want to cache anything unless explicitly told to.
Almost every page on SN should be fresh for the best UX.

To achieve this, by default, the service worker falls back to the network (as if the service worker wasn't there).

Therefore, this should be the simplest configuration with a valid precache and cache busting support.

In the future, we can try to use prefetching to improve performance of navigation requests.

* Add support for Web Share Target API

See https://developer.chrome.com/articles/web-share-target/

* Use Web Push API for push notifications

I followed this (very good!) guide: https://web.dev/notifications/

* Refactor code related to Web Push

* Send push notification to users on events

* Merge notifications

* Send notification to author of every parent recursively

* Remove unused userId param in savePushSubscription

As it should be, the user id is retrieved from the authenticated user in the backend.

* Resubscribe user if push subscription changed

* Update old subscription if oldEndpoint was given

* Allow users to unsubscribe

* Use LTREE operator instead of recursive query

* Always show checkbox for push notifications

* Justify checkbox to end

* Update title of first push notification

* Fix warning from uncontrolled to controlled

* Add comment about Notification.requestPermission

* Fix timestamp

* Catch error on push subscription toggle

* Wrap function bodies in try/catch

* Use Promise.allSettled

* Filter subscriptions by user notification settings

* Fix user notification filter

* Use skipWaiting

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-04 14:36:07 -05:00
keyan 3e4161ae8c tip -> zap 2023-06-19 13:21:55 -05:00
keyan f0f51438c4 add top posts/comments to subs 2023-06-12 19:40:18 -05:00
keyan 369bd82a84 make freebie comments visible case by case 2023-06-03 20:01:50 -05:00
ekzyis ace2a4df3b
Match any port in dupe check (#297)
Co-authored-by: ekzyis <ek@stacker.news>
2023-05-31 19:49:28 -05:00
ekzyis 0c251ca376
Add thread subscriptions (#293)
* Add thread subscriptions

* remove dead code: reply only notifications

* break out thread subscription queries to reduce search space

* one db dip for item lists/threads re:meSubscription

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-05-31 19:44:06 -05:00
keyan 0de134309c improve perf of rank view perf 2023-05-24 02:35:39 -05:00
keyan 28263bc6c7 rank views 2023-05-23 09:21:04 -05:00
keyan 2579a6b51c fix ranking function order operation in wild west mode 2023-05-09 15:07:23 -05:00
keyan 80968d7b35 let comments influence ranking 2023-05-09 13:52:35 -05:00
keyan fbd746b023 fix auction ranking with query layers 2023-05-08 17:32:37 -05:00
keyan 67b815d9d6 preserve ordering in new layered item query 2023-05-08 15:06:42 -05:00
keyan 61d57056ed I dip you dip one db dip 2023-05-06 20:27:51 -05:00
keyan 1c608d42f4 denormalize votes 2023-05-06 18:53:10 -05:00
keyan a97f8229b0 avoid extra dip when getting users 2023-05-06 18:18:18 -05:00
keyan 347a6a54d2 improve comment performance 2023-05-06 16:51:17 -05:00
keyan 3d4d86a40a simplify item queries with subs 2023-05-05 13:06:53 -05:00
keyan abd9555792 fix recent comments 2023-05-04 19:20:48 -05:00
keyan a241d683d8 nostr sub 2023-05-01 15:58:30 -05:00
keyan e4a3095cb4 give pinned item recent sort by default 2023-03-19 10:43:33 -05:00
keyan 9afbe0abd8 enhance item related query perf 2023-02-24 10:35:05 -06:00
ekzyis 7b838cdeb2
Implement bookmarking of posts and comments (#235) 2023-02-16 16:23:59 -06:00
keyan 4cae1ae230 reuse validation on server 2023-02-08 13:39:53 -06:00
keyan 36ddb25b46 remove extra queries 2023-02-03 18:08:08 -06:00
keyan 291fe24363 denormalize bountyPaidTo 2023-01-26 17:28:10 -06:00
keyan 80f04b5a28 remove expensive query 2023-01-26 15:00:45 -06:00
keyan d8e3e73def check for rootId 2023-01-26 13:37:51 -06:00
keyan 5306b11157 improve bounty performance 2023-01-26 13:09:57 -06:00
Austin Kelsay e13e37744e
stackernews bounties (#227)
bounties
2023-01-26 10:11:55 -06:00
keyan ceac96e149 dup /live variation of youtube link 2023-01-24 08:37:33 -06:00
keyan 29c59d93ea open timestamps 2023-01-22 14:17:50 -06:00
keyan 71e61e51e8 fix youtube dupe regex 2023-01-13 17:42:40 -06:00
keyan 9c0ead308b remove debug logging 2023-01-13 13:19:42 -06:00
keyan 10ff3fa1c3 delete 2023-01-13 11:52:18 -06:00
keyan 9823969418 unshorten links 2023-01-12 12:05:47 -06:00
keyan afc9a70a02 ignore subdomains on dupe detection 2023-01-11 16:20:14 -06:00
keyan 2b878e1a19 more youtube dupe detection 2023-01-11 16:04:50 -06:00
keyan b7830261d8 ignore case on url dupe detection 2023-01-11 15:05:30 -06:00
keyan 15c76aa134 recognize all youtube links 2023-01-11 14:58:52 -06:00
Keyan 10e5257375
Merge branch 'master' into 190-strip-tracking-info 2023-01-11 12:17:25 -06:00
keyan 439c83f975 all things being equal, sort comments by sats 2022-12-06 15:23:45 -06:00
keyan 2a4e5a0617 add more filters to recent 2022-12-01 16:42:49 -06:00
keyan 7df375e752 improvements to jobs 2022-11-29 11:29:43 -06:00
keyan 5746160893 let tips affect ranking 2022-11-23 12:12:09 -06:00
keyan 1bf747c7c0 sats to msats 2022-11-16 10:57:03 -06:00
ekzyis 3a36a211af Remove tracking from twitter URLs 2022-11-16 00:58:02 +01:00
keyan 368f74a7c5 3 hour cliff for all items 2022-10-31 12:56:48 -05:00
keyan cb7f68e0e5 index wvotes for search 2022-10-28 10:58:31 -05:00
keyan a398784f26 improved top 2022-10-25 16:35:32 -05:00
keyan 79af550168 add guide to footer 2022-10-23 10:43:39 -05:00
keyan e4d150413b search filters 2022-10-20 17:44:44 -05:00
keyan 1bcfb787a6 add changelog to footer 2022-10-10 16:58:50 -05:00
keyan aed7e0f667 fix auction position query 2022-10-05 13:55:30 -05:00
keyan 46ea2f661c make jobs great again 2022-09-29 15:42:33 -05:00
keyan 52fab60cda fix missing search fields 2022-09-28 11:28:53 -05:00
keyan d9d426e5c3 add freebies 2022-09-27 16:19:15 -05:00
keyan 9c4d74888f add borderland 2022-09-22 15:42:04 -05:00
keyan 2c7c237fc7 show when items are outlawed 2022-09-22 13:44:50 -05:00
keyan 7faae425b3 wild west mode 2022-09-21 14:57:36 -05:00
keyan f65f6c1b28 remove meComments and clean up sats title 2022-09-01 16:20:20 -05:00
keyan 4be5cfa5c7 display earned sats in comments 2022-09-01 16:06:11 -05:00
keyan ec2ac6e698 fix comment editing validation 2022-08-26 21:57:41 -05:00
keyan 863e717c05 fix broken comments 2022-08-26 20:27:57 -05:00
keyan 5b2cfd11cc server side validate title length 2022-08-26 18:31:51 -05:00
keyan ccb5a81dd5 add recent comments 2022-08-18 17:05:58 -05:00
keyan 388c7d0240 full powered editing 2022-08-18 13:15:24 -05:00
keyan 69d0082839 fix null boolean 2022-08-11 16:42:52 -05:00
keyan ddb4a30c4b spam fees 2022-08-11 15:38:10 -05:00
keyan 82280b0966 add polls 2022-07-30 08:51:04 -05:00
keyan 5ac894baed more expensive boost + explainer 2022-07-24 11:55:22 -05:00
keyan cb313429d5 job board enhancements 2022-07-21 17:55:05 -05:00
keyan d86bf302ee make upvoted items sticker posts/comments 2022-07-01 13:38:47 -05:00
keyan 6dd3bd9ed3 make highly upvoted items stickier 2022-07-01 13:26:05 -05:00
keyan 8713bf178a show dead jobs 2022-06-02 18:25:21 -05:00
keyan 6cc7288e99 ignore hashtag in url dupe detection 2022-05-18 13:21:24 -05:00
keyan 35b533c572 denormalize ranking metrics 2022-05-17 14:54:12 -05:00
keyan efa267f128 use act index in item queries 2022-05-16 17:18:11 -05:00
keyan 222335ca5e increase boost gravity 2022-05-08 09:09:53 -05:00
keyan aa4ac2ecc9 add ln addr + lnurl pay qr code to profile pages 2022-05-06 14:34:35 -05:00
keyan 9f48daecc3 decay ranking slower 2022-05-05 12:43:58 -05:00
keyan b68fadc63d allow daily discussion to appear in recent 2022-04-25 12:03:21 -05:00
keyan d978ff5ea5 forward tips from posts 2022-04-19 13:32:39 -05:00
keyan 822fa9113a refactor link/dicussion to upserts and reuse more code 2022-04-18 17:10:26 -05:00
keyan 89fb68f746 multiple comments with the same parent are exp in cost 2022-04-17 08:13:52 -05:00
keyan a49cd8500c add nComments resolver 2022-04-15 11:51:49 -05:00
keyan becc69250e make comments faster using a lateral join 2022-04-03 12:25:39 -05:00
keyan 188a216313 speed up front page query 2022-04-02 17:39:15 -05:00
keyan d938596efe log query performance and reduce full item resolver calls 2022-03-31 13:05:11 -05:00
keyan 8ca33b1bb7 detect dupes between both youtube url types 2022-03-10 15:44:46 -06:00
keyan 8b1a923ac1 make boost more expensive 2022-03-09 13:44:50 -06:00
keyan a627322220 add job company and location 2022-03-07 15:50:13 -06:00
keyan 1472de0f91 sats/mo -> sats/min on jobs 2022-03-07 13:30:21 -06:00
keyan 7b0ce0c31b don't be an idiot and fetch comments when we don't need them 2022-03-04 12:05:16 -06:00
keyan 1b84f76a27 make jobs expensive, priced based ranking rather than auction 2022-03-03 12:56:02 -06:00
keyan 9eced2b334 remove extra log statement 2022-02-28 17:29:20 -06:00
keyan 022c72b95b remove extra migrations, refine jobs 2022-02-28 14:09:21 -06:00
keyan 3fb7ab9cd7 fix integer overflow 2022-02-26 15:42:38 -06:00
keyan bc1c45e7bf account for job payment status 2022-02-26 10:41:30 -06:00
keyan b954186d31 jobs w/o payments yet 2022-02-24 13:05:57 -06:00
keyan 0954da18b8 prevent top item/comment gaming with WoT 2022-02-12 09:08:39 -06:00
keyan 0aee683f0f only allow one comment from a given user on the same parent 2022-02-09 13:42:13 -06:00
keyan 7d088cdd0b refine search 2022-02-03 16:29:48 -06:00
keyan e18ca2fee8 comment exact matches should rank higher than title fuzz matches 2022-02-03 16:04:20 -06:00
keyan 66d2c4f9a9 search highlighting 2022-02-03 16:01:42 -06:00
keyan 075d147f63 delay capture because font isn't loading 2022-02-03 13:41:09 -06:00
keyan 48c72fc0c1 rank exact search matches higher 2022-02-02 16:01:48 -06:00
keyan dce189703c make wot ranking live + wot ranked comments 2022-02-02 16:01:48 -06:00
keyan af2c990a51 add production search config 2022-01-28 12:37:23 -06:00
keyan afed19430c working search 2022-01-27 13:18:48 -06:00
keyan 28b86af898 basic search query api 2022-01-26 09:35:14 -06:00
keyan d413b49e24 search index functions 2022-01-25 14:57:40 -06:00
keyan 5d49ecc536 refine tipping experience, removing notion of upvote from UX 2022-01-20 17:04:12 -06:00
keyan 129ec89b68 make WoT source configurable, remove logging, prevent negative ranks 2022-01-18 11:26:42 -06:00
keyan cdfe973a65 add wot page 2022-01-17 16:38:40 -06:00
keyan 5a4c249a74 add link to yesterday's daily discussion 2022-01-13 13:05:43 -06:00
keyan c3e6627cea support pinned posts + recurring pins 2022-01-07 10:32:31 -06:00
keyan 0dfda596b0 comment sorting 2021-12-21 15:35:25 -06:00
keyan 05301d822f better dupe protection with GET param whitelist 2021-12-20 16:26:22 -06:00
keyan 8e5327022d WIP top comments and users 2021-12-16 17:05:31 -06:00
keyan 1a3fdda382 new bolt 2021-12-05 11:37:55 -06:00
keyan 996d0a9352 click to comment goes to root thread 2021-11-27 12:01:02 -06:00
keyan 725c05dd69 allow faq to avoid editting time limit 2021-10-30 14:59:21 -05:00
keyan c80e4d107c dupe alerts on link posts 2021-10-28 15:49:51 -05:00
keyan 07b9da353b smarter use of SSR and caching 2021-10-26 15:49:37 -05:00
keyan 68ddd0f86b sort by top posts 2021-10-21 17:05:06 -05:00
keyan 5bd8025b2b speed hack hot page 2021-10-06 18:50:18 -07:00
keyan 027ba6a048 WIP user bio 2021-09-23 17:18:48 -05:00
keyan e7787e3e67 WIP bios 2021-09-23 12:42:00 -05:00
keyan af2797f12a make post boost transactional 2021-09-14 12:55:59 -05:00
keyan e4c1c2f1e1 refine tipping 2021-09-12 11:55:38 -05:00
keyan 650ad03de5 move boost to post creation 2021-09-11 16:52:19 -05:00
keyan 2dd49171e2 complete tips 2021-09-10 16:13:52 -05:00
keyan 3f8b5894cb small clean up 2021-09-09 14:10:15 -05:00
keyan f23da4397f fix for overloaded pgpsql function 2021-09-09 10:46:20 -05:00
keyan 93428e3183 tips WIP 2021-09-08 16:51:23 -05:00
keyan 91a2061342 cache magic - use cache and network except when a result of popstate 2021-09-06 17:36:08 -05:00
keyan ce0e3dac45 auto-populate link title 2021-08-22 10:25:17 -05:00
keyan 099a578a1b protect from null mentions 2021-08-19 15:13:04 -05:00
keyan 3370675d61 db portion of mentions 2021-08-18 17:20:33 -05:00
keyan 96a18e6c9d query is working 2021-08-17 13:15:24 -05:00
keyan 1d6e301b10 fix crashes and report which object failed in walletd 2021-08-12 16:21:56 -05:00
keyan a48cd33db3 edit posts - links and discussions 2021-08-11 15:13:10 -05:00
keyan b4be2c613b comment edit spagetti 2021-08-10 17:59:06 -05:00
keyan 9b5f6a871d make boost decay less agro 2021-07-10 08:03:37 -05:00
keyan 55f5460116 remove test cursor time 2021-07-09 14:16:26 -05:00
keyan 676a912974 decay boost a lot more 2021-07-09 14:12:35 -05:00
keyan 68e80b615c working previews 2021-07-07 19:15:27 -05:00
keyan 2e26e421e7 lnurl-auth 2021-06-26 22:09:39 -05:00
keyan 01922e4b88 notifications done 2021-06-24 18:56:01 -05:00