Skip to content

Commit

Permalink
impl: /xmr/address endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cilki committed Jun 29, 2024
1 parent 573205b commit 9aa7e64
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:

docker:
runs-on: ubuntu-latest
needs: github
steps:
- uses: actions/checkout@v4
with:
Expand Down
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Although a complex change might deserve a larger award than a minor typo fix,
amount starts out small and increases over time as they make more contributions.

This incentivizes contributors to stick around and break their changes up into
smaller chunks (which is a good thing for other reasons too).
smaller chunks (which is often good for other reasons too).

It's up to the discretion of the person that merges PRs to make sure contributors
aren't unfairly boosting their rewards. In the event that such an injustice
aren't unfairly boosting their rewards. In the unbelievable event that such an injustice
occurs, maintainers can cancel payouts or ban contributors.

### What if the `turbine` owner steals the project's funds?
Expand All @@ -38,17 +38,30 @@ Since `turbine` is self-hosted, the crypto wallet is fully under control of the
project owner. We have to trust them not to misuse funds deposited in `turbine`,
just like we have to trust them not to include a backdoor in the software (for example).

## Using `turbine` as a contributor
### Funding directly impacts development

When you fund a project's `turbine`, those funds directly support further development
of that project. It's entirely up to the maintainer what issues get worked on,
unlike the bug bounty model.

## Using `turbine` as a funder

First, you need to find a repository that's hosting a `turbine`. Here are some examples:

- `https://github.com/fossable/goldboot`
- https://github.com/fossable/goldboot

The `turbine` homepage has the crypto wallet address that allows you to add funds.

## Using `turbine` as a contributor

All contributor commits must be GPG signed (because otherwise someone could
impersonate your name in git history).

### Generate a GPG keypair

If you don't already have a GPG keypair, generate a new one:

```
```sh
gpg --full-generate-key
```

Expand All @@ -58,7 +71,7 @@ Make sure to use the same email address as your git config: `git config user.ema

Turn on commit signing globally (or on a per-repo basis):

```
```sh
git config --global commit.gpgsign true
git config --global user.signingkey <public key ID>
```
Expand All @@ -68,7 +81,7 @@ git config --global user.signingkey <public key ID>
To allow `turbine` to find your public key and verify commits, upload it to this
keyserver:

```
```sh
gpg --keyserver hkp://keys.gnupg.net --send-keys <public key ID>
```

Expand All @@ -78,7 +91,7 @@ Add your payment address to a signed commit message so `turbine` knows who to pa
If you ever update your GPG key or wallet address, this commit can be made multiple
times and the last one takes effect.

```
```sh
git commit --allow-empty -m "turbine: XMR <wallet address>"
```

Expand All @@ -92,7 +105,7 @@ Contribute as normal and `turbine` will pay you automatically.

### Monero

```
```sh
docker run \
-e MONERO_WALLET_ADDRESS=<address> \
-e MONERO_WALLET_SPENDKEY=<private key> \
Expand Down
8 changes: 4 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ pub async fn serve(args: &ServeArgs) -> Result<ExitCode> {
.route("/assets/*file", get(crate::api::assets));

#[cfg(feature = "monero")]
let app = app.route("/xmr/balance", get(crate::currency::monero::balance));

#[cfg(feature = "monero")]
let app = app.route("/xmr/payouts", get(crate::currency::monero::payouts));
let app = app
.route("/xmr/balance", get(crate::currency::monero::balance))
.route("/xmr/payouts", get(crate::currency::monero::payouts))
.route("/xmr/address", get(crate::currency::monero::address));

let address = args.bind.clone().unwrap_or("0.0.0.0:80".to_string());

Expand Down
11 changes: 11 additions & 0 deletions src/currency/monero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,14 @@ pub async fn payouts(State(state): State<AppState>) -> impl IntoResponse {
),
)
}

/// Return an SVG badge with the wallet address.
pub async fn address(State(state): State<AppState>) -> impl IntoResponse {
(
[(header::CONTENT_TYPE, "image/svg+xml")],
crate::badge::generate(
"XMR",
&format!("{}", state.monero.wallet_address.to_string()),
),
)
}

0 comments on commit 9aa7e64

Please sign in to comment.