diff --git a/connect.js b/connect.js index 5df647a7..7dbcdaef 100644 --- a/connect.js +++ b/connect.js @@ -1,4 +1,6 @@ +var os = require('os'); var fs = require('fs'); +var platform = require('os').platform(); var crypto = require('crypto'); var clArgs = require('optimist').argv; var ini = require('ini'); @@ -9,9 +11,27 @@ var logger = require('./controllers/logger'); var connect = {}; const setDefaultConfig = () => { + var homeDir = os.userInfo().homedir; var macaroonPath = ''; var lndConfigPath = ''; - var bitcoindConfigPath = ''; + switch (platform) { + case 'win32': + macaroonPath = homeDir + '\\AppData\\Local\\Lnd\\data\\chain\\bitcoin\\testnet'; + lndConfigPath = homeDir + '\\AppData\\Local\\Lnd\\lnd.conf'; + break; + case 'darwin': + macaroonPath = homeDir + '/Library/Application Support/Lnd/data/chain/bitcoin/testnet'; + lndConfigPath = homeDir + '/Library/Application Support/Lnd/lnd.conf'; + break; + case 'linux': + macaroonPath = homeDir + '/.lnd/data/chain/bitcoin/testnet'; + lndConfigPath = homeDir + '/.lnd/lnd.conf'; + break; + default: + macaroonPath = ''; + lndConfigPath = ''; + break; + } return { Authentication: { macaroonPath: macaroonPath, @@ -27,7 +47,6 @@ const setDefaultConfig = () => { theme: 'dark-blue', satsToBTC: false, lndServerUrl: 'https://localhost:8080/v1', - bitcoindConfigPath: bitcoindConfigPath, enableLogging: false, port: 3000 }, @@ -138,7 +157,7 @@ const validateConfigFile = (config) => { let exists = fs.existsSync(common.log_file); if (exists) { fs.writeFile(common.log_file, '', () => { }); - } else if (!exists && config.Authentication.enableLogging) { + } else if ((!exists && config.Authentication.enableLogging) || (!exists && config.Settings.enableLogging)) { try { var dirname = path.dirname(common.log_file); createDirectory(dirname); @@ -146,7 +165,7 @@ const validateConfigFile = (config) => { createStream.end(); } catch (err) { - console.error('Something went wrong: \n' + err); + console.error('Something went wrong while creating log file: \n' + err); } } } @@ -214,7 +233,7 @@ const readCookie = (cookieFile) => { common.cookie = fs.readFileSync(cookieFile, 'utf-8'); } catch(err) { - console.error('Something went wrong: \n' + err); + console.error('Something went wrong while reading cookie: \n' + err); throw new Error(err); } } @@ -262,10 +281,11 @@ connect.configFileExists = () => { var config = ini.parse(fs.readFileSync(RTLConfFile, 'utf-8')); setMacaroonPath(clArgs, config) validateConfigFile(config); - logEnvVariables(); + logEnvVariables(); + // throw new Error('Please change default settings of macaroonPath and lndConfigPath in RTL.conf and restart the server'); } catch(err) { - console.error('Something went wrong: \n' + err); + console.error('Something went wrong while configuring the server: \n' + err); throw new Error(err); } } diff --git a/package.json b/package.json index 4d5fc74a..b0d44302 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "MIT", "scripts": { "ng": "ng", - "start": "ng serve --base-href /rtl/", + "start": "ng serve --base-href /rtl/ --open", "build": "ng build --prod --base-href /rtl/", "serve": "ng serve", "prebuild": "node ./prebuild", diff --git a/RTL-Multi-Node-Conf.json b/sample-RTL-Multi-Node-Conf.json similarity index 87% rename from RTL-Multi-Node-Conf.json rename to sample-RTL-Multi-Node-Conf.json index 21fcf840..f9516920 100644 --- a/RTL-Multi-Node-Conf.json +++ b/sample-RTL-Multi-Node-Conf.json @@ -4,10 +4,10 @@ "LNNode": "LND Testnet # 1", "LNImplementation": "LND", "Authentication": { - "macaroonPath": "/Users/suheb/Downloads", + "macaroonPath": "/Users//", "nodeAuthType": "CUSTOM", "lndConfigPath": "", - "rtlPass": "xxx" + "rtlPass": "" }, "Settings": { "flgSidenavOpened": "true", @@ -32,17 +32,17 @@ "LNNode": "LND Mainnet # 1", "LNImplementation": "LND", "Authentication": { - "macaroonPath": "/Users/suheb/Downloads", + "macaroonPath": "/Users//", "nodeAuthType": "CUSTOM", "lndConfigPath": "", - "rtlPass": "xxx" + "rtlPass": "" }, "Settings": { "flgSidenavOpened": "true", "flgSidenavPinned": "true", "menu": "Vertical", "menuType": "Regular", - "theme": "dark-blue", + "theme": "dark-green", "satsToBTC": "false", "bitcoindConfigPath": "", "enableLogging": "true", diff --git a/src/app/pages/routing-peers/routing-peers.component.html b/src/app/pages/routing-peers/routing-peers.component.html index d136410d..bc8dc1c5 100644 --- a/src/app/pages/routing-peers/routing-peers.component.html +++ b/src/app/pages/routing-peers/routing-peers.component.html @@ -49,8 +49,7 @@ [ngClass]="{'mat-elevation-z8 overflow-auto error-border': flgLoading[0]==='error','mat-elevation-z8 overflow-auto': true}"> Chan Id - {{rPeer.chan_id}} + {{rPeer.chan_id}} Alias diff --git a/src/app/pages/transactions/list-transactions/list-transactions.component.html b/src/app/pages/transactions/list-transactions/list-transactions.component.html index 015c2ebc..e27e45ea 100644 --- a/src/app/pages/transactions/list-transactions/list-transactions.component.html +++ b/src/app/pages/transactions/list-transactions/list-transactions.component.html @@ -33,7 +33,7 @@ Block Hash - {{trans.block_hash | slice:0:10}}... + {{trans.block_hash | removeleadingzeros}} Block Height @@ -41,7 +41,7 @@ Txn Hash -
{{trans.tx_hash | slice:0:10}}...
+ {{trans.tx_hash}}
Amount diff --git a/src/app/pages/transactions/list-transactions/list-transactions.component.scss b/src/app/pages/transactions/list-transactions/list-transactions.component.scss index d798572d..a3690ff3 100644 --- a/src/app/pages/transactions/list-transactions/list-transactions.component.scss +++ b/src/app/pages/transactions/list-transactions/list-transactions.component.scss @@ -17,3 +17,16 @@ table { width:100%; } + +.ellipsis-parent { + min-width: 20px; + display: flex; + padding: 13px 0 13px 12px; +} + +.ellipsis-child { + max-width:97%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/src/app/shared/pipes/remove-leading-zero.pipe.ts b/src/app/shared/pipes/remove-leading-zero.pipe.ts new file mode 100644 index 00000000..ec36436b --- /dev/null +++ b/src/app/shared/pipes/remove-leading-zero.pipe.ts @@ -0,0 +1,12 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'removeleadingzeros' +}) +export class RemoveLeadingZerosPipe implements PipeTransform { + + transform(value: string, args?: any): string { + return value.replace(/^[0]+/g, ''); + } + +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index c2cca0b3..d6d97e17 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -15,6 +15,7 @@ import { NotFoundComponent } from './components/not-found/not-found.component'; import { SettingsNavComponent } from './components/settings-nav/settings-nav.component'; import { ClipboardDirective } from './directive/clipboard.directive'; import { SsoFailedComponent } from './components/sso-failed/sso-failed.component'; +import { RemoveLeadingZerosPipe } from './pipes/remove-leading-zero.pipe'; @NgModule({ imports: [ @@ -82,7 +83,8 @@ import { SsoFailedComponent } from './components/sso-failed/sso-failed.component NotFoundComponent, SettingsNavComponent, ClipboardDirective, - QRCodeModule + QRCodeModule, + RemoveLeadingZerosPipe ], declarations: [ AlertMessageComponent, @@ -91,7 +93,8 @@ import { SsoFailedComponent } from './components/sso-failed/sso-failed.component NotFoundComponent, SettingsNavComponent, ClipboardDirective, - SsoFailedComponent + SsoFailedComponent, + RemoveLeadingZerosPipe ], entryComponents: [ AlertMessageComponent,