Commit Graph

84 Commits

Author SHA1 Message Date
keyan df6575d701 remove slashtags completely 2023-08-17 13:40:21 -05:00
keyan f3ccc73ff8 more package bumps 2023-08-16 12:57:53 -05:00
keyan 7e4a874068 update packages 2023-08-15 19:52:55 -05:00
ekzyis 67a0de3ea5
Notifications with nostr info (#368)
* Show zap message and pubkey in notifications

+ show zap request event in invoice view

* enhance ui

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-08 13:19:31 -05:00
ekzyis e3c60d1ef8
Sync push subscriptions on every page load (#370)
Most browsers don't support the pushsubscriptionchange event.

We workaround this by saving the current push subscription in IndexedDB so we can check during every page load if the push subscription changed.

If that is the case, we manually sync the push subscription with the server.

However, this solution is not perfect as mentioned in https://medium.com/@madridserginho/how-to-handle-webpush-api-pushsubscriptionchange-event-in-modern-browsers-6e47840d756f which was used for reference:

> This solution is not perfect, the user could lose some push notifications if he doesn’t open the webapp for a long time.

Co-authored-by: ekzyis <ek@stacker.news>
2023-08-07 20:03:34 -05:00
keyan 8f52d63569 try upgrading next to canary? 2023-08-02 20:32:56 -05:00
keyan 394b898bd8 downgrade next 13.4.11 due to buggy child processes 2023-08-02 19:44:26 -05:00
keyan 4bf0c46efc npm dedupe 2023-08-02 17:56:43 -05:00
keyan 16e882a1ce upgrade back to node 18 2023-08-02 15:51:01 -05:00
keyan a0632bc748 a dream: maybe its a bug in node that's been since patched 2023-08-02 14:58:49 -05:00
keyan b1b8f9de56 implement our own nprogress bar 2023-08-01 21:06:15 -05:00
keyan 6f445f2545 move prisma out of dev deps for eb 2023-07-31 16:19:27 -05:00
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 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 567b1b9e88 Revert "Revert "deploy hack: fix slashtags package user""
This reverts commit ba0cd71d23.
2023-07-23 10:08: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 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