Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2e10d65
update deps
0xf0xx0 Jul 5, 2023
dc1cc48
update deps
0xf0xx0 Jul 7, 2023
8bcbbd5
add all native currencies to options
0xf0xx0 Jul 7, 2023
5417c3d
fix options modal size
0xf0xx0 Jul 7, 2023
d1e1dd4
make UI take up entire screen
0xf0xx0 Jul 7, 2023
b4ea5a3
fix fiat currency unit tooltip
0xf0xx0 Jul 7, 2023
4cbfdca
almost forgot to re-add the local option
0xf0xx0 Jul 8, 2023
7bf6325
modal patch: fit-content tends to squash, 100% appears to be better
0xf0xx0 Jul 10, 2023
8572441
modal patch: bs variables got in the way, actually fix modal sizing now
0xf0xx0 Jul 10, 2023
2ba0d6e
fix the fullscreen ui, merge channel row views into one file
0xf0xx0 Oct 12, 2023
054ab81
merge color swatch and color code into one div
0xf0xx0 Oct 12, 2023
411c951
added a privacy option like in btc-rpc-explorer
0xf0xx0 Oct 12, 2023
b468ee8
update rpc.proto to latest
0xf0xx0 Oct 12, 2023
70a68a3
fix decimal places for sats
0xf0xx0 Oct 12, 2023
3aa0777
increase size of input boxes on /openchannel
0xf0xx0 Oct 30, 2023
3e7fec6
remove links to unknown nodes and replace with spans
0xf0xx0 Nov 3, 2023
341aefa
[/manage-nodes] `userFormParams` is used in the catch block as well
0xf0xx0 Jan 11, 2024
683b5e5
switch from cdn to local files
0xf0xx0 Jan 11, 2024
fae9500
fix various NaN values
0xf0xx0 Jan 11, 2024
4f3af34
fix login password verification
0xf0xx0 Jan 11, 2024
fb2a468
symlink to the correct dir in node_modules
0xf0xx0 May 23, 2024
ebe03f4
move jdenticon and highlight to `+sharedScriptTags`
0xf0xx0 May 23, 2024
1b5425c
keep cookies on-site with Strict
0xf0xx0 May 25, 2024
24dca3e
update rpc.proto to v0.18.0-beta
0xf0xx0 Jun 3, 2024
3bce828
add route blinding feature abbreviation
0xf0xx0 Jun 11, 2024
1351bc1
basic inbound fee support
0xf0xx0 Jun 11, 2024
cbc1dab
reformat views, there's a lot of unneccesary spacing here
0xf0xx0 Jun 11, 2024
cd415d0
fix invalid update timestamp when local channel is inactive
0xf0xx0 Jun 11, 2024
9039083
clean channel info table headers a bit
0xf0xx0 Jun 11, 2024
794ff32
'the the' -> 'the'
0xf0xx0 Jun 12, 2024
f2801b1
[/forwarding-history] display total fees on outgoing channels, not in…
0xf0xx0 Jun 13, 2024
dcc8d47
[/local-channels] add a space between main title and subtitle
0xf0xx0 Jun 13, 2024
6ac3590
[/local-channels] display whether a channel is outbound or inbound, a…
0xf0xx0 Jun 13, 2024
b4b3efe
[/] fix npm shields
0xf0xx0 Jun 13, 2024
2898e9c
[/forwarding-history] use valueTransferredOut instead of -In, -Out is…
0xf0xx0 Jun 28, 2024
fe047f9
add prettierrc
0xf0xx0 Jun 29, 2024
0a7a21d
[/wallet] add taproot addresses
0xf0xx0 Jul 10, 2024
24deaeb
use home icon for the current active node in node cards
0xf0xx0 Jul 26, 2024
13c5775
[/forwarding-history] use fee_msat to calculate total fees collected
0xf0xx0 Oct 1, 2024
447f339
[/forwarding-history] [/local-channels] add ppm to routing info
0xf0xx0 Jan 5, 2025
8368765
update dependencies
0xf0xx0 Jan 5, 2025
0b07af6
replace base64url with Buffer base64url
0xf0xx0 Jan 5, 2025
c5ddf8c
add copy button to txids too
0xf0xx0 Jan 5, 2025
85e6edf
[/local-channels] fix broken page when channel is freshly opened
0xf0xx0 Jan 5, 2025
9b5a092
[/forwarding-history] fix outbound channel sorting
0xf0xx0 Jan 16, 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
5 changes: 4 additions & 1 deletion .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
# The password used to encrypt cookies
#LNDASH_COOKIE_SECRET=cookie_encrypting_password


