GithubHelp home page GithubHelp logo

stackernews / stacker.news Goto Github PK

View Code? Open in Web Editor NEW
422.0 11.0 106.0 31.86 MB

Internet communities that pay you Bitcoin

Home Page: https://stacker.news

License: MIT License

Shell 0.96% JavaScript 72.64% CSS 1.80% PLpgSQL 23.13% SCSS 1.30% Dockerfile 0.16% Procfile 0.01%
bitcoin lightning next graphql postgresql plpgsql lightning-network lnd micropayments

stacker.news's Introduction

Internet Communities with Bitcoin Economies

  • Stacker News makes internet communities that pay you Bitcoin
  • What You See is What We Ship (look ma, I invented an initialism)
  • 100% FOSS
  • We pay bitcoin for PRs, issues, documentation, code reviews and more
  • Next.js, postgres, graphql, and lnd

Getting started

Launch a fully featured SN development environment in a single command.

$ ./sndev start

Go to localhost:3000.


Installation

  • Clone the repo
    • ssh: git clone [email protected]:stackernews/stacker.news.git
    • https: git clone https://github.com/stackernews/stacker.news.git
  • Install docker
  • Please make sure that at least 10 GB of free space is available, otherwise you may encounter issues while setting up the development environment.

Usage

Start the development environment

$ ./sndev start

View all available commands

$ ./sndev help

                            888
                            888
                            888
      .d8888b  88888b.  .d88888  .d88b.  888  888
     88K      888 '88b d88' 888 d8P  Y8b 888  888
     'Y8888b. 888  888 888  888 88888888 Y88  88P
          X88 888  888 Y88b 888 Y8b.      Y8bd8P
      88888P' 888  888  'Y88888  'Y8888    Y88P

manages a docker based stacker news development environment

USAGE
  $ sndev [COMMAND]
  $ sndev help [COMMAND]

COMMANDS
  help            show help

  env:
    start         start env
    stop          stop env
    restart       restart env
    status        status of env
    logs          logs from env
    delete        delete env

  sn:
    login         login as a nym
    fund_user     fund a nym without using an LN invoice

  lnd:
    fund          pay a bolt11 for funding
    withdraw      create a bolt11 for withdrawal

  cln:
    cln_fund      pay a bolt11 for funding with CLN
    cln_withdraw  create a bolt11 for withdrawal with CLN

  db:
    psql          open psql on db
    prisma        run prisma commands

  dev:
    pr            fetch and checkout a pr
    lint          run linters
    open          open container url in browser

  other:
    compose         docker compose passthrough
    sn_lndcli       lncli passthrough on sn_lnd
    stacker_lndcli  lncli passthrough on stacker_lnd
    stacker_clncli  lightning-cli passthrough on stacker_cln
    stacker_litcli  litcli passthrough on litd

Modifying services

Running specific services

By default all services will be run. If you want to exclude specific services from running, set COMPOSE_PROFILES in a .env.local file to one or more of minimal,images,search,payments,wallets,email,capture. To only run mininal necessary without things like payments in .env.local:

COMPOSE_PROFILES=minimal

To run with images and payments services:

COMPOSE_PROFILES=images,payments

Merging compose files

By default sndev start will merge docker-compose.yml with docker-compose.override.yml. Specify any overrides you want to merge with docker-compose.override.yml.

For example, if you want to replace the db seed with a custom seed file located in docker/db/another.sql, you'd create a docker-compose.override.yml file with the following:

services:
  db:
    volumes:
      - ./docker/db/another.sql:/docker-entrypoint-initdb.d/seed.sql

You can read more about docker compose override files.


Table of Contents


Contributing

We want your help.


We pay bitcoin for contributions

  • pull requests closing existing issues
  • code review
  • issue specification whether for bugs, features, or enhancements
  • discovery of security vulnerabilities
  • discovery of privacy vulnerabilities
  • improvements to development documentation
  • helpfulness

View a current list of granted awards


Just in case

