Commit Graph

249 Commits

Author SHA1 Message Date
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 431947eeee different freebie rules 2023-06-20 12:55:45 -05:00
keyan 03e0646560 ~meta sub 2023-06-20 11:27:41 -05:00
keyan 747371a4e4 snl live banner 2023-06-20 09:57:06 -05:00
keyan cc6dc8c68b add daily discussion thread permalink 2023-06-19 14:40:24 -05:00
keyan b71c595856 move @hn to tech 2023-06-12 15:10:44 -05:00
ekzyis b890215b98
Tech sub (#311)
* Add tech sub

* Fix line break in RSS popover

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-06-12 12:41:22 -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 85ea1f0a07 recreate user_stats_day index needed for concurrent refresh 2023-05-21 21:23:16 -05:00
keyan d9c7acd106 fix post count in stats bug (#288) 2023-05-21 12:18:55 -05:00
keyan f6ab939bcc use mat views (tm) for historicals (tm) 2023-05-19 17:38:39 -05:00
keyan 0a3f5fd201 materialize dashboard in views 2023-05-19 17:38:39 -05:00
keyan 6050041d39 retroactively denormalize earned msats to items/comments 2023-05-09 14:06:05 -05:00
keyan 80968d7b35 let comments influence ranking 2023-05-09 13:52:35 -05:00
keyan d948a653c9 add earned sats to items 2023-05-08 18:10:41 -05:00
keyan 5bd66349c0 add user data to comments query when logged out 2023-05-08 15:27:04 -05:00
keyan d77d644e15 lower noncritical job priority 2023-05-07 16:20:18 -05:00
keyan 6d1825bfc2 fix comment time zone 2023-05-06 21:15:49 -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 4be5286122 hide cowboy hat setting 2023-05-01 16:52:02 -05:00
keyan a241d683d8 nostr sub 2023-05-01 15:58:30 -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 30cde2ea38 fix nip57? 2023-02-15 11:20:43 -06:00
keyan 6480e1d9be stop old expired jobs without sats 2023-02-08 18:00:00 -06:00
keyan 3a9994a9a6 denormalize user streak to avoid extra dip 2023-02-03 14:40:30 -06:00
keyan b3f7f24cff trigger streak when eligible 2023-02-02 13:47:09 -06:00
keyan 072e60c954 streaks 2023-02-01 17:40:49 -06:00
keyan 291fe24363 denormalize bountyPaidTo 2023-01-26 17:28:10 -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 920be2bef6 fix sub submission for timestamping 2023-01-23 12:10:04 -06:00
keyan 29c59d93ea open timestamps 2023-01-22 14:17:50 -06:00
keyan 9644a9f867 slashtags auth 2023-01-18 12:49:20 -06:00
keyan 10ff3fa1c3 delete 2023-01-13 11:52:18 -06:00
keyan 2d012ba7fe allow nip05 for users 2023-01-06 18:53:29 -06:00
keyan 41226245c5 referrals 2022-12-19 16:27:52 -06:00
keyan 388f5ce9b4 fix donation func typo 2022-12-09 14:17:45 -06:00
keyan 7b7ed0047c turbo tipping 2022-12-09 13:25:38 -06:00
keyan e1bdb9c769 donations to rewards 2022-12-07 18:04:02 -06:00
keyan a2db3e18b4 better user analytics mostly 2022-12-01 15:31:04 -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
keyan 9431469453 more indices 2022-11-16 10:57:03 -06:00
keyan 13163232ec update ltree extension 2022-11-06 12:48:29 -06:00
keyan a1690ed511 improve freebie wrt boost, get off free earlier 2022-11-01 14:32:56 -05:00
keyan 99e5468b07 when NOSATS jobs are given 0 bid, make ACTIVE 2022-10-05 15:11:05 -05:00
ekzyis 2dd4b1ce98
Merge branch 'master' into 103-add-other-currencies 2022-10-04 01:01:43 +02:00
keyan 46ea2f661c make jobs great again 2022-09-29 15:42:33 -05:00
keyan 257303903f revert path index change 2022-09-27 16:44:36 -05:00
keyan 357b19bebd reserve top level names 2022-09-27 16:43:29 -05:00
keyan d9d426e5c3 add freebies 2022-09-27 16:19:15 -05:00
keyan 1621eeac80 median votes: int -> float 2022-09-23 10:43:57 -05:00
keyan ddb1b4a958 presume median downvote on new post 2022-09-22 17:27:27 -05:00
keyan 7faae425b3 wild west mode 2022-09-21 14:57:36 -05:00
keyan 08893d020c improved earning: more detail, longer top tail 2022-09-14 17:01:30 -05:00
ekzyis 5d4abecf3c Add input for fiat currency in settings 2022-09-13 02:02:55 +02:00
keyan 6aeeb40623 denormalize item sats, comment sats, last comment time, and num comments 2022-09-01 15:28:19 -05:00
keyan a5d1d8dc0f user suggestions on forward 2022-08-31 14:09:49 -05:00
keyan 172d6c3c2f optionally hide invoice descriptions 2022-08-30 16:50:47 -05:00
keyan 0ad886ffc0 constrain invoice quantity and amount 2022-08-30 15:33:39 -05:00
keyan 065cf284b3 add integer constraints 2022-08-27 10:48:59 -05:00
keyan 388c7d0240 full powered editing 2022-08-18 13:15:24 -05:00
keyan ddb4a30c4b spam fees 2022-08-11 15:38:10 -05:00
keyan 7cf5396ef3 remove free comments 2022-08-06 17:03:57 -05:00
keyan 82280b0966 add polls 2022-07-30 08:51:04 -05:00
keyan cb313429d5 job board enhancements 2022-07-21 17:55:05 -05:00
keyan 9d3c52ed00 improve trust 2022-07-05 14:51:13 -05:00
keyan 35b533c572 denormalize ranking metrics 2022-05-17 14:54:12 -05:00
keyan 29fb37b763 profile photos 2022-05-16 15:51:22 -05:00
keyan 9abc41b7b2 image uploading backend 2022-05-12 13:44:21 -05:00
keyan e2409efbaf indicate to user when there are new jobs 2022-05-09 13:01:23 -05:00
keyan 188230c37c add notification settings 2022-04-21 17:50:02 -05:00
keyan d978ff5ea5 forward tips from posts 2022-04-19 13:32:39 -05:00
keyan 2b594109ea WIP forward 2022-04-18 15:19:07 -05:00
keyan 89fb68f746 multiple comments with the same parent are exp in cost 2022-04-17 08:13:52 -05:00
keyan ce8afa536b make path index compatible with postgres 12 2022-04-13 16:24:24 -05:00
keyan bc9f602d13 up default tip to 10 2022-04-12 16:09:12 -05:00
keyan 501b7bd941 add gist index back 2022-04-12 14:21:46 -05:00
keyan c284e18278 denormalize stacked count 2022-04-04 16:54:31 -05:00
keyan 5ff856d061 earning 2022-03-17 15:13:19 -05:00
keyan 8c513e93c8 record sats spent on auction items 2022-03-16 11:35:51 -05:00
keyan 46f552b803 store last time user visited so we can guage retention 2022-03-14 11:43:21 -05:00
keyan 3f59d02c91 more indices 2022-03-10 13:26:35 -06:00
keyan 7997085813 add more indices to item 2022-03-10 13:17:30 -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 1b84f76a27 make jobs expensive, priced based ranking rather than auction 2022-03-03 12:56:02 -06:00
keyan 87e4376c10 fix auction to work as described 2022-03-02 14:55:13 -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 1338c026a3 create worker for auction ranking 2022-02-25 11:34:09 -06:00
keyan b954186d31 jobs w/o payments yet 2022-02-24 13:05:57 -06:00
keyan 5ade072b8c search index triggers 2022-01-26 11:03:21 -06:00
keyan 5d49ecc536 refine tipping experience, removing notion of upvote from UX 2022-01-20 17:04:12 -06:00
keyan e084e9e89f force upvote on variable tip 2022-01-20 14:36:39 -06:00
keyan 34a433c273 protect statistics user name and redirect typos 2022-01-19 16:05:58 -06:00
keyan 7903dbdaf3 WIP trust 2022-01-14 17:43:12 -06:00
keyan ccc1251f7e drop theme from users table 2022-01-14 11:42:45 -06:00
keyan f6028d441c add pgcrypto extension 2022-01-07 13:28:17 -06:00
keyan c3e6627cea support pinned posts + recurring pins 2022-01-07 10:32:31 -06:00
keyan e950b0df7f add job queue 2022-01-05 14:37:34 -06:00
keyan 435f32ac09 redo tipping, removing modal, adding walkthrough, setting tipping default to 1 2021-12-13 13:49:34 -06:00
keyan 4d3ab603da tip walkthrough 2021-12-09 14:41:09 -06:00
keyan eb02664084 fix tipping before upvoting causing boost bug 2021-11-11 14:27:29 -06:00
keyan 3bbf3f7470 add dark mode 2021-11-04 19:07:41 -04:00
keyan b8080137a8 lnurl-withdrawal support 2021-10-28 14:59:53 -05:00
keyan 159ad01ace fix boost on freebie post 2021-10-25 12:46:33 -05:00
keyan 955d1aa1b2 finish up invites 2021-10-15 18:07:51 -05:00
keyan 4935c7dc1c invite graphql + basic frontend 2021-10-12 18:49:04 -05:00
keyan 4d1b8bb11e add index to created_at columns 2021-10-06 07:43:32 -07: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 700f4510c4 fix vote->itemAct migration 2021-09-09 14:04:32 -05:00
keyan 3081a8ea16 remove redundant statement 2021-09-09 12:57:14 -05:00
keyan db8fcf78be fix new freebie bug and first page detection 2021-09-09 11:44:01 -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 28d684da73 workout tips functions etc 2021-09-08 16:15:06 -05:00
keyan 38ba31f2b4 case insensitive names 2021-09-02 17:22:00 -05:00
keyan 48146d1757 update with story 2021-09-02 12:49:17 -05:00
keyan 79cb2d5c27 withdrawl => withdrawal/withdraw 2021-08-19 16:42:21 -05:00
keyan 3370675d61 db portion of mentions 2021-08-18 17:20:33 -05:00
keyan b4be2c613b comment edit spagetti 2021-08-10 17:59:06 -05:00
keyan 14e929b3f0 allow retries of failed withdraw invoice while enforcing uniqueness of pending/confirmed 2021-07-10 09:16:40 -05:00
keyan 9a15c228dc add forgetten lnurl-auth files 2021-06-26 22:18:32 -05:00
keyan 01922e4b88 notifications done 2021-06-24 18:56:01 -05:00
keyan 17a79b2251 prepare for deployment 2021-06-02 10:23:30 -04:00
keyan 80ff13abd6 finish mvp 2021-05-24 19:08:56 -05:00
keyan a9ea341a7b create reserved usernames 2021-05-21 19:09:11 -05:00
keyan 8a462252af force unique user name 2021-05-21 14:34:40 -05:00
keyan 0eabe1463d attempts at serializable transactions 2021-05-19 20:09:32 -05:00
keyan 157488ea5d make withdrawls mostly work 2021-05-13 16:19:51 -05:00
keyan 7a8afd56c3 partial withdrawl 2021-05-12 20:51:37 -05:00
keyan d92fc12187 half done with wallets 2021-05-12 18:04:19 -05:00
keyan 67d1605666 transactional wallet management in plpgsql 2021-05-11 15:29:44 -05:00
keyan bc0389e622 invoiced ... WIP transactions 2021-05-11 10:52:50 -05:00
keyan 84b69fc481 ranking mostly 2021-04-27 16:30:58 -05:00
keyan c626998952 attempts at voting before running into cache issues 2021-04-26 16:55:15 -05:00
keyan bc5d4d4808 tables 2021-04-13 19:57:32 -05:00
keyan 9acde2df1c a bunch of increments 2021-04-12 13:05:09 -05:00
keyan 341b3a291a begin working on db schema 2021-03-25 14:29:24 -05:00