# Privacy mode disables:
# Exchange-rate queries
# Default: false
#LNDASH_PRIVACY_MODE=true


# The environment variables below can be used to pre-configure
Expand Down
7 changes: 7 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins:
- "@prettier/plugin-pug"
printWidth: 120
semi: true
tabWidth: 4
trailingComma: "none"
useTabs: true
6 changes: 4 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ app.runOnStartup = async () => {


// exchange rates
utils.refreshExchangeRates();
setInterval(utils.refreshExchangeRates, 30 * 60000);
if (!process.env.LNDASH_PRIVACY_MODE) {
utils.refreshExchangeRates();
setInterval(utils.refreshExchangeRates, 30 * 60000);
}


// refresh periodically
Expand Down
6 changes: 3 additions & 3 deletions app/btcCoinConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const currencyUnits = [
active:true,
multiplier:100000000,
values:["sat", "satoshi"],
decimalPlaces:0
decimalPlaces:3
},
{
type:"native",
Expand All @@ -52,15 +52,15 @@ const currencyUnits = [
decimalPlaces:0
},
{
type:"exchanged",
type:"fiat",
name:"USD",
multiplier:"usd",
values:["usd"],
decimalPlaces:2,
symbol:"$"
},
{
type:"exchanged",
type:"fiat",
name:"EUR",
multiplier:"eur",
values:["eur"],
Expand Down
78 changes: 49 additions & 29 deletions app/currencies.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,70 @@
global.currencyTypes = {
"btc": {
id: "btc",
type:"native",
name:"BTC",
multiplier:1,
default:true,
decimalPlaces:8
type: "native",
name: "BTC",
multiplier: 1,
default: true,
decimalPlaces: 8
},
"mbtc": {
id: "mbtc",
type: "native",
name: "mBTC",
multiplier: 1000,
decimalPlaces: 5
},
"bits": {
id: "bits",
type: "native",
name: "bits",
active: false,
multiplier: 1000000,
decimalPlaces: 2
},
"sat": {
id: "sat",
type:"native",
name:"sat",
multiplier:100000000,
decimalPlaces:0
type: "native",
name: "sat",
multiplier: 100000000,
decimalPlaces: 3
},
"msat": {
id: "msat",
type:"native",
name:"msat",
multiplier:100000000000,
decimalPlaces:0
type: "native",
name: "msat",
multiplier: 100000000000,
decimalPlaces: 0
},
"local": {
id: "local",
type: "native",
name: "Local"
},
"usd": {
id: "usd",
type:"exchanged",
name:"USD",
multiplier:"usd",
decimalPlaces:2,
symbol:"$"
type: "fiat",
name: "USD",
multiplier: "usd",
decimalPlaces: 2,
symbol: "$"
},
"eur": {
id: "eur",
type:"exchanged",
name:"EUR",
multiplier:"eur",
decimalPlaces:2,
symbol:"€"
type: "fiat",
name: "EUR",
multiplier: "eur",
decimalPlaces: 2,
symbol: "€"
},
"gbp": {
id: "gbp",
type:"exchanged",
name:"GBP",
multiplier:"gbp",
decimalPlaces:2,
symbol:"£"
},
type: "fiat",
name: "GBP",
multiplier: "gbp",
decimalPlaces: 2,
symbol: "£"
}
};

global.currencySymbols = {
Expand Down
41 changes: 16 additions & 25 deletions app/passwordUtils.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
const crypto = require("crypto");

async function hash(password) {
return new Promise((resolve, reject) => {
const salt = crypto.randomBytes(8).toString("hex");

crypto.scrypt(password, salt, 64, (err, derivedKey) => {
if (err) {
reject(err);

} else {
resolve(salt + ":" + derivedKey.toString('hex'));
}
});
})
function hash(password) {
try {
const salt = crypto.randomBytes(8).toString('hex');
const derivedKey = (crypto.scryptSync(password, salt, 64)).toString('hex');
return salt + ":" + derivedKey;
} catch (e) {
throw e;
}
}

async function verify(password, hash) {
return new Promise((resolve, reject) => {
function verify(password, hash) {
try {
const [salt, key] = hash.split(":");
crypto.scrypt(password, salt, 64, (err, derivedKey) => {
if (err) {
reject(err);

} else {
resolve(key == derivedKey.toString('hex'));
}
});
})
const derivedKey = (crypto.scryptSync(password, salt, 64)).toString('hex');
return key === derivedKey;
} catch (e) {
throw e;
}
}


module.exports = {
hash: hash,
verify: verify
}
};
4 changes: 2 additions & 2 deletions app/rpcApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,9 @@ async function getWalletUtxos(minConfirmations=1, maxConfirmations=100000000) {
}

async function getNewDepositAddress(addressType) {
let valuesByTypeString = {"p2wkh":0, "np2wkh":1};
const valuesByTypeString = {"p2wkh":0, "np2wkh":1, "p2tr": 4};

let NewAddress = util.promisify(lndRpc.NewAddress.bind(lndRpc));
const NewAddress = util.promisify(lndRpc.NewAddress.bind(lndRpc));
return await NewAddress({type:valuesByTypeString[addressType]});
}

Expand Down
22 changes: 12 additions & 10 deletions app/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const qrcode = require("qrcode");
const CryptoJS = require("crypto-js");
const fs = require("fs");
const url = require("url");
const base64url = require('base64url');
const path = require('path');
const axios = require("axios");

Expand Down Expand Up @@ -112,7 +111,10 @@ function formatCurrencyAmountWithForcedDecimalPlaces(amount, formatType, forcedD

var dec = new Decimal(amount);

var decimalPlaces = currencyType.decimalPlaces;
// the regex used to strip trailing zeros only works
// if theres a non-zero in the string
// force currencies with no decimals to have one so 0 values dont get deleted
var decimalPlaces = currencyType.decimalPlaces || 1;
//if (decimalPlaces == 0 && dec < 1) {
// decimalPlaces = 5;
//}
Expand Down Expand Up @@ -159,7 +161,7 @@ function formatCurrencyAmountWithForcedDecimalPlaces(amount, formatType, forcedD

return returnVal;
}
} else if (currencyType.type == "exchanged") {
} else if (currencyType.type == "fiat") {
//console.log(JSON.stringify(global.exchangeRates) + " - " + currencyType.name);
if (global.exchangeRates != null && global.exchangeRates[currencyType.id] != null) {
dec = dec.times(global.exchangeRates[currencyType.id]);
Expand Down Expand Up @@ -626,11 +628,10 @@ function parseLndconnectString(lndconnectString) {
let parsedUrl = url.parse(lndconnectString, true);

let tlsCertAscii = "-----BEGIN CERTIFICATE-----\r\n";
tlsCertAscii += chunkString(base64url.toBase64(parsedUrl.query.cert), 64).join("\r\n");
tlsCertAscii += chunkString(Buffer.from(parsedUrl.query.cert, 'base64url').toString('base64'), 64).join("\r\n");
tlsCertAscii += "\r\n-----END CERTIFICATE-----";

let adminMacaroonHex = base64url.toBase64(parsedUrl.query.macaroon);
adminMacaroonHex = Buffer.from(adminMacaroonHex, 'base64').toString('hex');
let adminMacaroonHex = Buffer.from(parsedUrl.query.macaroon, 'base64url').toString('hex');

let parsedData = {
host:parsedUrl.hostname,
Expand All @@ -654,8 +655,8 @@ function formatLndconnectString(lndconnectData) {
// remove ---END--- line
certLines.shift();

let cert = base64url.fromBase64(certLines.join(''));
let macaroon = base64url(Buffer.from(lndconnectData.adminMacaroonHex, 'hex'));
let cert = Buffer.from(certLines.join(''), 'base64').toString('base64url');
let macaroon = Buffer.from(lndconnectData.adminMacaroonHex, 'hex').toString('base64url');

return `lndconnect://${lndconnectData.host}:${lndconnectData.port}?cert=${cert}&macaroon=${macaroon}`;
}
Expand Down Expand Up @@ -767,9 +768,10 @@ const formatBuffer = (buffer, format="base64", fullDetail=false) => {
};

function getExchangedCurrencyFormatData(amount, exchangeType, includeUnit=true) {
if (global.exchangeRates != null && global.exchangeRates[exchangeType.toLowerCase()] != null) {
exchangeType = exchangeType.toLowerCase()
if (global.exchangeRates != null && global.exchangeRates[exchangeType] != null) {
var dec = new Decimal(amount);
dec = dec.times(global.exchangeRates[exchangeType.toLowerCase()]);
dec = dec.times(global.exchangeRates[exchangeType]);
var exchangedAmt = parseFloat(Math.round(dec * 100) / 100).toFixed(2);

return {
Expand Down
Loading