This document in no way legally entitles you to payments for contributions, entitles you to being a contributor, or entitles you to the attention of other contributors. This document lays out the system we can use to determine contribution awards which we generally intend to abide by but importantly we reserve the right to refuse payments or contributions, modify rules and award amounts, make exceptions to rules or reward amounts, and withhold awards for any reason at anytime, even just for the heck of it, at our sole discretion. If you need more certainty than what I've just described, don't participate. We provide awards as an experiment to make FOSS less sucky.


Pull request awards

Rules

  1. PRs closing an issue will be awarded according to the difficulty tag on an issue, e.g. difficulty:easy pays 100k sats.
  2. Issues are occasionally marked with a priority tag which multiplies the award of a PR closing an issue, e.g. an issue marked with priority:high and difficulty:hard awards 2m sats.
  3. An award is reduced by 10% of the award amount for each substantial change requested to the PR on code review, e.g. if two changes are requested on a PR closing an issue tagged with difficulty:hard, 800k sats will be awarded.
    • Reductions are applied before priority multipliers, e.g. a PR closing a priority:high and difficulty:hard issue that's approved after two changes are requested awards 1.6m sats.
    • You are responsible for understanding the issue and requirements before requesting review on a PR.
    • There is no award reduction for asking specific questions on the issue itself or on the PR before requesting review
    • There is no award reduction for asking more general questions in a discussion
  4. A PR must be merged by an SN engineer before a PR receives an award

Due to Rule 3, make sure that you mark your PR as a draft when you create it and it's not ready for review yet.

Difficulty award amounts

tag description award
difficulty:good-first-issue at most a couple lines of code in a couple files and does not require much familiarity with the codebase 20k sats
difficulty:easy at most a couple lines of code in a couple files but does require familiarity with the code base 100k sats
difficulty:medium more code, more places and could require adding columns in the db and some modification chunky db queries 250k sats
difficulty:medium-hard even more code, even more places and requires either more sophisticated logic, more significant db modeling eg adding a table, and/or a deeper study of a something 500k sats
difficulty:hard either a bigger lift than the what's required of medium-hard or very tricky in a particular way that might not require a lot of code but does require a lot of context/troubleshooting/expertise 1m sats

Priority multipliers

tag multiplier
priority:low 0.5
priority:medium 1.5
priority:high 2
priority:urgent 3

Requesting modifications to reward amounts

We try to assign difficulty and priority tags to issues accurately, but we're not perfect. If you believe an issue is mis-tagged, you can request a change to the issue's tags.


Code review awards

Code reviewers will be awarded the amount their code review reduced from the PR author's reward, e.g. two substantial problems/areas of improvement identified in a PR closing a priority:high and difficulty:hard issue awards 400k sats.

Rules

  1. The problem or improvement must be acknowledged as such by SN engineers explicitly
  2. A PR must be merged by an SN engineer before a PR's code reviewers receive an award

Code review approvals are more than welcome, but we can't guarantee awards for them because the work performed to approve a PR is unverifiable.


Issue specification awards

Issue specifiers will be awarded up to 10% of a PR award for issues resulting in a PR being merged by an SN engineer that closes the issue. In addition to being subject to PR award amounts and reductions, specification amounts are awarded on the basis of how much additional help and specification is required by other contributors.

Rules

  1. The issue must directly result in PR being merged by an SN engineer that closes the issue
  2. Issue specification award amounts are based on the final PR award amounts
    • that is, they are subject to PR award code review reductions and priority multipliers
  3. Award amounts will be reduced on the basis of how much additional help and specification is required by other contributors
  4. Issue specifiers who can close their own issues with their own PRs are also eligible for this 10%
    • e.g an issue tagged as difficulty:hard that is both specified and closed by a PR from the same contributor without changes requested awards 1.1m sats

Relative awards

circumstances award
issue doesn't require further help and/or specification from other contributors 10%
issue requires little help and/or specification from other contributors 5%
issue requires more help and/or specification from other contributors than the issue specifier contributed 1%
issue is vague and/or incomplete and must mostly be entirely specified by someone else 0%

