Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into electrs-getalby-domain
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jul 5, 2024
2 parents 745979e + 2d33260 commit c436ae6
Show file tree
Hide file tree
Showing 86 changed files with 327 additions and 298 deletions.
10 changes: 5 additions & 5 deletions .do/deploy.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ spec:
image:
registry_type: GHCR
registry: getalby
repository: nostr-wallet-connect-next
repository: hub
instance_size_slug: basic-xxs
envs:
- key: LDK_ESPLORA_SERVER
value: "https://electrs.getalby.com"
- key: LOG_EVENTS
value: "true"
- key: LDK_ESPLORA_SERVER
value: "https://electrs.getalby.com"
- key: LOG_EVENTS
value: "true"
2 changes: 1 addition & 1 deletion .github/workflows/http.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
env:
CGO_ENABLED: 1
TAG: ${{ github.ref_name }}
run: go build ${{ env.GOTAGS }} -o build/bin/${{ env.PACKAGE_NAME }}/bin/${{ env.EXEC_NAME }} -ldflags "-X 'github.com/getAlby/nostr-wallet-connect/version.Tag=${{ env.TAG }}'" cmd/http/main.go
run: go build ${{ env.GOTAGS }} -o build/bin/${{ env.PACKAGE_NAME }}/bin/${{ env.EXEC_NAME }} -ldflags "-X 'github.com/getAlby/hub/version.Tag=${{ env.TAG }}'" cmd/http/main.go

- name: Copy shared libraries to the output directory
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/wails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Setup GoLang
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
go-version-file: "./go.mod"

- name: Get dependencies
run: go get -v -t -d ./...
Expand Down Expand Up @@ -101,17 +101,17 @@ jobs:

- name: Build App
if: runner.os == 'macOS'
run: wails build --platform darwin/universal -webview2 embed -o ${{ env.EXEC_NAME }} -tags "wails" -ldflags "-X 'github.com/getAlby/nostr-wallet-connect/version.Tag=${{ env.TAG }}'"
run: wails build --platform darwin/universal -webview2 embed -o ${{ env.EXEC_NAME }} -tags "wails" -ldflags "-X 'github.com/getAlby/hub/version.Tag=${{ env.TAG }}'"
shell: bash

- name: Build App
if: runner.os == 'Linux'
run: wails build --platform linux/amd64 -webview2 embed -o ${{ env.EXEC_NAME }} -tags "wails" -ldflags "-X 'github.com/getAlby/nostr-wallet-connect/version.Tag=${{ env.TAG }}'"
run: wails build --platform linux/amd64 -webview2 embed -o ${{ env.EXEC_NAME }} -tags "wails" -ldflags "-X 'github.com/getAlby/hub/version.Tag=${{ env.TAG }}'"
shell: bash

- name: Build Windows App
if: runner.os == 'Windows'
run: wails build --platform windows/amd64 -webview2 embed -o ${{ env.EXEC_NAME }}.exe -tags "wails" -ldflags "-X 'github.com/getAlby/nostr-wallet-connect/version.Tag=${{ env.TAG }}'"
run: wails build --platform windows/amd64 -webview2 embed -o ${{ env.EXEC_NAME }}.exe -tags "wails" -ldflags "-X 'github.com/getAlby/hub/version.Tag=${{ env.TAG }}'"
shell: bash

- name: Import Code-Signing Certificates for macOS
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ COPY . .
COPY --from=frontend /build/frontend/dist ./frontend/dist

RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build \
-ldflags="-X 'github.com/getAlby/nostr-wallet-connect/version.Tag=$TAG'" \
-ldflags="-X 'github.com/getAlby/hub/version.Tag=$TAG'" \
-o main cmd/http/main.go

COPY ./build/docker/copy_dylibs.sh .
Expand Down
38 changes: 23 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nostr Wallet Connect (Next)
# Alby Hub

