Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

Commit 3992ecf

Browse files
committed
Merge branch 'refs/heads/master' into release-wails
2 parents d413d41 + 76848a5 commit 3992ecf

File tree

125 files changed

+5654
-4894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+5654
-4894
lines changed

.github/workflows/build-docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Checkout code
2020
uses: actions/checkout@v2
2121
- name: Run tests
22-
run: mkdir frontend/dist && touch frontend/dist/tmp && go test
22+
run: mkdir frontend/dist && touch frontend/dist/tmp && go test ./...
2323
- name: Docker build
2424
uses: mr-smithers-excellent/docker-build-push@v6
2525
id: build

.github/workflows/multiplatform.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Checkout code
2020
uses: actions/checkout@v2
2121
- name: Run tests
22-
run: mkdir frontend/dist && touch frontend/dist/tmp && go test
22+
run: mkdir frontend/dist && touch frontend/dist/tmp && go test ./...
2323
- name: Docker build
2424
uses: mr-smithers-excellent/docker-build-push@v6
2525
id: build

.github/workflows/package-raspberry-pi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
GOARM: 6
4343
CGO_ENABLED: 1
4444
CC: ${{ github.workspace }}/armv6-unknown-linux-gnueabihf/bin/armv6-unknown-linux-gnueabihf-gcc
45-
run: go build -tags skip_breez,netgo -v -o nostr-wallet-connect
45+
run: go build -tags skip_breez,netgo -v -o nostr-wallet-connect cmd/http/main.go
4646

4747
- name: Find and copy shared libraries
4848
run: |

.github/workflows/wails2.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ jobs:
9090
if: runner.os == 'Windows'
9191
run: |
9292
cp `go list -m -f "{{.Dir}}" github.com/breez/breez-sdk-go`/breez_sdk/lib/windows-amd64/breez_sdk_bindings.dll ./
93-
cp `go list -m -f "{{.Dir}}" github.com/getAlby/glalby-go`/glalby/x86_64-pc-windows-gnu/glalby_bindings.dll ./
94-
cp `go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go`/ldk_node/x86_64-pc-windows-gnu/ldk_node.dll ./
93+
cp `go list -m -f "{{.Dir}}" github.com/getAlby/glalby-go`/glalby/x86_64-pc-windows-msvc/glalby_bindings.dll ./
94+
cp `go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go`/ldk_node/x86_64-pc-windows-msvc/ldk_node.dll ./
9595
shell: bash
9696

