Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1d0a200
Cleanup Bootstrap Imports
ShahanaFarooqui Mar 12, 2025
f589d9c
Add rune for clnrest connect wallet url
ShahanaFarooqui Mar 12, 2025
5812bff
Child Routing
ShahanaFarooqui Mar 11, 2025
cb252fc
Break application context into root, and cln
ShahanaFarooqui Mar 12, 2025
e72643d
Fix CORS port from past commit
evansmj May 6, 2025
594de4b
Unit tests setup
evansmj May 7, 2025
510982e
Redux and Recharts Dependency updates
evansmj May 6, 2025
849f6da
Style updates
evansmj May 7, 2025
956d44a
Update types for redux store
evansmj May 7, 2025
d647bfb
Redux Store
evansmj May 7, 2025
4bc10c2
Updated Routing setup
evansmj May 7, 2025
c1f411f
useHttp to http service
evansmj May 7, 2025
6a02e2b
Provide store and Routing Config to Application
evansmj May 7, 2025
548f0e6
CLN Redux and Routing updates
evansmj May 7, 2025
dcd134c
Other Redux and Routing updates
evansmj May 7, 2025
b694b9c
BKPR SVGs
evansmj May 7, 2025
e61e10c
Date functions and formatting fix
evansmj May 7, 2025
b57f9d1
BKPR Transform service
evansmj May 7, 2025
80d13d2
Routing toggle
evansmj May 7, 2025
17f0de6
SQL Terminal Modal
evansmj May 7, 2025
152dd14
BKPR Dashboard
evansmj May 7, 2025
824702c
BKPR Volume
evansmj May 7, 2025
4541352
BKPR Satsflow
evansmj May 7, 2025
6f76934
BKPR Account Events
evansmj May 7, 2025
a4690ea
Minute granularity and build
ShahanaFarooqui May 16, 2025
dc0a753
Add Lint workflow
Crypto4udit Mar 10, 2025
8c5523e
Add lint dependencies
Crypto4udit Mar 10, 2025
dd25432
Add backend lint config and fix lint errors
ShahanaFarooqui May 28, 2025
b1050a7
Add frontend lint config and fix lint errors
ShahanaFarooqui May 28, 2025
481e67e
Add workflows
evansmj Mar 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 3 additions & 39 deletions .github/workflows/ci.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
name: Artifact
name: Build

on:
release:
types: [released]
pull_request:
types: [closed]
branches: [ master ]
workflow_dispatch:

env:
CI: false


jobs:
build:
runs-on: ubuntu-22.04
Expand All @@ -19,7 +12,7 @@ jobs:
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x

Expand Down Expand Up @@ -59,32 +52,3 @@ jobs:

- name: Run build backend server
run: npm run backend:build

deploy:
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Cache build frontend
uses: actions/cache@v3
id: cache-build-frontend
with:
path: apps/frontend
key: ${{ runner.os }}-frontend-${{ github.sha }}

- name: Cache build backend
uses: actions/cache@v3
id: cache-build-backend
with:
path: apps/backend
key: ${{ runner.os }}-backend-${{ github.sha }}

- name: Compress files
run: tar -czf /tmp/clnapp.tar.gz apps/frontend/build apps/backend/dist package.json package-lock.json

- uses: actions/upload-artifact@v3
with:
name: clnapp-build$VERSION
path: /tmp/clnapp.tar.gz
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint

on:
pull_request:
workflow_dispatch:

jobs:
eslint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x

- name: Get version from package.json
id: package-version
run: |
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
echo "Project Version: $VERSION"

- name: Cache node_modules
uses: actions/cache@v3
id: cache-npm-packages
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm clean-install

- name: Check lint errors
run: npm run lint
33 changes: 29 additions & 4 deletions .github/workflows/github.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
name: Build and publish Github image
name: Build artifact and package

on:
release:
types: [released]
pull_request:
types: [closed]
branches: [ master ]
workflow_dispatch:

jobs:
artifact:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Cache build frontend
uses: actions/cache@v3
id: cache-build-frontend
with:
path: apps/frontend
key: ${{ runner.os }}-frontend-${{ github.sha }}

- name: Cache build backend
uses: actions/cache@v3
id: cache-build-backend
with:
path: apps/backend
key: ${{ runner.os }}-backend-${{ github.sha }}

- name: Compress files
run: tar -czf /tmp/clnapp.tar.gz apps/frontend/build apps/backend/dist package.json package-lock.json

- uses: actions/upload-artifact@v3
with:
name: clnapp-build$VERSION
path: /tmp/clnapp.tar.gz

build:
name: Build image
runs-on: ubuntu-22.04
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Unit tests

on:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x

- name: Get version from package.json
id: package-version
run: |
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
echo "Project Version: $VERSION"

- name: Cache node_modules
uses: actions/cache@v3
id: cache-npm-packages
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm clean-install

