556 Commits

Author SHA1 Message Date
ekzyis
107a7f9e77
Fix expireSecs ignored for anons (#447)
Co-authored-by: ekzyis <ek@stacker.news>
2023-08-28 07:08:29 -05:00
keyan
2e846af737 fix bio 2023-08-27 17:48:46 -05:00
keyan
fda7b1b140 isimage fetch timeout 2023-08-27 13:28:33 -05:00
keyan
61c7bb28c2 allow name checking if you aren't logged in 2023-08-25 14:22:02 -05:00
keyan
a847b16b2c make item creation easier 2023-08-25 13:42:55 -05:00
SatsAllDay
3da395a792
multiple forwards on a post (#403)
* multiple forwards on a post

first phase of the multi-forward support

* update the graphql mutation for discussion posts to accept and validate multiple forwards

* update the discussion form to allow multiple forwards in the UI

* start working on db schema changes

* uncomment db schema, add migration to create the new model, and update create_item, update_item
stored procedures

* Propagate updates from discussion to poll, link, and bounty forms

Update the create, update poll sql functions for multi forward support

* Update gql, typedefs, and resolver to return forwarded users in items responses

* UI changes to show multiple forward recipients, and conditional upvote logic changes

* Update notification text to reflect multiple forwards upon vote action

* Disallow duplicate stacker entries

* reduce duplication in populating adv-post-form initial values

* Update item_act sql function to implement multi-way forwarding

* Update referral functions to scale referral bonuses for forwarded users

* Update notification text to reflect non-100% forwarded sats cases

* Update wallet history sql queries to accommodate multi-forward use cases

* Block zaps for posts you are forwarded zaps at the API layer, in addition
to in the UI

* Delete fwdUserId column from Item table as part of migration

* Fix how we calculate stacked sats after partial forwards in wallet history

* Exclude entries from wallet history that are 0 stacked sats from posts with 100% forwarded to other users

* Fix wallet history query for forwarded stacked sats to be scaled by the fwd pct

* Reduce duplication in adv post form, and do some style tweaks for better layout

* Use MAX_FORWARDS constants

* Address various PR feedback

* first enhancement pass

* enhancement pass too

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-08-23 17:44:17 -05:00
SatsAllDay
ee3f892053
Add new user setting to hide bookmarks from other users (and anon) (#424)
* Add new setting to hide bookmarks from other users (and anon)

* Optional chaining in case user doesnt exist, and avoid duplicate sql query in some cases
2023-08-23 15:29:55 -05:00
keyan
df6575d701 remove slashtags completely 2023-08-17 13:40:21 -05:00
keyan
ddb69b5d9b remove slashtags temporarily 2023-08-16 19:49:00 -05:00
keyan
c9a409845c configurable ranking 2023-08-16 17:53:22 -05:00
keyan
7e4a874068 update packages 2023-08-15 19:52:55 -05:00
ekzyis
7c426aa420
Enhance logging related to web push (#412)
Co-authored-by: ekzyis <ek@stacker.news>
2023-08-15 12:59:58 -05:00
ekzyis
670c567bff
Configure imgproxy timeouts + add click to load on imgproxy errors (#404)
* Configure imgproxy timeouts

* Use click to load on imgproxy errors

* Add setting for click to load

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-08-15 12:55:16 -05:00
keyan
e4831e65d5 show sources and history of rewards 2023-08-15 12:41:51 -05:00
keyan
679f766f07 add average comments per post to items analytics 2023-08-14 15:36:54 -05:00
keyan
15c11efc0a add anon's earnings to reward pool 2023-08-14 14:37:09 -05:00
ekzyis
b9461b7eb3
Allow zapping, posting and commenting without funds or an account (#336)
* Add anon zaps

* Add anon comments and posts (link, discussion, poll)

* Use payment hash instead of invoice id as proof of payment

Our invoice IDs can be enumerated.
So there is a - even though very rare - chance that an attacker could find a paid invoice which is not used yet and use it for himself.
Random payment hashes prevent this.

Also, since we delete invoices after use, using database IDs as proof of payments are not suitable.
If a user tells us an invoice ID after we deleted it, we can no longer tell if the invoice was paid or not since the LN node only knows about payment hashes but nothing about the database IDs.

* Allow pay per invoice for stackers

The modal which pops up if the stacker does not have enough sats now has two options: "fund wallet" and "pay invoice"

* Fix onSuccess called twice

For some reason, when calling `showModal`, `useMemo` in modal.js and the code for the modal component (here: <Invoice>) is called twice.

This leads to the `onSuccess` callback being called twice and one failing since the first one deletes the invoice.

* Keep invoice modal open if focus is lost

* Skip anon user during trust calculation

* Add error handling

* Skip 'invoice not found' errors

* Remove duplicate insufficient funds handling

* Fix insufficient funds error detection

* Fix invoice amount for comments

* Allow pay per invoice for bounty and job posts

* Also strike on payment after short press

* Fix unexpected token 'export'

* Fix eslint

* Remove unused id param

* Fix comment copy-paste error

* Rename to useInvoiceable

* Fix unexpected token 'export'

* Fix onConfirmation called at every render

* Add invoice HMAC

This prevents entities which know the invoice hash (like all LN nodes on the payment path) from using the invoice hash on SN.

Only the user which created the invoice knows the HMAC and thus can use the invoice hash.

* make anon posting less hidden, add anon info button explainer

* Fix anon users can't zap other anon users

* Always show repeat and contacts on action error

* Keep track of modal stack

* give anon an icon

* add generic date pivot helper

* make anon user's invoices expire in 5 minutes

* fix forgotten find and replace

* use datePivot more places

* add sat amounts to invoices

* reduce anon invoice expiration to 3 minutes

* don't abbreviate

* Fix [object Object] as error message

Any errors thrown here are already objects of shape { message: string }

* Fix empty invoice creation attempts

I stumbled across this while checking if anons can edit their items.

I monkey patched the code to make it possible (so they can see the 'edit' button) and tried to edit an item but I got this error:

  Variable "$amount" of required type "Int!" was not provided.

I fixed this even though this function should never be called without an amount anyway. It will return a sane error in that case now.

* anon func mods, e.g. inv limits

* anon tips should be denormalized

* remove redundant meTotalSats

* correct overlay zap text for anon

* exclude anon from trust graph before algo runs

* remove balance limit on anon

* give anon a bio and remove cowboy hat/top stackers;

* make anon hat appear on profile

* concat hash and hmac and call it a token

* Fix localStorage cleared because error were swallowed

* fix qr layout shift

* restyle fund error modal

* Catch invoice errors in fund error modal

* invoice check backoff

* anon info typo

* make invoice expiration times have saner defaults

* add comma to anon info

* use builtin copy input label

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-11 18:50:57 -05:00
keyan
e913ab71ad more even rewards 2023-08-09 22:27:03 -05:00
SatsAllDay
6e05cd38f9
Singular/Plural "Sats" labels (#380)
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-08 16:04:06 -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
4094adfa4f
Remove markdown from body in push notifications (#374)
Co-authored-by: ekzyis <ek@stacker.news>
2023-08-07 20:03:50 -05:00
ekzyis
49867f5dd5
Make web push & imgproxy setup optional for local dev (#373)
* Make web push setup optional for local dev

* Make imgproxy setup optional for local dev

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-08-07 19:53:21 -05:00
ekzyis
7369bd819d
Add nostr login (#367)
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-07 19:50:01 -05:00
keyan
ffb856ae88 fix oauth signup 2023-08-07 15:05:55 -05:00
keyan
e4aaaac20f don't use cache for SSR 2023-08-05 14:46:29 -05:00
keyan
f7bf77ebd4 fix BigInt Int mix in satistics 2023-07-31 12:47:41 -05:00
keyan
c909efb7b7 update wallet code to prisma 5, handle prisma 5 errors on serialization 2023-07-31 08:31:40 -05:00
keyan
9745b82d63 fix viewing stacker's bookmarks 2023-07-29 18:27:32 -05:00
keyan
5232b59625 upgrade to next-auth 4 (bonus: improve error pages) 2023-07-29 14:38:20 -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
8ab018af88 fix nested comment sorting 2023-07-25 19:45:35 -05:00
keyan
ab2046ab0b fix issues with new linting 2023-07-25 09:14:45 -05:00
keyan
e87610c45b update packages and reduce bundle size 2023-07-24 17:50:12 -05:00
keyan
54d69489b9 Revert "Revert "try to store slashtags in cwd""
This reverts commit bbedec853f9b2053635e6b3f6fe458bba4b8d55c.
2023-07-23 10:09:00 -05:00
keyan
437faca197 Revert "Revert "prevent slashtags from accessing disk""
This reverts commit 391773be5ee742a9783d36ba7c2eecb5d29dea29.
2023-07-23 10:08:56 -05:00
keyan
59f7b6ff26 Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades""
This reverts commit 18910fa2ed470fe12ffbfb83df18e206101f0a05.
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 d0314ab73c42ebf85fe2f418dddd681af45dbc55.
2023-07-23 09:16:12 -05:00
keyan
391773be5e Revert "prevent slashtags from accessing disk"
This reverts commit 3c6c2a72b2036635eb7fef34e787edfa7279bd12.
2023-07-23 09:16:02 -05:00
keyan
bbedec853f Revert "try to store slashtags in cwd"
This reverts commit 589d1ec190ddf26b139fa5e516450866e347ea31.
2023-07-23 09:15:40 -05:00
keyan
589d1ec190 try to store slashtags in cwd 2023-07-21 20:14:37 -05:00
keyan
3c6c2a72b2 prevent slashtags from accessing disk 2023-07-21 20:05:04 -05:00
keyan
d0314ab73c shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades 2023-07-21 17:33:11 -05:00
ekzyis
8536660580
Fix maxStreak for users with running best streak (#356)
Co-authored-by: ekzyis <ek@stacker.news>
2023-07-14 10:49:16 -05:00
keyan
3c711b6083 enhance image detection and proxy 2023-07-13 15:18:04 -05:00
ekzyis
0d3328e509
Show longest cowboy streak in profile (#353)
* Show longest cowboy streak in profile

* Fix image offset

* Initialize maxStreak for every user

* Use resolver instead of denormalization for maxStreak

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-12 19:10:29 -05:00
Jo Wo
bf4b8714fe
Render images without markdown and use image proxy (#245)
* Parse image links during markdown rendering

* Use imgproxy to replace links

* Add healthcheck

See https://docs.imgproxy.net/healthcheck

* Enable WebP and animation support

* Only replace image URLs

* Replace all occurrences

* Fix creating posts with no text

* Embed image on link posts where link is image

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-12 19:10:01 -05:00
keyan
4e9138dfdc show more info on where zap rewards came from 2023-07-09 12:21:11 -05:00
ekzyis
5e4dedad28
Add nym in reply notification (#349)
Co-authored-by: ekzyis <ek@stacker.news>
2023-07-07 08:45:44 -05:00
ekzyis
46014d0de4
Fix query for items with less than 11 parents (#346)
Co-authored-by: ekzyis <ek@stacker.news>
2023-07-06 20:17:12 -05:00