Commit Graph

163 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 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
kevkevin 4586fd7f70
Eslint setup and github action (#360) 2023-08-07 18:43:15 -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 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 599d3c41f0 fix next timeout typo 2023-08-02 12:13:40 -05:00
keyan 1e97726a66 make sure upstreams have longer keepalives 2023-08-02 11:36:23 -05:00
keyan 2f3551939c let nginx manage keepalive 2023-08-02 10:40:03 -05:00
keyan 918c5a0d08 add keep alive timeout to next start 2023-08-02 05:50:53 -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 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
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 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 c239d05e30 add --trace-warnings 2021-08-19 15:12:36 -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 2e26e421e7 lnurl-auth 2021-06-26 22:09:39 -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 32f94f02aa upgrade nodejs version 2021-06-10 16:46:30 -05:00
keyan 218d3120f8 migrate before build 2021-06-06 10:09:01 -04:00
keyan deed0059d8 npm rebuild -> build 2021-06-05 20:34:48 -04:00
keyan b55d7eadb3 reattempt to use npm 2021-06-05 20:13:07 -04:00
keyan a24cc9b5a5 move hook to prebuild 2021-06-04 18:32:16 -04:00
keyan 94e286745a prestart 2021-06-03 23:50:20 -04:00
keyan 9fbf3965f3 make build deps non dev deps 2021-06-03 23:17:27 -04:00
keyan 15ca4dc2de start in prod on correct port 2021-06-03 22:59:44 -04:00
keyan ae92885d1e specify node version 2021-06-03 22:01:58 -04:00
keyan a837675428 specify node version 2021-06-03 18:39:52 -04:00
keyan 4dafcf0d7c specify node version 2021-06-03 18:36:04 -04:00
keyan 21dc9cc39d specify node version 2021-06-03 18:32:28 -04:00
keyan f535dc134c small improvements 2021-06-03 16:36:02 -04:00