Commit Graph

157 Commits

Author SHA1 Message Date
ekzyis 0d3328e509
Show longest cowboy streak in profile (#353)
* Show longest cowboy streak in profile

* Fix image offset

* Initialize maxStreak for every user

* Use resolver instead of denormalization for maxStreak

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-12 19:10:29 -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 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
ekzyis f6b4de24f0 Add subName to seed 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 e2aceee234 higher tip defaults 2023-05-06 18:29:20 -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