stacker.news/lib
ekzyis a6713f9793
Account Switching (#644)
* WIP: Account switching

* Fix empty USER query

ANON_USER_ID was undefined and thus the query for @anon had no variables.

* Apply multiAuthMiddleware in /api/graphql

* Fix 'you must be logged in' query error on switch to anon

* Add smart 'switch account' button

"smart" means that it only shows if there are accounts to which one can switch

* Fix multiAuth not set in backend

* Comment fixes, minor changes

* Use fw-bold instead of 'selected'

* Close dropdown and offcanvas

Inside a dropdown, we can rely on autoClose but need to wrap the buttons with <Dropdown.Item> for that to work.

For the offcanvas, we need to pass down handleClose.

* Use button to add account

* Some pages require hard reload on account switch

* Reinit settings form on account switch

* Also don't refetch WalletHistory

* Formatting

* Use width: fit-content for standalone SignUpButton

* Remove unused className

* Use fw-bold and text-underline on selected

* Fix inconsistent padding of login buttons

* Fix duplicate redirect from /settings on anon switch

* Never throw during refetch

* Throw errors which extend GraphQLError

* Only use meAnonSats if logged out

* Use reactive variable for meAnonSats

The previous commit broke the UI update after anon zaps because we actually updated item.meSats in the cache and not item.meAnonSats.

Updating item.meAnonSats was not possible because it's a local field. For that, one needs to use reactive variables.

We do this now and thus also don't need the useEffect hack in item-info.js anymore.

* Switch to new user

* Fix missing cleanup during logout

If we logged in but never switched to any other account, the 'multi_auth.user-id' cookie was not set.

This meant that during logout, the other 'multi_auth.*' cookies were not deleted.

This broke the account switch modal.

This is fixed by setting the 'multi_auth.user-id' cookie on login.

Additionally, we now cleanup if cookie pointer OR session is set (instead of only if both are set).

* Fix comments in middleware

* Remove unnecessary effect dependencies

setState is stable and thus only noise in effect dependencies

* Show but disable unavailable auth methods

* make signup button consistent with others

* Always reload page on switch

* refine account switch styling

* logout barrier

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-09-12 13:05:11 -05:00
..
apollo.js Account Switching (#644) 2024-09-12 13:05:11 -05:00
badge.js check both `navigator.permissions.query` and `Notification.permission` for permissions (#655) 2023-11-25 11:32:41 -06:00
bip39-words.js add lnc attached wallet (#1104) 2024-04-26 21:22:30 -05:00
bolt11.js add lnc attached wallet (#1104) 2024-04-26 21:22:30 -05:00
clicks.js Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"" 2023-07-23 10:08:43 -05:00
cln.js Support Tor for LNbits recv (#1336) 2024-08-27 11:16:02 -05:00
constants.js paid action limits (#1323) 2024-08-21 14:45:51 -05:00
create-prisma.js allow db connection limit and timeout configuration 2024-07-16 13:42:09 -05:00
crypto.js Store hashed and salted email addresses (#1111) 2024-05-04 18:06:15 -05:00
currency.js feat: added NGN currency (#1264) 2024-07-21 11:46:52 -05:00
cursor.js use keyset pagination for notifications (#899) 2024-03-06 13:53:13 -06:00
error.js Throw errors which extend GraphQLError (#1386) 2024-09-10 11:35:25 -05:00
fancy-names.json Add setting to send diagnostics back to SN (#463) 2023-09-18 18:00:16 -05:00
form.js backend payment optimism (#1195) 2024-07-01 12:02:29 -05:00
format.js Msats to sats floor (#1307) 2024-08-16 19:33:17 -05:00
item.js refactor embeds to be reused (#1368) 2024-09-07 12:07:10 -05:00
lnurl.js add NEXT_PUBLIC_URL 2024-04-08 17:54:39 -05:00
macaroon-id.js LND autowithdraw (#806) 2024-02-13 13:17:56 -06:00
macaroon-id.proto LND autowithdraw (#806) 2024-02-13 13:17:56 -06:00
macaroon.js Wallet definitions with uniform interface (#1243) 2024-07-20 17:51:46 -05:00
madness.js reintroduce daily rewards (#1134) 2024-05-01 09:30:36 -05:00
md.js don't import css into /lib 2024-06-25 17:18:21 -05:00
new-comments.js subtle highlight of new comments 2023-08-06 14:18:40 -05:00
nostr.js Fix websocket leaks (#1334) 2024-08-27 11:15:00 -05:00
package.json Convert worker to ESM (#500) 2023-09-23 20:19:35 -05:00
proxy.js Support Tor for LNbits recv (#1336) 2024-08-27 11:16:02 -05:00
rainbow.js undo zap/downzap and improve downzap ux 2023-12-19 19:55:19 -06:00
rand.js use rand lightning animation when not logged in 2021-07-16 11:47:18 -05:00
remark-mention.js fix mdast find and replace imports 2023-07-24 20:03:56 -05:00
remark-sub.js fix markdown inline code and headings 2023-10-23 17:14:37 -05:00
rss.js Use module path aliases (#938) 2024-03-19 19:37:31 -05:00
sndev.js dont expect unrun services in dev (#1279) 2024-07-31 19:44:08 -05:00
territory.js fix #951 also retroactively 2024-03-20 20:56:40 -05:00
time.js Fix missing user invoice timeout (#1379) 2024-09-08 17:16:52 -05:00
timedate-scraper.js Attempt to get publication year when auto-titling links (#520) 2023-10-20 19:23:50 -05:00
url.js embed spotify podcasts 2024-09-10 15:11:46 -05:00
url.spec.js Fix missing commentId parsing for item mentions (#1219) 2024-06-03 21:54:42 -05:00
user.js honor mutes when sending push notifications (#1145) 2024-05-12 13:55:56 -05:00
validate.js Phoenixd send+recv (#1322) 2024-08-26 18:20:45 -05:00
wallet.js Fix inconsistency between walletTypeToResolveType and generateTypeDefName (#1318) 2024-08-19 17:36:07 -05:00
webPush.js Fix duplicate push notification as reply and subscription (#1392) 2024-09-11 16:28:55 -05:00