96 Commits

Author SHA1 Message Date
keyan
ffb856ae88 fix oauth signup 2023-08-07 15:05:55 -05:00
keyan
5232b59625 upgrade to next-auth 4 (bonus: improve error pages) 2023-07-29 14:38:20 -05:00
keyan
7542dd6cc4 upgrade to prisma 4 2023-07-26 19:18:42 -05:00
keyan
672853a7ea upgrade to prisma 3 2023-07-26 11:01:31 -05:00
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
747371a4e4 snl live banner 2023-06-20 09:57:06 -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
f6ab939bcc use mat views (tm) for historicals (tm) 2023-05-19 17:38:39 -05:00
keyan
80968d7b35 let comments influence ranking 2023-05-09 13:52:35 -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
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
3a9994a9a6 denormalize user streak to avoid extra dip 2023-02-03 14:40:30 -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
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
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
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
ekzyis
2dd4b1ce98
Merge branch 'master' into 103-add-other-currencies 2022-10-04 01:01:43 +02:00
keyan
d9d426e5c3 add freebies 2022-09-27 16:19:15 -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
172d6c3c2f optionally hide invoice descriptions 2022-08-30 16:50:47 -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