Commit Graph

144 Commits

Author SHA1 Message Date
SatsAllDay 15f9950477
Store hashed and salted email addresses (#1111)
* first pass of hashing user emails

* use salt

* add a salt to .env.development (prod salt needs to be kept a secret)
* move `hashEmail` util to a new util module

* trigger a one-time job to migrate existing emails via the worker

so we can use the salt from an env var

* move newsletter signup

move newsletter signup to prisma adapter create user with email code path
so we can still auto-enroll email accounts without having to persist the email address
in plaintext

* remove `email` from api key session lookup query

* drop user email index before dropping column

* restore email column, just null values instead

* fix function name

* fix salt and hash raw sql statement

* update auth methods email type in typedefs from str to bool

* remove todo comment

* lowercase email before hashing during migration

* check for emailHash and email to accommodate migration window

update our lookups to check for a matching emailHash, and then a matching
email, in that order, to accommodate the case that a user tries to login
via email while the migration is running, and their account has not yet been migrated

also update sndev to have a command `./sndev email` to launch the mailhog inbox in your browser

also update `./sndev login` to hash the generated email address and insert it into the db record

* update sndev help

* update awards.csv

* update the hack in next-auth to re-use the email supplied on input to `getUserByEmail`

* consolidate console.error logs

* create generic open command

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-05-04 18:06:15 -05:00
Ben Allen 8a735791ce
Add dashboard to satistics page (#1099)
* updated graphs ad queries

* fixed query

* fixed graph data pull

* converted msats to sats

* linter fix

* Fixed labels for graphs

* linter

* linter

* feat: style header

* lint

* fix: mobile navbar link and graph titles

* style charts

* change key names

* refine satistics graphs

---------

Co-authored-by: Dillon <dilloncortez@gmail.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-04-28 16:05:23 -05:00
SatsAllDay e6b825dafe
Mute Management Settings Page (#1034)
* first pass of a mute mgmt page, ported from subscription mgmt page pr

* adjust error message for mutes

* muted users -> muted stackers

* fix typo in component name
2024-04-08 09:13:56 -05:00
SatsAllDay 992fc54160
Subscription management page (#1000)
* first pass of a subscription management page under settings

* add tabs to settings ui

* NymActionDropdown

* update Apollo InMemoryCache to merge paginated list of my subscribed users

* various updates

* switch from UsersNullable to Users

* bake the nym action dropdwon into the user component

* add back fields to the user query

* `meSubscriptionPosts`, `meSubscriptionComments`, `meMute`

* Refetch my subscribed users when a user subscription is changed

* update user list to hide stats in the subscribed list users

* update my sub'd users fragment to remove unnecessary user fields

* memoize subscribe user context provider value to avoid re-renders

* use inner join instead of left join

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* throw error when unauthenticated

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-04-03 19:38:47 -05:00
SatsAllDay 4b77e7a1a9
Limit scope of API Keys (#989)
* first pass of disallowing certain APIs with API keys

Disallow the following APIs:
* item.act (zap)
* create withdrawal
* unlink auth method
* link unverified email

* disallow creating lnauths via API key to stop the flow of linking via lnauth

* undo the limitation on donating to rewards

* revert the assertion on createAuth

* assert no api key on createWithdrawal and sendToLNAddr

* incorporate PR feedback by adding API Key negative assertion to more mutations:

* `createInvite`
* `createAuth`
* `upsertWalletLND` by way of `upsertWallet`
* `upsertWalletLNAddr` by way of `upsertWallet`
2024-04-03 15:11:06 -05:00
keyan 2c9e668177 april million sat madness 2024-04-01 08:56:13 -05:00
ekzyis 17a0106fcc Hash API keys with SHA-256 and never show them again 2024-03-26 22:33:18 +01:00
ekzyis 3388f818cf Add withdrawal notifications 2024-03-26 00:50:48 +01:00
keyan edb3dd365c denormalize last zap on item for notification querying 2024-03-24 14:16:29 -05:00
Keyan a7b0272200
denormalize replies (#958) 2024-03-23 23:15:00 -05:00
SatsAllDay 7087647cc0
Add top stackers, spender, and cowboys to newsletter (#954)
* Add top cowboys, stackers, and spenders to newsletter

* Rearrange to match the issue title

* fix top spenders `by` variable

* Update user resolver for top users `spending` `by` value

* wrap in try catch to not have errors break the script execution

return the array as defined whenever an error occurs
2024-03-23 12:23:31 -05:00
ekzyis d237861ff5
Use module path aliases (#938)
* Use module path aliases

* fix broken refactor

* path mapping for svgs, style, and remaining places (bonus: lose babel dep)

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-03-19 19:37:31 -05:00
ekzyis 687012d1a0
API Keys (#915)
* Generate API key in settings

* Check x-api-key for GraphQL API requests

* Don't fallback to cookie if x-api-key header was provided

* Select all session fields

* Fix error if API key not found

* Fix style in settings via form-label className

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-03-14 15:32:34 -05:00
ekzyis c8e65d5a23
Don't hide self in top even if hidden (#905)
* Don't hide self in top even if hidden

* Also don't hide self in top cowboys

* only use anon icon for anon stuff

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-03-13 19:26:59 -05:00
Keyan 0b0e36e3cb
Monthly rewards (#890)
* show placeholder for hidden stackers in top

* top rewardability views

* make territory revenue idependent job

* monthly rewards and leaderboard on rewards pages

* fix earn reschedule

* add query for rewards leaderboard

* reduce likelihood of rewards racing with views

* fix earn and refine values views
2024-03-01 10:28:55 -06:00
mzivil b0bf7add34
Show founded territories on profile (#868)
* add nterritories field to User

* add userSubs query

* show territories tab on user profiles

hide the tab if user has 0 territories, except when the
viewer navigated directly to the user's territories page

* add USER_WITH_SUBS query for user territories page

* add user territories page
2024-02-21 19:55:48 -06:00
keyan 3106850ce9 fix reference to old materialized view 2024-02-16 12:58:50 -06:00
Alex Lewin b3498fe277
Add Opt-in to Display Linked Accounts in Profile (#826)
* Add display linked accounts to settings

* Apply suggestions from code review

Co-authored-by: ekzyis <ek@stacker.news>

* small styling enhancements

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-02-14 13:33:31 -06:00
Keyan ec4e1b5da7
LND autowithdraw (#806)
* wip

* wip

* improved validatation, test connection before save, code reuse

* worker send to lnd

* autowithdraw priority
2024-02-13 13:17:56 -06:00
keyan eb99fcef9e improve stat gathering 2024-01-19 15:19:26 -06:00
ekzyis b7413e9e32 Fix 'column Item.day does not exist' 2024-01-14 19:10:31 +01:00
keyan b530b611f5 disable self sends in autowithdraw 2024-01-12 09:37:50 -06:00
keyan 86e8350994 autowithdraw to lightning address 2024-01-11 13:10:07 -06:00
keyan 717f8d1ef6 territory billing notifications 2024-01-03 15:20:10 -06:00
keyan 47a5b311c3 refine mentions 2023-11-21 14:49:39 -06:00
keyan 589b15b597 fix custom dates to use ms since epoch 2023-11-14 10:23:44 -06:00
keyan 494b8b3dcd better organize user graphql types 2023-11-09 19:05:35 -06:00
rleed 3a56782572
Custom date selector for more pages (#567)
* add custom range option to top items page

* add custom range option to profile page

* add date filter option to chart pages

* cleanup

* fix x-axis date labels

* date picker improvements

* enhancements to custom date selection

* remove unneeded condition

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-11-08 18:15:36 -06:00
keyan d2697477a0 saner lastSeenAt checking 2023-10-23 18:19:36 -05:00
keyan 53a8af8d20 improve delete bot ux 2023-10-23 17:55:48 -05:00
keyan 3160a3f66f prevent redoing queries for notifications 2023-10-22 17:51:07 -05:00
keyan f9f13cc752 update checkedNotesAt when there are none 2023-10-22 17:38:24 -05:00
keyan 1a33c8778b hasnewnotes query cleanup 2023-10-22 12:47:46 -05:00
keyan 4d7d4c28f9 user new create_item and remove double check for replies 2023-10-22 12:19:11 -05:00
Satoshi Nakamoto a6d3ca09e9 Don't include your own comments when determining if there are new thread
subscription replies for user hasNewNotes
2023-10-13 20:23:57 -04:00
SatsAllDay 502bfee072
Mention auto-complete (#532)
* uber rough first pass at mention autocompletes

* support custom limit on topUsers query

* hot keys for selecting user suggestion in markdown input

* query top stackers for mentions with no search query

* refactor UserSuggestion to help with reusability

textarea-caret for placing the user suggest dropdown appropriately

other various code cleanup items to make it easier to use

off by one errors are fun!

various code cleanup and reuse the UserSuggest component in InputUserSuggest to reduce duplication

* change default users to week query

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-04 15:10:56 -05:00
keyan dfe859eb92 fix top user stack amount to only include tips 2023-09-28 16:26:06 -05:00
keyan 4bd489a36a mutes 2023-09-28 15:02:25 -05:00
keyan 370e3c1c48 raise boost minimum to 25k, enhance editing boost, JIT fund editing costs 2023-09-25 19:54:35 -05:00
keyan 2afb8dc231 fix deposits not showing up in notifications 2023-09-18 19:30:26 -05:00
SatsAllDay bc2363dfab
Verified contributors (#474)
* `isContributor`, `hideIsContributor` user fields and basic UI decoration on profile page

* Update verified contributor decoration on profile page

* Add contributors instructions

* update setting label

* Remove `isContributor` from DB, load contributors from file into memory

* fix merge error

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-18 13:57:02 -05:00
SatsAllDay 8ab58fff87
Proposal: User Subscriptions: separate posts and comments (#470)
* Subscribe to user posts and comments independently

* Track when comments and posts subscriptions are set to filter out old items

* Only send push notification to subscribed user if posts/comments enabled

* Remove `posts` and `comments` boolean fields on UserSub, rely solely on timestamps
2023-09-18 13:20:02 -05:00
SatsAllDay 94fbabcdf9
Notifications for when you are forwarded sats from a post (#467)
* Notifications for when you are forwarded sats from a post

Support notifications when a post for which you are forwarded gets zapped

This is controlled by a new boolean flag in user settings

* Send push notifications to forwarded users when they get forwarded sats

* Add `Promise.allSettled` per PR feedback

* Remove `FEE` act type when building forwarded zaps notifications

Don't include `FEE` actions, only `TIP` actions to avoid "0 sats forwarded" notifications

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-09-12 10:31:46 -05:00
rleed 2ba969ebab
Add new visitor welcome banner (#418)
* add new visitor welcome banner

* show dismissible banner on first-time login

* add mutation to hide welcome banner

* Update components/banners.js

Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>

* fix error handling

* simplifications and other review suggestions

* cleanup

* restore selective display logic

* remove unnecessary query arguments

* cleanup a bit more

* don't show welcome banner to existing stackers

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-09-11 16:29:45 -05:00
keyan b7d0a373f4 don't notify for hold invoices 2023-08-31 11:38:45 -05:00
SatsAllDay 0d4a225442
Subscribe to a user (#443)
* First pass of user subscriptions

* add new db model to track subscriptions
* update user typedef and api resolver for subscription state
* add subscribe action to user profile page
* add mutation to subscribe to a user

* Update notifications queries, hasNewNotes queries for FollowActivity note type

* Only show items that have been created since subscribing to the user

* Send push notifications to user subscribers for posts and comments

* Rename item dropdown to action dropdown and re-use for item info and user actions

* Don't allow self-follows

* Add index on followee for faster lookups

* Don't show subscribe action if not logged in

* small style enhance

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-28 20:27:56 -05:00
keyan 781d034422 fix top cowboy nulls 2023-08-28 20:12:33 -05:00
keyan 2e846af737 fix bio 2023-08-27 17:48:46 -05:00
keyan 61c7bb28c2 allow name checking if you aren't logged in 2023-08-25 14:22:02 -05:00
keyan df6575d701 remove slashtags completely 2023-08-17 13:40:21 -05:00