Commit Graph

98 Commits

Author SHA1 Message Date
keyan 8c1ad530bc downgrade to node v16 2023-07-31 12:22:26 -05:00
keyan d5aeea6dd3 bump packages again 2023-07-31 08:43:13 -05:00
keyan d04dc691df provide jwt migration 2023-07-30 14:03:24 -05:00
keyan 5232b59625 upgrade to next-auth 4 (bonus: improve error pages) 2023-07-29 14:38:20 -05:00
keyan 566e3f427b upgrade to prisma 5 2023-07-26 19:51:37 -05:00
keyan 213e69d0d4 upgrade to node v18 2023-07-26 19:22:22 -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
keyan e09ea310cd fix mdast library conflict 2023-07-25 13:59:07 -05:00
keyan ab2046ab0b fix issues with new linting 2023-07-25 09:14:45 -05:00
keyan dae9c64e96 more package updates 2023-07-24 19:50:55 -05:00
keyan e87610c45b update packages and reduce bundle size 2023-07-24 17:50:12 -05:00
keyan 6407455def upgrade react-bootstrap 2023-07-24 13:53:53 -05:00
keyan 59f7b6ff26 Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades""
This reverts commit 18910fa2ed.
2023-07-23 10:08:43 -05:00
keyan 18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c.
2023-07-23 09:16:12 -05:00
keyan d0314ab73c shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades 2023-07-21 17:33:11 -05:00
keyan 8350b1df3b trust algo v4 2023-07-05 20:30:50 -05:00
keyan 09d7e960cc back to lightning animation 2023-07-05 09:47:44 -05:00
keyan 3068252adf merge github master 2023-07-04 15:35:04 -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 b6628eb159 july 4th festivities 2023-07-03 14:46:54 -05:00
ekzyis e97509eea7
Use PWA with display: standalone (#292)
* Use next-pwa

* Use standalone + back button

* Use Notification API

* Use custom service worker

* Use url_handlers

* Add offline page

* Use smaller icon in notification

* Only prompt for notifications if logged in

* small enhancements to standalone pwa

* remove unused back arrow

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-05-31 17:28:33 -05:00
keyan 93d4581360 complete nip 57 support 2023-02-14 16:58:12 -06:00
keyan ef5346000b support NIP-57 2023-02-14 12:52:15 -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 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 2080cb896d lexical beta test url 2023-01-05 13:24:09 -06:00
keyan 525cab2573 upgrade deps 2022-11-06 11:28:58 -06:00
keyan 6225b9e7aa upgrade ln-service 2022-10-10 19:43:51 -05:00
keyan a5d1d8dc0f user suggestions on forward 2022-08-31 14:09:49 -05:00
keyan fba0187b2c add link to recent/comments 2022-08-23 17:34:51 -05:00
keyan 70cbdd057a add table of contents 2022-07-18 16:24:28 -05:00
keyan beef34abfa linkable headers 2022-07-17 10:35:50 -05:00
keyan f024cd39a2 add usage mvp usage charts 2022-06-10 14:20:33 -05:00
keyan 1df49e03d9 account linking 2022-06-08 16:26:44 -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 b954186d31 jobs w/o payments yet 2022-02-24 13:05:57 -06:00
keyan 18ff637e5c fix cls of twitter embed 2022-02-12 08:06:41 -06:00
keyan ac19d89ba8 upgrade markdown stuff 2022-02-06 07:59:22 -06:00
keyan 8141d29b36 youtube embed 2022-02-05 15:40:54 -06:00
keyan 8c2a4dc76a add search SEO and capture 2022-02-05 11:29:41 -06:00
keyan 66d2c4f9a9 search highlighting 2022-02-03 16:01:42 -06:00
keyan af2c990a51 add production search config 2022-01-28 12:37:23 -06:00
keyan d413b49e24 search index functions 2022-01-25 14:57:40 -06:00
keyan 977639ccb9 twitter embed 2022-01-20 14:22:10 -06:00
keyan 3d94ef32ac improve screen capture: 2x resolution, caching, exit on exception 2022-01-12 17:13:09 -06:00
keyan e950b0df7f add job queue 2022-01-05 14:37:34 -06:00