9797
- name: Copy appicon in place

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"editor.defaultFormatter": "golang.go"
55
},
66
"editor.formatOnSave": true,
7-
"go.buildTags": "http,wails",
87
"typescript.preferences.importModuleSpecifier": "non-relative",
98
"editor.codeActionsOnSave": {
109
"source.organizeImports": "always"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ COPY . .
3333
# Copy frontend dist files into the container
3434
COPY --from=frontend /build/frontend/dist ./frontend/dist
3535

36-
RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build -o main .
36+
RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build -o main cmd/http/main.go
3737

3838
RUN cp `find /go/pkg/mod/github.com/breez/ |grep linux-amd64 |grep libbreez_sdk_bindings.so` ./
3939
RUN cp `find /go/pkg/mod/github.com/get\!alby/ | grep x86_64-unknown-linux-gnu | grep libglalby_bindings.so` ./

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ As data storage SQLite is used.
3434
# edit the config for your needs
3535
vim .env
3636

37-
#### Optional Requirements
38-
39-
See [Greenlight](./README_GREENLIGHT.md)
40-
4137
## Development
4238

4339
### Required Software
@@ -53,7 +49,7 @@ See [Greenlight](./README_GREENLIGHT.md)
5349

5450
2. Compile the frontend or run `touch frontend/dist/tmp` to ensure there are embeddable files available.
5551

56-
3. `go run .`
52+
3. `go run cmd/http/main.go`
5753

5854
### React Frontend (HTTP mode)
5955

@@ -77,7 +73,7 @@ _If you get a blank screen, try running in your normal terminal (outside of vsco
7773
### Build and run locally (HTTP mode)
7874

7975
$ mkdir tmp
80-
$ go build -o main
76+
$ go build -o main cmd/http/main.go
8177
$ cp main tmp
8278
$ cp .env tmp
8379
$ cd tmp
@@ -90,7 +86,11 @@ _If you get a blank screen, try running in your normal terminal (outside of vsco
9086

9187
### Testing
9288

93-
$ go test
89+
$ go test ./...
90+
91+
#### Test matching regular expression
92+
93+
$ go test ./... -run TestHandleGetInfoEvent
9494

9595
### Profiling
9696

@@ -363,8 +363,9 @@ LDK logs:
363363
- install nvm (curl script)
364364
- with nvm, choose node lts
365365
- install yarn (via npm)
366-
- then run yarn build
367-
- go run .
366+
- run `(cd frontend && yarn install`
367+
- run `(cd frontend && yarn build:http)`
368+
- run `go run cmd/http/main.go`
368369

369370
### Docker
370371

README_GREENLIGHT.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

alby/alby_http_service.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@ import (
55
"net/http"
66

77
"github.com/getAlby/nostr-wallet-connect/config"
8+
"github.com/getAlby/nostr-wallet-connect/logger"
89
"github.com/labstack/echo/v4"
9-
"github.com/sirupsen/logrus"
1010
)
1111

1212
type AlbyHttpService struct {
1313
albyOAuthSvc AlbyOAuthService
14-
logger *logrus.Logger
1514
appConfig *config.AppConfig
1615
}
1716

18-
func NewAlbyHttpService(albyOAuthSvc AlbyOAuthService, logger *logrus.Logger, appConfig *config.AppConfig) *AlbyHttpService {
17+
func NewAlbyHttpService(albyOAuthSvc AlbyOAuthService, appConfig *config.AppConfig) *AlbyHttpService {
1918
return &AlbyHttpService{
2019
albyOAuthSvc: albyOAuthSvc,
21-
logger: logger,
2220
appConfig: appConfig,
2321
}
2422
}
@@ -36,7 +34,7 @@ func (albyHttpSvc *AlbyHttpService) albyCallbackHandler(c echo.Context) error {
3634

3735
err := albyHttpSvc.albyOAuthSvc.CallbackHandler(c.Request().Context(), code)
3836
if err != nil {
39-
albyHttpSvc.logger.WithError(err).Error("Failed to handle Alby OAuth callback")
37+
logger.Logger.WithError(err).Error("Failed to handle Alby OAuth callback")
4038
return c.JSON(http.StatusInternalServerError, ErrorResponse{
4139
Message: fmt.Sprintf("Failed to handle Alby OAuth callback: %s", err.Error()),
4240
})
@@ -59,7 +57,7 @@ func (albyHttpSvc *AlbyHttpService) albyCallbackHandler(c echo.Context) error {
5957
func (albyHttpSvc *AlbyHttpService) albyMeHandler(c echo.Context) error {
6058
me, err := albyHttpSvc.albyOAuthSvc.GetMe(c.Request().Context())
6159
if err != nil {
62-
albyHttpSvc.logger.WithError(err).Error("Failed to request alby me endpoint")
60+
logger.Logger.WithError(err).Error("Failed to request alby me endpoint")
6361
return c.JSON(http.StatusInternalServerError, ErrorResponse{
6462
Message: fmt.Sprintf("Failed to request alby me endpoint: %s", err.Error()),
6563
})
@@ -71,7 +69,7 @@ func (albyHttpSvc *AlbyHttpService) albyMeHandler(c echo.Context) error {
7169
func (albyHttpSvc *AlbyHttpService) albyBalanceHandler(c echo.Context) error {
7270
balance, err := albyHttpSvc.albyOAuthSvc.GetBalance(c.Request().Context())
7371
if err != nil {
74-
albyHttpSvc.logger.WithError(err).Error("Failed to request alby balance endpoint")
72+
logger.Logger.WithError(err).Error("Failed to request alby balance endpoint")
7573
return c.JSON(http.StatusInternalServerError, ErrorResponse{
7674
Message: fmt.Sprintf("Failed to request alby balance endpoint: %s", err.Error()),
7775
})
@@ -92,7 +90,7 @@ func (albyHttpSvc *AlbyHttpService) albyPayHandler(c echo.Context) error {
9290

9391
err := albyHttpSvc.albyOAuthSvc.SendPayment(c.Request().Context(), payRequest.Invoice)
9492
if err != nil {
95-
albyHttpSvc.logger.WithError(err).Error("Failed to request alby pay endpoint")
93+
logger.Logger.WithError(err).Error("Failed to request alby pay endpoint")
9694
return c.JSON(http.StatusInternalServerError, ErrorResponse{
9795
Message: fmt.Sprintf("Failed to request alby pay endpoint: %s", err.Error()),
9896
})
@@ -104,7 +102,7 @@ func (albyHttpSvc *AlbyHttpService) albyPayHandler(c echo.Context) error {
104102
func (albyHttpSvc *AlbyHttpService) albyLinkAccountHandler(c echo.Context) error {
105103
err := albyHttpSvc.albyOAuthSvc.LinkAccount(c.Request().Context())
106104
if err != nil {
107-
albyHttpSvc.logger.WithError(err).Error("Failed to connect alby account")
105+
logger.Logger.WithError(err).Error("Failed to connect alby account")
108106
return err
109107
}
110108

0 commit comments

Comments
 (0)