For example: a specified issue that's tagged as difficulty:hard, doesn't require additional specification and disambiguation by other contributors, and results in PR being merged without changes requested awards the issue specifier 100k sats.


Responsible disclosure of security or privacy vulnerability awards

Awards for responsible disclosures are assessed on the basis of:

  1. the potential loss resulting from an exploit of the vulnerability
  2. the trivialness of exploiting the vulnerability
  3. the disclosure's detail

Award amounts will be easiest to assess on a case by case basis. Upon confirmation of a vulnerability, we agree to award responsible disclosures at minimum 100k sats and as high as the total potential loss that would result from exploiting the vulnerability.

Rules

  1. Disclosure is responsible and does not increase the likelihood of an exploit.
  2. Disclosure includes steps to reproduce.
  3. Disclosure includes a realistic attack scenario with prerequisites for an attack and expected gains after the exploitation. Disclosures without such scenario, with unrealistic assumptions or without meaningful outcomes will not be eligible for awards.
  4. You must be the first person to responsibly disclose the issue to be eligible for awards.

Development documentation awards

For significant changes to documentation, create an issue before making said changes. In such cases we will award documentation improvements in accordance with issue specification and PR awards.

For changes on the order of something like a typo, we'll award a nominal amount at our discretion.


Helpfulness awards

Like issue specification awards, helping fellow contributors substantially in a well documented manner such that the helped fellow contributes a merged PR is eligible for a one-time relative reward.

circumstances award
substantial and singular source of help 10%
substantial but nonsingular source of help 1-5%
source of relatively trivial help 1%

Contribution extras

We want to make contributing to SN as rewarding as possible, so we offer a few extras to contributors.

Dev chat

We self-host a private chat server for contributors to SN. If you'd like to join, please respond in this discussion.

Triage permissions

We offer triage permissions to contributors after they've made a few contributions. I'll usually add them as I notice people contributing, but if I missed you and you'd like to be added, let me know!

Contributor badges on SN profiles

Contributors can get badges on their SN profiles by opening a pull request adding their SN nym to the contributors.txt file.

What else you got

In the future we plan to offer more, like gratis github copilot subscriptions, reverse tunnels, codespaces, and merch.

If you'd like to see something added, please make a suggestion.


Development Tips


Linting

We use JavaScript Standard Style to enforce code style and correctness. You should run sndev lint before submitting a PR.

If you're using VSCode, you can install the StandardJS VSCode Extension extension to get linting in your editor. We also recommend installing StandardJS code snippets and StandardJS react code snippets for code snippets.


Database migrations

We use prisma for our database migrations. To create a new migration, modify prisma/schema.prisma according to prisma schema reference and apply it with:

./sndev prisma migrate dev

If you want to create a migration without applying it, eg to create a trigger or modify the generated sql before applying, use the --create-only option:

./sndev prisma migrate dev --create-only

Generate the local copy of the prisma ORM client in node_modules after changes. This should only be needed to get Intellisense in your editor locally.

./sndev prisma generate


Connecting to the local database

You can connect to the local database via ./sndev psql. psql is an interactive terminal for working with PostgreSQL.


Running lncli on the local lnd nodes

You can run lncli on the local lnd nodes via ./sndev sn_lncli and ./sndev stacker_lncli. The node for your local SN instance is sn_lnd and the node serving as any external node, like a stacker's node or external wallet, is stacker_lnd.


Testing local auth

You can login to test features like posting, replying, tipping, etc with ./sndev login <nym> which will provide a link to login as an existing nym or a new account for a nonexistent nym. But, it you want to test auth specifically you'll need to configure them in your .env file.

Login with Email