This is a self-sovereign, self-custodial, single-user rewrite of NWC currently in an experimental phase development. **❗This version is not backwards compatible with NWC - it requires a fresh database and connections to be re-added**
This is a self-sovereign, self-custodial, single-user rewrite of the original [Nostr Wallet Connect](https://github.com/getAlby/nostr-wallet-connect) app. **❗This version is not backwards compatible with the original app - it requires a fresh database and connections to be re-added**

This application allows you to control your Lightning node or wallet from any other application that supports [NWC](https://nwc.dev/).
Connect apps like [Damus](https://damus.io/) or [Amethyst](https://linktr.ee/amethyst.social) to your node. There are many more available on https://nwc.dev/.
Expand All @@ -16,10 +16,12 @@ Ideally the app runs 24/7 (on a node, VPS or always-online desktop/laptop machin

## Supported Backends

- LND (see: lnd.go)
- Breez (see: breez.go)
- Greenlight (see: greenlight.go)
- LDK (see: ldk.go)
- LND
- Breez
- Greenlight
- LDK
- Pheonixd
- Cashu
- want more? please open an issue.

## Installation
Expand Down Expand Up @@ -123,7 +125,7 @@ For more information refer to:

### Versioning

$ go run -ldflags="-X 'github.com/getAlby/nostr-wallet-connect/version.Tag=v0.6.0'" cmd/http/main.go
$ go run -ldflags="-X 'github.com/getAlby/hub/version.Tag=v0.6.0'" cmd/http/main.go

### Windows

Expand All @@ -135,9 +137,9 @@ Breez SDK requires gcc to build the Breez bindings. Run `choco install mingw` an
- `CLIENT_NOSTR_PUBKEY`: if set, this service will only listen to events authored by this public key. You can set this to your own nostr public key.
- `RELAY`: default: "wss://relay.getalby.com/v1"
- `COOKIE_SECRET`: a randomly generated secret string. (only needed in http mode)
- `DATABASE_URI`: a sqlite filename. Default: $XDG_DATA_HOME/nostr-wallet-connect/nwc.db
- `DATABASE_URI`: a sqlite filename. Default: $XDG_DATA_HOME/albyhub/nwc.db
- `PORT`: the port on which the app should listen on (default: 8080)
- `WORK_DIR`: directory to store NWC data files. Default: $XDG_DATA_HOME/nostr-wallet-connect
- `WORK_DIR`: directory to store NWC data files. Default: $XDG_DATA_HOME/albyhub
- `LOG_LEVEL`: log level for the application. Higher is more verbose. Default: 4 (info)

### LND Backend parameters
Expand Down Expand Up @@ -179,9 +181,9 @@ Create an OAuth client at the [Alby Developer Portal](https://getalby.com/develo

Follow the steps to integrate Mutinynet with your NWC Next setup:

1. Configure your environment with the [Mutinynet LDK parameters](https://github.com/getAlby/nostr-wallet-connect-next#mutinynet)
1. Configure your environment with the [Mutinynet LDK parameters](https://github.com/getAlby/hub#mutinynet)

2. Proceed as described in the [Development](https://github.com/getAlby/nostr-wallet-connect-next#Development) section to run the frontend and backend
2. Proceed as described in the [Development](https://github.com/getAlby/hub#Development) section to run the frontend and backend

3. During onboarding, after setting your password and authorizing via Alby OAuth, you'll be directed to `/onboarding/lightning/migrate-alby`. Click "Skip For Now" to access your wallet interface

Expand Down Expand Up @@ -332,11 +334,11 @@ Run NWC on your own node!

### Digital Ocean

[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/getAlby/nostr-wallet-connect-next/tree/master)
[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/getAlby/hub/tree/master)

### Render

[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/getAlby/nostr-wallet-connect-next)
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/getAlby/hub)

### Fly

Expand Down Expand Up @@ -378,10 +380,16 @@ LDK logs:

_Tested on Linux only_

`docker run -v ~/.local/share/alby-nwc:/data -e WORK_DIR='/data' -p 8080:8080 ghcr.io/getalby/nostr-wallet-connect-next:latest`
`docker run -v ~/.local/share/albyhub:/data -e WORK_DIR='/data' -p 8080:8080 ghcr.io/getalby/hub:latest`

#### From Source

_Tested on Linux only_

`docker run -v ~/.local/share/alby-nwc:/data -e WORK_DIR='/data' -p 8080:8080 $(docker build -q .)`
##### Docker Compose

`docker compose up`

##### Manually

`docker run -v ~/.local/share/albyhub:/data -e WORK_DIR='/data' -p 8080:8080 $(docker build -q .)`
14 changes: 7 additions & 7 deletions alby/alby_oauth_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import (
"golang.org/x/oauth2"
"gorm.io/gorm"

"github.com/getAlby/nostr-wallet-connect/config"
"github.com/getAlby/nostr-wallet-connect/db"
"github.com/getAlby/nostr-wallet-connect/events"
"github.com/getAlby/nostr-wallet-connect/lnclient"
"github.com/getAlby/nostr-wallet-connect/logger"
nip47 "github.com/getAlby/nostr-wallet-connect/nip47/models"
"github.com/getAlby/nostr-wallet-connect/service/keys"
"github.com/getAlby/hub/config"
"github.com/getAlby/hub/db"
"github.com/getAlby/hub/events"
"github.com/getAlby/hub/lnclient"
"github.com/getAlby/hub/logger"
nip47 "github.com/getAlby/hub/nip47/models"
"github.com/getAlby/hub/service/keys"
)

type albyOAuthService struct {
Expand Down
4 changes: 2 additions & 2 deletions alby/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package alby
import (
"context"

"github.com/getAlby/nostr-wallet-connect/events"
"github.com/getAlby/nostr-wallet-connect/lnclient"
"github.com/getAlby/hub/events"
"github.com/getAlby/hub/lnclient"
)

type AlbyOAuthService interface {
Expand Down
22 changes: 11 additions & 11 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import (
"github.com/sirupsen/logrus"
"gorm.io/gorm"

"github.com/getAlby/nostr-wallet-connect/alby"
"github.com/getAlby/nostr-wallet-connect/config"
"github.com/getAlby/nostr-wallet-connect/db"
"github.com/getAlby/nostr-wallet-connect/events"
"github.com/getAlby/nostr-wallet-connect/lnclient"
"github.com/getAlby/nostr-wallet-connect/logger"
permissions "github.com/getAlby/nostr-wallet-connect/nip47/permissions"
"github.com/getAlby/nostr-wallet-connect/service"
"github.com/getAlby/nostr-wallet-connect/service/keys"
"github.com/getAlby/nostr-wallet-connect/utils"
"github.com/getAlby/nostr-wallet-connect/version"
"github.com/getAlby/hub/alby"
"github.com/getAlby/hub/config"
"github.com/getAlby/hub/db"
"github.com/getAlby/hub/events"
"github.com/getAlby/hub/lnclient"
"github.com/getAlby/hub/logger"
permissions "github.com/getAlby/hub/nip47/permissions"
"github.com/getAlby/hub/service"
"github.com/getAlby/hub/service/keys"
"github.com/getAlby/hub/utils"
"github.com/getAlby/hub/version"
)

type api struct {
Expand Down
6 changes: 3 additions & 3 deletions api/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"crypto/rand"
"crypto/sha256"

"github.com/getAlby/nostr-wallet-connect/db"
"github.com/getAlby/nostr-wallet-connect/logger"
"github.com/getAlby/nostr-wallet-connect/utils"
"github.com/getAlby/hub/db"
"github.com/getAlby/hub/logger"
"github.com/getAlby/hub/utils"
"golang.org/x/crypto/pbkdf2"
)

Expand Down
2 changes: 1 addition & 1 deletion api/esplora.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"time"

"github.com/getAlby/nostr-wallet-connect/logger"
"github.com/getAlby/hub/logger"
"github.com/sirupsen/logrus"
)

Expand Down
8 changes: 4 additions & 4 deletions api/lsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"strings"
"time"

"github.com/getAlby/nostr-wallet-connect/lnclient"
"github.com/getAlby/nostr-wallet-connect/logger"
"github.com/getAlby/nostr-wallet-connect/lsp"
"github.com/getAlby/nostr-wallet-connect/utils"
"github.com/getAlby/hub/lnclient"
"github.com/getAlby/hub/logger"
"github.com/getAlby/hub/lsp"
"github.com/getAlby/hub/utils"
decodepay "github.com/nbd-wtf/ln-decodepay"
"github.com/sirupsen/logrus"
)
Expand Down
6 changes: 3 additions & 3 deletions api/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"io"
"time"

"github.com/getAlby/nostr-wallet-connect/alby"
"github.com/getAlby/nostr-wallet-connect/db"
"github.com/getAlby/nostr-wallet-connect/lnclient"
"github.com/getAlby/hub/alby"
"github.com/getAlby/hub/db"
"github.com/getAlby/hub/lnclient"
)

type API interface {
Expand Down
6 changes: 3 additions & 3 deletions cmd/http/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"time"

echologrus "github.com/davrux/echo-logrus/v4"
"github.com/getAlby/nostr-wallet-connect/http"
"github.com/getAlby/nostr-wallet-connect/logger"
"github.com/getAlby/nostr-wallet-connect/service"
"github.com/getAlby/hub/http"
"github.com/getAlby/hub/logger"
"github.com/getAlby/hub/service"
"github.com/labstack/echo/v4"
log "github.com/sirupsen/logrus"
)
Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"fmt"
"os"

"github.com/getAlby/nostr-wallet-connect/db"
"github.com/getAlby/nostr-wallet-connect/logger"
"github.com/getAlby/hub/db"
"github.com/getAlby/hub/logger"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
Expand Down
4 changes: 2 additions & 2 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package db
import (
"fmt"

"github.com/getAlby/nostr-wallet-connect/db/migrations"
"github.com/getAlby/nostr-wallet-connect/logger"
"github.com/getAlby/hub/db/migrations"
"github.com/getAlby/hub/logger"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
Expand Down
4 changes: 2 additions & 2 deletions db/db_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"time"

"github.com/getAlby/nostr-wallet-connect/events"
"github.com/getAlby/nostr-wallet-connect/logger"
"github.com/getAlby/hub/events"
"github.com/getAlby/hub/logger"
"github.com/nbd-wtf/go-nostr"
"gorm.io/gorm"
)
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
albyhub:
platform: linux/amd64
container_name: albyhub
image: ghcr.io/getalby/nostr-wallet-connect-next:latest
image: ghcr.io/getalby/hub:latest
volumes:
- ./albyhub-data:/data
ports:
Expand Down
2 changes: 1 addition & 1 deletion events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"slices"
"sync"

"github.com/getAlby/nostr-wallet-connect/logger"
"github.com/getAlby/hub/logger"
"github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ app = 'nwc'
primary_region = 'lax'

[build]
image = 'ghcr.io/getalby/nostr-wallet-connect-next:latest'
image = 'ghcr.io/getalby/hub:latest'

[env]
DATABASE_URI = '/data/nwc.db'
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/components/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ type Props = {
title: string | ReactElement;
description: string | ReactElement;
contentRight?: React.ReactNode;
breadcrumb?: boolean;
};

function AppHeader({ title, description, contentRight }: Props) {
function AppHeader({
title,
description,
contentRight,
breadcrumb = true,
}: Props) {
return (
<>
<Breadcrumbs />
{breadcrumb && <Breadcrumbs />}
<div className="flex justify-between border-b border-border pb-3 lg:pb-6">
<div className="flex-1">
<h1 className="text-xl lg:text-3xl font-semibold">{title}</h1>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ function Breadcrumbs() {
// Remove the last item if it's an index route to prevent e.g. Wallet > Wallet
const filteredCrumbs = isIndexRoute ? crumbs.slice(0, -1) : crumbs;

// Don't render anything if there is only one item
if (filteredCrumbs.length < 2) {
// Skip rendering for breadcrumbs consisting of 2 (or less) items
if (filteredCrumbs.length < 3) {
return null;
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/layouts/SettingsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function SettingsLayout() {
<AppHeader
title="Settings"
description="Manage your Alby Hub settings."
breadcrumb={false}
contentRight={
<AlertDialog>
<AlertDialogTrigger asChild>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/screens/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function Welcome() {
Subject to the following terms, Alby grants to you a
perpetual, worldwide license to the Application pursuant to
the Apache-2.0 license.
(https://github.com/getAlby/nostr-wallet-connect-next?tab=Apache-2.0-1-ov-file#readme).
(https://github.com/getAlby/hub?tab=Apache-2.0-1-ov-file#readme).
This EULA pertains solely to the Application and does not
limit your rights under, or grant you rights that supersede,
the license terms of any particular component.
Expand Down
Loading

0 comments on commit c436ae6

Please sign in to comment.