Commit Graph

107 Commits

Author SHA1 Message Date
keyan ba0cd71d23 Revert "deploy hack: fix slashtags package user"
This reverts commit 67509fe2be.
2023-07-23 09:16:06 -05:00
keyan 67509fe2be deploy hack: fix slashtags package user 2023-07-21 19:40:17 -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 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
keyan 06f5ed731e satisitics with invoice & withdrawal 2021-12-15 10:50:11 -06:00
keyan 16685771da downgrade prisma given breaking changes 2021-11-28 12:22:47 -06:00
keyan 70c4edfbaa upgrade prisma 2021-11-23 15:23:40 -06:00
keyan f56315f89f add progress bar and fix reply padding 2021-11-13 07:28:08 -06:00
keyan c255a4b8fe remove styled components 2021-11-09 16:44:48 -06:00
keyan c6e6ddfa65 half-working local storage version 2021-11-09 11:38:58 -06:00
keyan 2d97314d33 dark mode without ability to switch 2021-11-04 14:22:03 -04:00
keyan 41504ba06b long press tip dialog 2021-10-30 11:52:24 -05:00
keyan 68ddd0f86b sort by top posts 2021-10-21 17:05:06 -05:00
keyan 50477c1b65 dockerize dev env 2021-10-20 14:57:11 -05:00
keyan ca1a95094c ssr everything 2021-09-30 10:46:58 -05:00
keyan 7ffb3fd18a support webln fund and withdrawal 2021-09-07 12:52:59 -05:00
keyan ce0e3dac45 auto-populate link title 2021-08-22 10:25:17 -05:00
keyan b4be2c613b comment edit spagetti 2021-08-10 17:59:06 -05:00
keyan d083845a77 auto grow textareas 2021-07-16 12:32:54 -05:00
keyan 0f6cb029c3 add plausible and proxy it 2021-07-15 15:49:13 -05:00
keyan d2562e5cff link to user page on mention 2021-07-15 14:56:23 -05:00
keyan 68e80b615c working previews 2021-07-07 19:15:27 -05:00
keyan a9490a399e markdown textareas 2021-06-27 17:28:30 -05:00
keyan 01922e4b88 notifications done 2021-06-24 18:56:01 -05:00
keyan f968ab7954 paginate stories 2021-06-22 12:47:49 -05:00
keyan b594e11891 a little bit of social/seo work with non-flashing skeleton 2021-06-17 13:24:35 -05:00
keyan 80ff13abd6 finish mvp 2021-05-24 19:08:56 -05:00