MailHog

  • The app is already prepared to send emails through MailHog so no extra configuration is needed
  • Click "sign up" and enter any email address (remember, it's not going anywhere beyond your workstation)
  • Access MailHog's web UI on http://localhost:8025
  • Click the link (looks like this):
http://localhost:3000/api/auth/callback/email?email=satoshi%40gmail.com&token=110e30a954ce7ca643379d90eb511640733de405f34a31b38eeda8e254d48cd7

Sendgrid

  • Create a Sendgrid account (or other smtp service)
LOGIN_EMAIL_SERVER=smtp://apikey:<sendgrid_api_key>@smtp.sendgrid.net:587
LOGIN_EMAIL_FROM=<sendgrid_email_from>
  • Click "sign up" and enter your email address
  • Check your email
  • Click the link (looks like this):
http://localhost:3000/api/auth/callback/email?email=satoshi%40gmail.com&token=110e30a954ce7ca643379d90eb511640733de405f34a31b38eeda8e254d48cd7

Login with Github

  • Create a new OAuth app in your Github account
    • Set the callback URL to: http://localhost:3000/api/auth/callback/github
  • Update your .env file
GITHUB_ID=<Client ID>
GITHUB_SECRET=<Client secret>
  • Signup and login as above

Login with Lightning

  • Use ngrok to create a HTTPS tunnel to localhost:3000
  • Update LNAUTH_URL in .env with the URL provided by ngrok and add /api/lnauth to it

Enabling web push notifications

To enable Web Push locally, you will need to set the VAPID_* env vars. VAPID_MAILTO needs to be an email address using the mailto: scheme. For NEXT_PUBLIC_VAPID_KEY and VAPID_PRIVKEY, you can run npx web-push generate-vapid-keys.


Internals


Stack

The site is written in javascript (not typescript 😱) using Next.js, a React framework. The backend API is provided via GraphQL. The database is PostgreSQL modeled with Prisma. The job queue is also maintained in PostgreSQL. We use lnd for our lightning node. A customized Bootstrap theme is used for styling.


Services

Currently, SN runs and maintains two significant services and one microservice:

  1. the nextjs web app, found in ./
  2. the worker service, found in ./worker, which runs periodic jobs and jobs sent to it by the web app
  3. a screenshot microservice, found in ./capture, which takes screenshots of SN for social previews

In addition, we run other critical services the above services interact with like lnd, postgres, opensearch, tor, and s3.


Wallet transaction safety

To ensure stackers balances are kept sane, some wallet updates are run in serializable transactions at the database level. Because early versions of prisma had relatively poor support for transactions most wallet touching code is written in plpgsql stored procedures and can be found in the prisma/migrations folder.

UPDATE: Most wallet updates are now run in read committed transactions. See api/paidAction/README.md for more information.


Need help?

Open a discussion or issue or email us or request joining the dev chat.


Responsible disclosure

If you found a vulnerability, we would greatly appreciate it if you contact us via [email protected] or open a security advisory. Our PGP key can be found here (EBAF 75DA 7279 CB48).


License

MIT

stacker.news's People

Contributors

abhishandy avatar aniskhalfallah avatar austinkelsay avatar benalleng avatar benthecarman avatar bubersson avatar bumi avatar ekzyis avatar felipebueno avatar h0dlr avatar huumn avatar itsrealfake avatar jp30566347 avatar kevkevinpal avatar kravhen avatar leon-sander avatar mvpratt avatar mzivil avatar notnout avatar riccardobl avatar rleed avatar satsallday avatar secondl1ght avatar southkorealn avatar st4rgut24 avatar suhailsaqan avatar tsmith123 avatar utanapishtim avatar vaibhavwakde52 avatar wbobeirne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stacker.news's Issues

async-retry bug?

Got a. report on twitter that async-retry might not work with a try block inside or something like that. Need to investigate. We use this for when there are serialization conflicts when updating user wallet balances.

Use deterministic build id

Because we deploy across more than one server and build independently on each server, each server gets a different build id. This build id is used to address artifacts on the server and if the load balancer does not stick a client to a particular server, then they might end up referencing build artifacts that exist on one server but not the others.

Solution is probably to use the git commit id.

Require less GitHub permissions to log in

First of all thanks for the project, it's pretty cool!

When trying to log in with GitHub I've noticed that it requires read & write permission for:

  • Private email address
  • Profile info
  • Followers

I think we could probably relax this a bit to just require reading public data, since it appears that the login is what we are interested in. I might be wrong since I'm not too familiar with next-auth so feel free to close this issue if so.

Screenshot 2021-10-04 at 12 01 05

Provide free/libre terms for comments and other content

Provide verbiage so that user comments and other user submitted content is clearly under a free/libre license (CC0, CC-BY, CC-BY-SA).

In my opinion, one of the reasons for StackOverflow's success is that the questions and answers are provided to the community under a free/libre license (CC-BY-SA 4.0). StackOverflow (SO) terms of service specifically addresses the point (under "Subscriber Content") and users who post on the site agree to provide their content under said license so that others can share and distribute it:

You agree that any and all content, including without limitation any and all text, graphics, logos, tools, photographs, images, illustrations, software or source code, audio and video, animations, and product feedback (collectively, “Content”) that you provide to the public Network (collectively, “Subscriber Content”), is perpetually and irrevocably licensed to Stack Overflow on a worldwide, royalty-free, non-exclusive basis pursuant to Creative Commons licensing terms (CC BY-SA 4.0), and you grant Stack Overflow the perpetual and irrevocable right and license to access, use, process, copy, distribute, export, display and to commercially exploit such Subscriber Content, even if such Subscriber Content has been contributed and subsequently removed by you as reasonably necessary ...

Though there are many sites that effectively duplicate SO, SO remains popular and there's probably an argument that even though there are many copycats, SO is probably enhanced by the duplication rather than inhibited by it.

Contrast this with Hacker News (HN) and their restrictive prohibition on using other people's comments on their site:

Commercial Use: Unless otherwise expressly authorized herein or in the Site, you agree not to display, distribute, license, perform, publish, reproduce, duplicate, copy, create derivative works from, modify, sell, resell, exploit, transfer or upload for any commercial purposes, any portion of the Site, use of the Site, or access to the Site. The buying, exchanging, selling and/or promotion (commercial or otherwise) of upvotes, comments, submissions, accounts (or any aspect of your account or any other account), karma, and/or content is strictly prohibited, constitutes a material breach of these Terms of Use, and could result in legal liability.

There's a saying by Quinn Norton that says

All data, over time, approaches deleted, or public.

I'm a fan of the HN community but the restriction on their user provided content is a mistake, in my opinion, and I worry it's inevitable that the HN data is lost or unusable in some pretty meaningful ways. If HN ever did decide to give the data to the community, my bet is that it would be at a point when they're shuttering and "throwing it over the fence" at which time it's utility would be a shadow of what it is now.

It would be nice if SN could avoid HN's mistake and make sure to provide user submitted content in what I believe is the spirit in which it was created, as a resource to the public and available to everyone, even for commercial re-use.

Provide API

Hacker News has an API to their data, providing an interface to query data from their site in JSON (see here). Hacker News provides it through firebaseio, so maybe it's worth pushing this to another service but the basic form would be something in the form of https://stacker.news/items/1130.json?print=pretty with the resulting item JSON closely mirroring the database schema.

Other tables in the database schema could be accessed similarly.

I do see an api directory so maybe this is already implemented? If so, it would be good to document. If not, then having an API so that other hackers can look at the data would be cool.

[Feature request] @ mentions in comments

A few users have been trying to use @ mentions to get a users attention in comments. These should at least link to a users profile but it'd be better if they also showed up in @their notifications.

Tips

It'd be nice to give larger rewards to users than a single upvote.

[Feature request] - More detailed documentation/info

  1. FAQ page. You need to give more information about how to use this and fees applied, votes etc
  2. Using the free credits to post - OK. But after posting those, it doesn't say how much I need to pay for a new post.
  3. It should be also available the option to just pay a LN invoice for a new paid post, if I do not have enough funds in wallet

Improve Performance

It's easy to discount how much performance affects the UX. SSR is a step in the right direction but because it makes db queries synchronous, it's kind of a step back unless we make those queries very fast. I've done some work making sure we have indices where needed but we need more.

There are lots of things we can do to improve performance. Prioritization is the hard part. As for queries most things can be improved with materialized views but at our stage this might be overkill. What we need now are results and fast.

  • Lighthouse recommends using http2 (should be easy to do in the reverse proxy)
  • We need to make the main page very fast ... The thing that slows this down is needing to compute a rank score for every item for ordering them
    • In practice we don't need to do this for every item ... only the ones we expect might be on the front page, i.e. the posts from the last week. While it's a bit of a hack we can filter our query by creation time, then compute the rank score for the remaining
    • Alternatively, we can create a materialized view of items and update it concurrently but this creates problems for pagination and we need a good strategy for refreshing the materialized view (probably just when upvotes happen). I see this as a longer term solution.
    • There might some way of combining these two approaches ...
  • The notifications query is big and slow and will only get worse, but denormalizing it is probably a mistake
    • the move here is to probably go back to client side rendering notifications until we come up with something better
    • we can create a materialized view of this in the long run
  • Items query is fast but computing comments is slow
    • we can lazy load/client side render comments
    • we could also materialize items with a JSON comments column with them already prefetched and nested ... but comments are ranked so they'll need to be refreshed when new comments are added or upvoted
  • Serve scripts and static assets out of a CDN (probably marginal improvement given clients cache but would make the site faster for first time/irregular visitors)

Onion address

Some folks may feel better if stacker.news are available via onion (Tor) network. It can also help in your search for decentralization as Tor now has Onionbalance to distribute the service on multiple hosts while serving it over one onion link.

Additional post types

Currently we only have links and discussions but we can support more types to give users more options.

  • images
  • videos
  • q&a bounties (tbd the rules)
  • polls (one sat per vote)

Show the highest rank an item achieved

Something users tend to do is post screenshots when their item is on the frontpage (also seen this for HN and reddit). It'd be nice for the post to simply indicate the highest rank the posts have received instead - this is complicated by boost in our case but still an interesting habit we can maybe make easier.

URL dupe protection

Occasionally people post duplicate URLs. This isn't a huge issue ATM but it'd be nice to be able to detect it and display a warning - and possibly disallow it if it happens within a certain timeframe of the past post.

Probably doesn't need to be complicated. Remove trailing slash, case insensitive, https/http insensitive, and remove query params (although some sites use query params to specify which post, e.g. HN does this sadly, but we can probably just have some kind of whitelist) then compare.

[Feature request] Allow website to be accessed via RSS

This website has been a great resource for Bitcoin news and being able to anonymously log in via the Lightning network is ingenious.

However, the fact that the website is just that makes it easy to forget to check regularly for news. Being able to access the website via RSS will allow a user to subscribe to the website (possibly even using specific parameters) so they will always know when a new post they care about is made.

Dark mode

Users want this. I do too but I keep forgetting.

Refresh button or cache invalidation

Responses are cached on the client but invalidate as the browser sees fit. This is nice for the user experience in certain contexts but the main/recent pages tend to go stale too slowly so the user is forced to manually refresh.

I'm not sure the best way to do this from a UX perspective.

The operation cannot be completed. (OAuthSwiftError error -2.)

I noticed a while ago I started getting the above error on macOS when manually refreshing my feed.

Through discussion in the #general Slack channel, it was determined that this error is caused due to a tokenExpired status for an enabled Twitter extension (not sure if it would also apply to the Reddit extension as well since I did not have that extension enabled).

A simple fix that was suggested to me was to deactivate the extension and then reactivate. I can confirm this worked. I also revoked NetNewsWire from accessing my Twitter account and re-enabled it, but they may not have been necessary. Based on the language on the Twitter page, NetNewsWire's access had not be previously revoked.

Was told to open an issue so it could be kept track of.

ETIMEDOUT messages in logs

Getting quite a few of these message in the logs. These could be happening for a number of reasons. They appear to be intermittent and might not be avoidable but there might be a better way to handle it.

Sep 12 16:42:37 ip-172-31-87-148 web: [next-auth][error][client_fetch_error]
Sep 12 16:42:37 ip-172-31-87-148 web: https://next-auth.js.org/errors#client_fetch_error session FetchError: request to https://stacker.news/api/auth/session failed, reason: connect ETIMEDOUT 35.168.134.186:443
Sep 12 16:42:37 ip-172-31-87-148 web: at ClientRequest.<anonymous> (/var/app/current/node_modules/node-fetch/lib/index.js:1461:11)
Sep 12 16:42:37 ip-172-31-87-148 web: at ClientRequest.emit (events.js:376:20)
Sep 12 16:42:37 ip-172-31-87-148 web: at TLSSocket.socketErrorListener (_http_client.js:475:9)
Sep 12 16:42:37 ip-172-31-87-148 web: at TLSSocket.emit (events.js:376:20)
Sep 12 16:42:37 ip-172-31-87-148 web: at emitErrorNT (internal/streams/destroy.js:106:8)
Sep 12 16:42:37 ip-172-31-87-148 web: at emitErrorCloseNT (internal/streams/destroy.js:74:3)
Sep 12 16:42:37 ip-172-31-87-148 web: at processTicksAndRejections (internal/process/task_queues.js:82:21) {
Sep 12 16:42:37 ip-172-31-87-148 web: type: 'system',
Sep 12 16:42:37 ip-172-31-87-148 web: errno: 'ETIMEDOUT',
Sep 12 16:42:37 ip-172-31-87-148 web: code: 'ETIMEDOUT'
Sep 12 16:42:37 ip-172-31-87-148 web: }

Upvote/tip/boost abort/delay window

It would be nice to be able to "undo" an upvote, tip or boost. From what I understand, the upvote/tip/boost (UpTiBo) represents an actual transaction on the Lightning network which, in my opinion is "the right way", so once the transaction is sent, there's no going back. To try and mitigate a mistaken UpTiBo, the transaction could be delayed for 5s, say, allowing a user to do a 'quick undo' with the understanding that waiting any longer than that will finalize the transaction.

I believe Gmail does something similar, allowing you to 'undo send' of an email by holding it for some number of seconds/minutes before finally pushing it through.

I think most of the time, people will realize their mistake within some short time, like 5s, taking care of 90%+ of the cases where users would want to rescind their UpTiBo.

I would consider this a very low priority, "nice to have" feature and nothing that is significantly interfering with the user (or my) experience.

Provide instructions on test environment or VM (Docker, etc.) for testing environment

Though it might be obvious to engineers that are better than myself, how to get a test environment working is not clear to me. It would be nice to have some minimal instructions on how to get a development setup working so that getting familiar with the environment is as easy as possible.

Better yet, it might be nice to provide a Docker container so that people can experiment with something that's pre-built.

I got as far as running the web service but, in the couple minutes I looked at it, I couldn't figure out how to hook up or create the database, so gave up. A little more documentation on how to get a dev environment working or providing a Docker container would help speed up this on-boarding.

RSS Feed Errors

When navigating to the rss feed, I get the following error:

XML Parsing Error: not well-formed
Location: https://stacker.news/rss
Line Number 86, Column 99:
      <link>https://twitter.com/irisenergyco/status/1428677975537377285?t=esQNOfvjbmpMrItP9oHjSA&s=19</link>
--------------------------------------------------------------------------------------------------^

[RSS] `link` should link to linked article, not `guid`

When pulling from the RSS feed, the format for an item is as follows:

...
    <item>
      <guid>https://stacker.news/items/1098</guid>
      <title>Lightning Voucher ATM Coming Soon ⚡️🏧</title>
      <link>https://stacker.news/items/1098</link>
      <pubDate>Sun, 15 Aug 2021 20:32:02 GMT</pubDate>
    </item>
...

For folks subscribing to the RSS feed:

  • The link doesn't go to the article but rather the entry on stacker.news which seems surprising to me
  • There is no way to get the address of the linked article but to do another query to stacker.news

It would be much nicer, in my opinion, if the link field had the address of the linked article (in the above example https://twitter.com/ltngstore/status/1426950427346542594?s=20).
At the very least, adding another field that has the proper link would be nice.

Obviously this can't happen for all items, as some the main link is the guid, but where appropriate it would be good to provide the link.

[Internals] Polymorphish data model for sat transfers

The only sat transfer mechanism we really have currently is the vote and boost (which is in the same db table but differentiated with a boolean). Even the dust cost of posting and commenting is kind of recorded as a vote.

We want to support many types of sat transfers on the site eventually. To name a few immediate ideas:

  • tips
  • referrals
    • e.g. every user who signs up with your referral link gets 20 sats and you get 20 sats
  • faucets/rewards
    • e.g. 10 free sats when you sign up, 100 sats if you visit every day this week, 1000 free sats if you post a story that gets to the front page, etc.

Eventually:

  • gating replies to your posts/comments with custom sat amounts
    • e.g. every reply to this thread must 'stake' 10 sats rather than 1 sat
  • Q&A bounties
    • e.g. the best answer to my question by Saturday gets 1000 sats and if I don't pick a winner it's distributed to all answerers
  • sub-stacker (read subreddit) economies, i.e. create subs with different sat-based unit economics
    • e.g. every post in this sub-stacker costs 100 sats (X amount goes to the sub mod, Y amount is airdropped on the sub users, Z goes to the site), comments cost 25 sats, etc.
  • Let users set a sat cost for mentioning them , i.e. charge users for consuming your attention
  • DM's gated with a sat cost
    • e.g. pay per message or pay to unlock a conversation with me

The sky is the limit IMO and we are going to the moon my plebs! These are naive examples. The incentives will have to be carefully examined before deploying of course.


Anyway, we don't want a DB table for all of these so we should probably have something more generic. The trick is making something intended to be generic also performant/correct so we should deliberately design such a system.

Off the top of my head it's probably best to have an xfer model with a sender id then we have a polymorphic receiver (e.g. an item (post/comment), a user for direct tips, a message for message hurdles) ... I'm not sure how well all of these will fit into this model so I'll probably attempt an exhaustive experiment to make sure any particular design fits.

Search

Many users have asked. Fairly straight forward to throw everything into ElasticSearch given my experience with https://grepmed.com ... but ops can be complicated.

Open source analytics

Plausible has a feature that makes the dashboard publicly accessible which is nice. Users should know everything I know.

SSR

I initially avoided SSR because I wanted to use clientside caching and I didn't understand the cache too well. The trouble is that if I'm SSRing I have to send from the server a dehydrated cache to be rehydrated on the client. I'm a little more savvy with the cache now ... Probably worth doing considering the perceived speed up for users.

display balance on wallet page

i know that the second number besides my name (nathanael [2,1]) means that i have one satoshi, but i think on the wallet page it is useful to also display the balance above the two buttons (fund / withdraw)

btw. there is a little typo: withdraw and not withdrawl (for the withdraw button on the wallet page)

'1 sat' popover gets glitchy after comment submission

It just ends up in a random place.

I suspect the issue is that the 'reply' button is sometimes removed from the DOM while the popover is still active ... it doesn't always happen so there's probably a race condition. Probably just requires hiding the popover before submitting the comment form.

Invite/Referral Program

We want to provide users with more ways to fund their accounts/earn bitcoin. We also want to bootstrap the community because users will get more value from the site if more people are on it. A simple solution is a sat referral program. I'm thinking 20 sats but I don't know.

Add WebLN

Wallet providers use a protocol (https://webln.dev/) to make sending lightning payments less cumbersome is my understanding. It'd be nice to support this.

[Feature request] Add ability to edit comments

Title is self-explanatory. Sometimes we make mistakes in comments. Replying to your own comment with the fix is a workaround, but an inelegant one. Perhaps it could use the same system as Reddit does where an edit after a certain period of time indicates that the comment has been edited. Could also see a use for being able to view the original comment to see exactly what was edited if the commenter does not indicate that themselves (such as with a strikethrough through the edited word for a misspelling rather than simply removing the word).

Enable SN in Breez (with WebLN)

WebLN is a pre-requisite for the app to be included in Breez and other lightning apps.

The implementation can be fairly simple, https://webln.dev/#/ and when ready worth pinging some of the teams like Breez to include SN there.
This would be both useful and also good marketing ;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.