- name: Run frontend unit tests
run: npm run frontend:test

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
- LIGHTNING_IP: IP address of Core lightning node container (required)
- LIGHTNING_PATH: Path for core lightning (optional; required for entrypoint.sh)
- HIDDEN_SERVICE_URL: REST hidden service url (optional; for connect wallet screen; Used for Tor Domain also)
- LIGHTNING_NODE_TYPE: Choose Core lightning node type (valid values: CLN/GREENLIGHT, default: CLN)
- COMMANDO_CONFIG: Full Path including file name for commando auth with PUBKEY & RUNE (required)
- LIGHTNING_WEBSOCKET_PORT: Core lightning's websocket port (required; from cln's config.json; starting with `bind-addr=ws:`)
- LIGHTNING_REST_PROTOCOL: Protocol on which REST is served (valid values: http/https, default: https)
Expand Down
9 changes: 3 additions & 6 deletions apps/backend/dist/controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from 'fs';
import { APP_CONSTANTS, HttpStatusCode, SECRET_KEY } from '../shared/consts.js';
import { logger } from '../shared/logger.js';
import handleError from '../shared/error-handler.js';
import { verifyPassword, isAuthenticated, isValidPassword, applicationConfig, } from '../shared/utils.js';
import { verifyPassword, isAuthenticated, isValidPassword } from '../shared/utils.js';
import { AuthError } from '../models/errors.js';
class AuthController {
userLogin(req, res, next) {
Expand Down Expand Up @@ -46,9 +46,6 @@ class AuthController {
const config = JSON.parse(fs.readFileSync(APP_CONSTANTS.APP_CONFIG_FILE, 'utf-8'));
if (config.password === currPassword || !isValid) {
try {
if (typeof config.singleSignOn === 'undefined') {
config.singleSignOn = process.env.SINGLE_SIGN_ON || false;
}
config.password = newPassword;
try {
fs.writeFileSync(APP_CONSTANTS.APP_CONFIG_FILE, JSON.stringify(config, null, 2), 'utf-8');
Expand Down Expand Up @@ -85,7 +82,7 @@ class AuthController {
const uaRes = isAuthenticated(req.cookies.token);
if (req.body.returnResponse) {
// Frontend is asking if user is authenticated or not
if (applicationConfig?.singleSignOn === true) {
if (APP_CONSTANTS.SINGLE_SIGN_ON === 'true') {
return res.status(201).json({ isAuthenticated: true, isValidPassword: true });
}
else {
Expand All @@ -105,7 +102,7 @@ class AuthController {
}
else {
// Backend APIs are asking if user is authenticated or not
if (uaRes === true || applicationConfig?.singleSignOn === true) {
if (uaRes === true || APP_CONSTANTS.SINGLE_SIGN_ON === 'true') {
return next();
}
else {
Expand Down
18 changes: 11 additions & 7 deletions apps/backend/dist/controllers/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { APP_CONSTANTS, DEFAULT_CONFIG, FIAT_RATE_API, FIAT_VENUES, HttpStatusCo
import { logger } from '../shared/logger.js';
import handleError from '../shared/error-handler.js';
import { APIError } from '../models/errors.js';
import { setSharedApplicationConfig, overrideSettingsWithEnvVariables, refreshEnvVariables, } from '../shared/utils.js';
import { addServerConfig, refreshEnvVariables } from '../shared/utils.js';
import { CLNService } from '../service/lightning.service.js';
class SharedController {
getApplicationSettings(req, res, next) {
Expand All @@ -13,10 +13,14 @@ class SharedController {
if (!fs.existsSync(APP_CONSTANTS.APP_CONFIG_FILE)) {
fs.writeFileSync(APP_CONSTANTS.APP_CONFIG_FILE, JSON.stringify(DEFAULT_CONFIG, null, 2), 'utf-8');
}
let config = JSON.parse(fs.readFileSync(APP_CONSTANTS.APP_CONFIG_FILE, 'utf-8'));
config = overrideSettingsWithEnvVariables(config);
setSharedApplicationConfig(config);
delete config.password;
let config = {
uiConfig: JSON.parse(fs.readFileSync(APP_CONSTANTS.APP_CONFIG_FILE, 'utf-8')),
};
delete config.uiConfig.password;
delete config.uiConfig.isLoading;
delete config.uiConfig.error;
delete config.uiConfig.singleSignOn;
config = addServerConfig(config);
res.status(200).json(config);
}
catch (error) {
Expand All @@ -27,8 +31,8 @@ class SharedController {
try {
logger.info('Updating Application Settings: ' + JSON.stringify(req.body));
const config = JSON.parse(fs.readFileSync(APP_CONSTANTS.APP_CONFIG_FILE, 'utf-8'));
req.body.password = config.password; // Before saving, add password in the config received from frontend
fs.writeFileSync(APP_CONSTANTS.APP_CONFIG_FILE, JSON.stringify(req.body, null, 2), 'utf-8');
req.body.uiConfig.password = config.password; // Before saving, add password in the config received from frontend
fs.writeFileSync(APP_CONSTANTS.APP_CONFIG_FILE, JSON.stringify(req.body.uiConfig, null, 2), 'utf-8');
res.status(201).json({ message: 'Application Settings Updated Successfully' });
}
catch (error) {
Expand Down
6 changes: 3 additions & 3 deletions apps/backend/dist/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import { AuthRoutes } from './routes/v1/auth.js';
import { APIError } from './models/errors.js';
import { APP_CONSTANTS, Environment, HttpStatusCode } from './shared/consts.js';
import handleError from './shared/error-handler.js';
let directoryName = dirname(fileURLToPath(import.meta.url));
let routes = [];
const directoryName = dirname(fileURLToPath(import.meta.url));
const routes = [];
const app = express();
const server = http.createServer(app);
const LIGHTNING_PORT = normalizePort(process.env.APP_PORT || '2103');
const APP_IP = process.env.APP_IP || 'localhost';
const APP_PROTOCOL = process.env.APP_PROTOCOL || 'http';
function normalizePort(val) {
var port = parseInt(val, 10);
const port = parseInt(val, 10);
if (isNaN(port)) {
return val;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/backend/dist/service/grpc.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ export class GRPCService {
: errorMessage;
}
catch (error) {
logger.error('Error extracting RPC error message: ', error);
return errorMessage;
}
}
decodeResponse(method, response) {
const responseType = this.clnNode.lookupType(`cln.${method}Response`);
const dataBuffer = Buffer.from(response.data || '');
const resFlag = dataBuffer.subarray(0, 1);
const resDataLength = dataBuffer.subarray(1, 5);
// resFlag (0, 1) and resDataLength (1, 5) not used in code
const responseData = dataBuffer.subarray(5);
const grpcStatus = Number(response.headers['grpc-status']);
if (grpcStatus !== 0) {
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/dist/service/lightning.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class LightningService {
case AppConnect.REST:
const headers = new AxiosHeaders();
headers.set('rune', APP_CONSTANTS.COMMANDO_RUNE);
let axiosConfig = {
const axiosConfig = {
baseURL: REST_CONFIG.url + '/v1/',
headers,
};
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/dist/shared/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export var AppConnect;
export var NodeType;
(function (NodeType) {
NodeType["CLN"] = "CLN";
NodeType["GREENLIGHT"] = "GREENLIGHT";
})(NodeType || (NodeType = {}));
export var HttpStatusCode;
(function (HttpStatusCode) {
Expand Down Expand Up @@ -121,7 +120,6 @@ export const API_VERSION = '/v1';
export const FIAT_RATE_API = 'https://green-bitcoin-mainnet.blockstream.com/prices/v0/venues/';
export const FIAT_VENUES = {
USD: 'KRAKEN',
CAD: 'BULLBITCOIN',
EUR: 'KRAKEN',
NZD: 'KIWICOIN',
};
4 changes: 2 additions & 2 deletions apps/backend/dist/shared/error-handler.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { HttpStatusCode } from './consts.js';
import { logger } from './logger.js';
function handleError(error, req, res, next) {
var route = req.url || '';
var message = error.message
const route = req.url || '';
const message = error.message
? error.message
: typeof error === 'object'
? JSON.stringify(error)
Expand Down
23 changes: 10 additions & 13 deletions apps/backend/dist/shared/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ import * as fs from 'fs';
import { sep } from 'path';
import { logger } from '../shared/logger.js';
import { APP_CONSTANTS, GRPC_CONFIG, LN_MESSAGE_CONFIG, SECRET_KEY } from '../shared/consts.js';
export var applicationConfig = null;
export function overrideSettingsWithEnvVariables(config) {
config.singleSignOn =
(process.env.SINGLE_SIGN_ON && process.env.SINGLE_SIGN_ON === 'true') || false;
export function addServerConfig(config) {
config.serverConfig = {
appConnect: APP_CONSTANTS.APP_CONNECT,
appPort: APP_CONSTANTS.APP_PORT,
appProtocol: APP_CONSTANTS.APP_PROTOCOL,
appVersion: APP_CONSTANTS.APP_VERSION,
lightningNodeType: APP_CONSTANTS.LIGHTNING_NODE_TYPE,
singleSignOn: APP_CONSTANTS.SINGLE_SIGN_ON,
};
return config;
}
export function setSharedApplicationConfig(config) {
try {
applicationConfig = config;
}
catch (error) {
throw error;
}
}
export function isAuthenticated(token) {
try {
if (!token) {
Expand Down Expand Up @@ -109,7 +106,7 @@ export function refreshEnvVariables() {
let clientCert = '';
let caCert = '';
if (fs.existsSync('package.json')) {
let packageData = Buffer.from(fs.readFileSync('package.json')).toString();
const packageData = Buffer.from(fs.readFileSync('package.json')).toString();
APP_CONSTANTS.APP_VERSION = JSON.parse(packageData).version;
}
if (fs.existsSync(APP_CONSTANTS.LIGHTNING_CERTS_PATH + 'client-key.pem')) {
Expand Down
23 changes: 23 additions & 0 deletions apps/backend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import tseslint from 'typescript-eslint';
import globals from 'globals';

export default [
...tseslint.configs.recommended,
{
files: ['**/*.{js,ts}'],
languageOptions: {
globals: {
...globals.node,
},
parserOptions: {
sourceType: 'module',
project: './tsconfig.json',
},
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},
];
Loading