Unified config models

pull/1382/head
ShahanaFarooqui 4 weeks ago
parent 804b8fea03
commit f67fedce2e

@ -8,7 +8,7 @@ import { Database } from '../../utils/database.js';
import { Logger } from '../../utils/logger.js';
import { Common } from '../../utils/common.js';
import { WSServer } from '../../utils/webSocketServer.js';
import { NodeAuthentication, SSO } from '../../models/config.model.js';
import { Authentication, SSO } from '../../models/config.model.js';
const options = { url: '' };
const logger = Logger;
const common = Common;
@ -32,7 +32,7 @@ export const maskPasswords = (obj) => {
}
return obj;
};
export const removeSensitiveData = (config) => {
export const removeSecureData = (config) => {
delete config.rtlConfFilePath;
delete config.rtlPass;
delete config.multiPass;
@ -46,6 +46,26 @@ export const removeSensitiveData = (config) => {
});
return config;
};
export const addSecureData = (config) => {
config.SSO.rtlCookiePath = common.appConfig.SSO.rtlCookiePath;
config.rtlPass = common.appConfig.rtlPass;
config.multiPass = common.appConfig.multiPass;
config.multiPassHashed = common.appConfig.multiPassHashed;
config.secret2FA = common.appConfig.secret2FA;
config.nodes.map((node, i) => {
if (common.appConfig && common.appConfig.nodes && common.appConfig.nodes.length > i && common.appConfig.nodes[i].Authentication && common.appConfig.nodes[i].Authentication.macaroonPath) {
node.Authentication.macaroonPath = common.appConfig.nodes[i].Authentication.macaroonPath;
}
if (common.appConfig && common.appConfig.nodes && common.appConfig.nodes.length > i && common.appConfig.nodes[i].Authentication && common.appConfig.nodes[i].Authentication.runePath) {
node.Authentication.runePath = common.appConfig.nodes[i].Authentication.runePath;
}
if (common.appConfig && common.appConfig.nodes && common.appConfig.nodes.length > i && common.appConfig.nodes[i].Authentication && common.appConfig.nodes[i].Authentication.lnApiPassword) {
node.Authentication.lnApiPassword = common.appConfig.nodes[i].Authentication.lnApiPassword;
}
return node;
});
return config;
};
export const getCurrencyRates = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Getting Currency Rates..' });
options.url = 'https://blockchain.info/ticker';
@ -88,7 +108,7 @@ export const getApplicationSettings = (req, res, next) => {
return res.status(err.statusCode).json({ message: err.error, error: err.error });
}
else {
const appConfData = removeSensitiveData(JSON.parse(data));
const appConfData = removeSecureData(JSON.parse(data));
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
appConfData.enable2FA = common.appConfig.enable2FA;
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
@ -100,7 +120,7 @@ export const getApplicationSettings = (req, res, next) => {
appConfData.SSO = new SSO();
appConfData.secret2FA = '';
appConfData.dbDirectoryPath = '';
appConfData.nodes[selNodeIdx].Authentication = new NodeAuthentication();
appConfData.nodes[selNodeIdx].Authentication = new Authentication();
delete appConfData.nodes[selNodeIdx].Settings.bitcoindConfigPath;
delete appConfData.nodes[selNodeIdx].Settings.lnServerUrl;
delete appConfData.nodes[selNodeIdx].Settings.swapServerUrl;
@ -212,10 +232,11 @@ export const updateApplicationSettings = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Updating Application Settings..' });
const RTLConfFile = common.appConfig.rtlConfFilePath + sep + 'RTL-Config.json';
try {
fs.writeFileSync(RTLConfFile, JSON.stringify(req.body, null, 2), 'utf-8');
common.appConfig = req.body;
const config = addSecureData(req.body);
fs.writeFileSync(RTLConfFile, JSON.stringify(config, null, 2), 'utf-8');
common.appConfig = config;
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Application Settings Updated', data: maskPasswords(common.appConfig) });
res.status(201).json(removeSensitiveData(common.appConfig));
res.status(201).json(removeSecureData(config));
}
catch (errRes) {
const errMsg = 'Update Default Node Error';

@ -1,4 +1,12 @@
export class NodeSettings {
export class SSO {
constructor(rtlSso, rtlCookiePath, logoutRedirectLink, cookieValue) {
this.rtlSso = rtlSso;
this.rtlCookiePath = rtlCookiePath;
this.logoutRedirectLink = logoutRedirectLink;
this.cookieValue = cookieValue;
}
}
export class Settings {
constructor(lnServerUrl, swapServerUrl, boltzServerUrl, bitcoindConfigPath, channelBackupPath, logLevel, logFile, userPersona, themeMode, themeColor, unannouncedChannels, fiatConversion, currencyUnit, enableOffers, enablePeerswap) {
this.lnServerUrl = lnServerUrl;
this.swapServerUrl = swapServerUrl;
@ -17,7 +25,7 @@ export class NodeSettings {
this.enablePeerswap = enablePeerswap;
}
}
export class NodeAuthentication {
export class Authentication {
constructor(options, configPath, macaroonPath, macaroonValue, runePath, runeValue, lnApiPassword, swapMacaroonPath, boltzMacaroonPath) {
this.options = options;
this.configPath = configPath;
@ -30,27 +38,6 @@ export class NodeAuthentication {
this.boltzMacaroonPath = boltzMacaroonPath;
}
}
export class SelectedNode {
constructor(logLevel, logFile, index, lnNode, lnImplementation, lnVersion, apiVersion, Settings, Authentication) {
this.logLevel = logLevel;
this.logFile = logFile;
this.index = index;
this.lnNode = lnNode;
this.lnImplementation = lnImplementation;
this.lnVersion = lnVersion;
this.apiVersion = apiVersion;
this.Settings = Settings;
this.Authentication = Authentication;
}
}
export class SSO {
constructor(rtlSso, rtlCookiePath, logoutRedirectLink, cookieValue) {
this.rtlSso = rtlSso;
this.rtlCookiePath = rtlCookiePath;
this.logoutRedirectLink = logoutRedirectLink;
this.cookieValue = cookieValue;
}
}
export class ApplicationConfig {
constructor(defaultNodeIndex, selectedNodeIndex, dbDirectoryPath, rtlConfFilePath, rtlPass, multiPass, multiPassHashed, allowPasswordUpdate, enable2FA, secret2FA, SSO, nodes) {
this.defaultNodeIndex = defaultNodeIndex;
@ -67,6 +54,18 @@ export class ApplicationConfig {
this.nodes = nodes;
}
}
export class SelectedNode {
constructor(logLevel, logFile, index, lnNode, lnImplementation, lnVersion, Settings, Authentication) {
this.logLevel = logLevel;
this.logFile = logFile;
this.index = index;
this.lnNode = lnNode;
this.lnImplementation = lnImplementation;
this.lnVersion = lnVersion;
this.Settings = Settings;
this.Authentication = Authentication;
}
}
export class LogJSONObj {
constructor(level, msg, data, error, fileName, selectedNode) {
this.level = level;

@ -8,7 +8,7 @@ import { Database, DatabaseService } from '../../utils/database.js';
import { Logger, LoggerService } from '../../utils/logger.js';
import { Common, CommonService } from '../../utils/common.js';
import { WSServer } from '../../utils/webSocketServer.js';
import { ApplicationConfig, NodeAuthentication, SSO } from '../../models/config.model.js';
import { ApplicationConfig, Authentication, SSO } from '../../models/config.model.js';
const options = { url: '' };
const logger: LoggerService = Logger;
@ -36,7 +36,7 @@ export const maskPasswords = (obj) => {
return obj;
};
export const removeSensitiveData = (config: ApplicationConfig) => {
export const removeSecureData = (config: ApplicationConfig) => {
delete config.rtlConfFilePath;
delete config.rtlPass;
delete config.multiPass;
@ -51,6 +51,27 @@ export const removeSensitiveData = (config: ApplicationConfig) => {
return config;
};
export const addSecureData = (config: ApplicationConfig) => {
config.SSO.rtlCookiePath = common.appConfig.SSO.rtlCookiePath;
config.rtlPass = common.appConfig.rtlPass;
config.multiPass = common.appConfig.multiPass;
config.multiPassHashed = common.appConfig.multiPassHashed;
config.secret2FA = common.appConfig.secret2FA;
config.nodes.map((node, i) => {
if (common.appConfig && common.appConfig.nodes && common.appConfig.nodes.length > i && common.appConfig.nodes[i].Authentication && common.appConfig.nodes[i].Authentication.macaroonPath) {
node.Authentication.macaroonPath = common.appConfig.nodes[i].Authentication.macaroonPath;
}
if (common.appConfig && common.appConfig.nodes && common.appConfig.nodes.length > i && common.appConfig.nodes[i].Authentication && common.appConfig.nodes[i].Authentication.runePath) {
node.Authentication.runePath = common.appConfig.nodes[i].Authentication.runePath;
}
if (common.appConfig && common.appConfig.nodes && common.appConfig.nodes.length > i && common.appConfig.nodes[i].Authentication && common.appConfig.nodes[i].Authentication.lnApiPassword) {
node.Authentication.lnApiPassword = common.appConfig.nodes[i].Authentication.lnApiPassword;
}
return node;
});
return config;
};
export const getCurrencyRates = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Getting Currency Rates..' });
options.url = 'https://blockchain.info/ticker';
@ -91,7 +112,7 @@ export const getApplicationSettings = (req, res, next) => {
const err = common.handleError({ statusCode: 500, message: errMsg, error: errRes }, 'RTLConf', errMsg, req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.error, error: err.error });
} else {
const appConfData = removeSensitiveData(JSON.parse(data));
const appConfData = removeSecureData(JSON.parse(data));
appConfData.allowPasswordUpdate = common.appConfig.allowPasswordUpdate;
appConfData.enable2FA = common.appConfig.enable2FA;
appConfData.selectedNodeIndex = (req.session.selectedNode && req.session.selectedNode.index ? req.session.selectedNode.index : common.selectedNode.index);
@ -103,7 +124,7 @@ export const getApplicationSettings = (req, res, next) => {
appConfData.SSO = new SSO();
appConfData.secret2FA = '';
appConfData.dbDirectoryPath = '';
appConfData.nodes[selNodeIdx].Authentication = new NodeAuthentication();
appConfData.nodes[selNodeIdx].Authentication = new Authentication();
delete appConfData.nodes[selNodeIdx].Settings.bitcoindConfigPath;
delete appConfData.nodes[selNodeIdx].Settings.lnServerUrl;
delete appConfData.nodes[selNodeIdx].Settings.swapServerUrl;
@ -216,10 +237,11 @@ export const updateApplicationSettings = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Updating Application Settings..' });
const RTLConfFile = common.appConfig.rtlConfFilePath + sep + 'RTL-Config.json';
try {
fs.writeFileSync(RTLConfFile, JSON.stringify(req.body, null, 2), 'utf-8');
common.appConfig = req.body;
const config = addSecureData(req.body);
fs.writeFileSync(RTLConfFile, JSON.stringify(config, null, 2), 'utf-8');
common.appConfig = config;
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'RTLConf', msg: 'Application Settings Updated', data: maskPasswords(common.appConfig) });
res.status(201).json(removeSensitiveData(common.appConfig));
res.status(201).json(removeSecureData(config));
} catch (errRes) {
const errMsg = 'Update Default Node Error';
const err = common.handleError({ statusCode: 500, message: errMsg, error: errRes }, 'RTLConf', errMsg, req.session.selectedNode);

@ -1,4 +1,15 @@
export class NodeSettings {
export class SSO {
constructor(
public rtlSso?: number,
public rtlCookiePath?: string,
public logoutRedirectLink?: string,
public cookieValue?: string
) { }
}
export class Settings {
constructor(
public lnServerUrl?: string,
@ -20,7 +31,7 @@ export class NodeSettings {
}
export class NodeAuthentication {
export class Authentication {
constructor(
public options?: any,
@ -36,33 +47,6 @@ export class NodeAuthentication {
}
export class SelectedNode {
constructor(
public logLevel?: string,
public logFile?: string,
public index?: number,
public lnNode?: string,
public lnImplementation?: string,
public lnVersion?: string,
public apiVersion?: string,
public Settings?: NodeSettings,
public Authentication?: NodeAuthentication
) { }
}
export class SSO {
constructor(
public rtlSso?: number,
public rtlCookiePath?: string,
public logoutRedirectLink?: string,
public cookieValue?: string
) { }
}
export class ApplicationConfig {
constructor(
@ -82,6 +66,21 @@ export class ApplicationConfig {
}
export class SelectedNode {
constructor(
public logLevel?: string,
public logFile?: string,
public index?: number,
public lnNode?: string,
public lnImplementation?: string,
public lnVersion?: string,
public Settings?: Settings,
public Authentication?: Authentication
) { }
}
export class LogJSONObj {
constructor(

@ -1,4 +1,4 @@
<div fxLayout="column" id="rtl-container" class="rtl-container medium" [ngClass]="[settings.themeColor | lowercase, settings.themeMode | lowercase]">
<div fxLayout="column" id="rtl-container" class="rtl-container medium" [ngClass]="[selNode.Settings.themeColor | lowercase, selNode.Settings.themeMode | lowercase]">
<mat-toolbar fxLayout="row" fxLayoutAlign="space-between center" class="bg-primary rtl-top-toolbar">
<div>
<button *ngIf="flgLoggedIn" mat-icon-button matTooltipPosition="right" [matTooltip]="flgSideNavOpened ? 'Hide Navigation Menu' : 'Show Navigation Menu'" [matTooltipDisabled]="smallScreen" (click)="sideNavToggle()">
@ -29,7 +29,7 @@
</div>
</mat-sidenav-content>
</mat-sidenav-container>
<div *ngIf="!settings.themeColor" class="rtl-spinner">
<div *ngIf="!selNode.Settings.themeColor" class="rtl-spinner">
<mat-spinner color="accent" />
<h4>Loading RTL...</h4>
</div>

@ -14,7 +14,7 @@ import { CommonService } from './shared/services/common.service';
import { SessionService } from './shared/services/session.service';
import { AlertTypeEnum, RTLActions, ScreenSizeEnum } from './shared/services/consts-enums-functions';
import { rootAppConfig, rootNodeData, rootSelectedNode } from './store/rtl.selector';
import { RTLConfiguration, Settings, GetInfoRoot } from './shared/models/RTLconfig';
import { RTLConfiguration, GetInfoRoot } from './shared/models/RTLconfig';
import { closeAllDialogs, fetchRTLConfig, login, logout, openAlert } from './store/rtl.actions';
import { routeAnimation } from './shared/animation/route-animation';
@ -30,11 +30,11 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('sideNavigation', { static: false }) sideNavigation: any;
@ViewChild('sideNavContent', { static: false }) sideNavContent: any;
public settings: Settings;
public information: GetInfoRoot = {};
public flgLoading: Array<Boolean | 'error'> = [true]; // 0: Info
public flgSideNavOpened = true;
public flgCopied = false;
public selNode: Node | any;
public appConfig: RTLConfiguration;
public accessKey = '';
public xSmallScreen = false;
@ -78,7 +78,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
this.store.dispatch(fetchRTLConfig());
this.accessKey = this.readAccessKey() || '';
this.store.select(rootSelectedNode).pipe(takeUntil(this.unSubs[1])).subscribe((selNode) => {
this.settings = selNode.settings;
if (!this.sessionService.getItem('token')) {
this.flgLoggedIn = false;
this.flgLoading[0] = false;
@ -86,6 +85,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
this.flgLoggedIn = true;
this.userIdle.startWatching();
}
this.selNode = selNode;
});
this.store.select(rootAppConfig).pipe(takeUntil(this.unSubs[2])).subscribe((appConfig) => { this.appConfig = appConfig; });
this.store.select(rootNodeData).pipe(takeUntil(this.unSubs[3])).subscribe((nodeData) => {

@ -8,7 +8,7 @@
</perfect-scrollbar>
</mat-select>
<mat-divider class="w-100" />
<mat-tree *ngIf="settings?.lnServerUrl" #tree [dataSource]="navMenus" [treeControl]="treeControlNested">
<mat-tree *ngIf="selNode.Settings?.lnServerUrl" #tree [dataSource]="navMenus" [treeControl]="treeControlNested">
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle routerLinkActive="active-link" routerLink="{{node.link}}">
<div tabindex="2" (click)="onChildNavClicked(node)">
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start center">

@ -35,7 +35,6 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
public appConfig: RTLConfiguration;
public selConfigNodeIndex: Number;
public selNode: Node | any;
public settings: Settings | null;
public version = '';
public information: GetInfoRoot = {};
public informationChain: GetInfoChain = {};
@ -93,7 +92,6 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
this.smallScreen = true;
}
this.selNode = rootData.selNode;
this.settings = this.selNode?.settings || null;
this.selConfigNodeIndex = +(rootData.selNode?.index || 0);
if (this.selNode && this.selNode.lnImplementation) {
this.filterSideMenuNodes();
@ -162,12 +160,12 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
clonedMenu = JSON.parse(JSON.stringify(MENU_DATA.LNDChildren));
this.navMenus.data = clonedMenu?.filter((navMenuData: any) => {
if (navMenuData.children && navMenuData.children.length) {
navMenuData.children = navMenuData.children?.filter((navMenuChild) => ((navMenuChild.userPersona === UserPersonaEnum.ALL || navMenuChild.userPersona === this.settings?.userPersona) && navMenuChild.link !== '/services/loop' && navMenuChild.link !== '/services/boltz') ||
(navMenuChild.link === '/services/loop' && this.settings?.swapServerUrl && this.settings.swapServerUrl.trim() !== '') ||
(navMenuChild.link === '/services/boltz' && this.settings?.boltzServerUrl && this.settings.boltzServerUrl.trim() !== ''));
navMenuData.children = navMenuData.children?.filter((navMenuChild) => ((navMenuChild.userPersona === UserPersonaEnum.ALL || navMenuChild.userPersona === this.selNode.Settings.userPersona) && navMenuChild.link !== '/services/loop' && navMenuChild.link !== '/services/boltz') ||
(navMenuChild.link === '/services/loop' && this.selNode.Settings.swapServerUrl && this.selNode.Settings.swapServerUrl.trim() !== '') ||
(navMenuChild.link === '/services/boltz' && this.selNode.Settings.boltzServerUrl && this.selNode.Settings.boltzServerUrl.trim() !== ''));
return navMenuData.children.length > 0;
}
return navMenuData.userPersona === UserPersonaEnum.ALL || navMenuData.userPersona === this.settings?.userPersona;
return navMenuData.userPersona === UserPersonaEnum.ALL || navMenuData.userPersona === this.selNode.Settings.userPersona;
});
}
@ -176,12 +174,12 @@ export class SideNavigationComponent implements OnInit, OnDestroy {
clonedMenu = JSON.parse(JSON.stringify(MENU_DATA.CLNChildren));
this.navMenus.data = clonedMenu?.filter((navMenuData: any) => {
if (navMenuData.children && navMenuData.children.length) {
navMenuData.children = navMenuData.children?.filter((navMenuChild) => ((navMenuChild.userPersona === UserPersonaEnum.ALL || navMenuChild.userPersona === this.settings?.userPersona) && navMenuChild.link !== '/services/peerswap') ||
(navMenuChild.link === '/services/peerswap' && this.settings?.enablePeerswap) ||
(navMenuChild.link === '/services/boltz' && this.settings?.boltzServerUrl && this.settings.boltzServerUrl.trim() !== ''));
navMenuData.children = navMenuData.children?.filter((navMenuChild) => ((navMenuChild.userPersona === UserPersonaEnum.ALL || navMenuChild.userPersona === this.selNode.Settings.userPersona) && navMenuChild.link !== '/services/peerswap') ||
(navMenuChild.link === '/services/peerswap' && this.selNode.Settings.enablePeerswap) ||
(navMenuChild.link === '/services/boltz' && this.selNode.Settings.boltzServerUrl && this.selNode.Settings.boltzServerUrl.trim() !== ''));
return navMenuData.children.length > 0;
}
return navMenuData.userPersona === UserPersonaEnum.ALL || navMenuData.userPersona === this.settings?.userPersona;
return navMenuData.userPersona === UserPersonaEnum.ALL || navMenuData.userPersona === this.selNode.Settings.userPersona;
});
}

@ -59,7 +59,7 @@ export class NodeConfigComponent implements OnInit, OnDestroy {
this.lnImplementationStr = 'LND Config';
break;
}
if (this.selNode.authentication && this.selNode.authentication.configPath && this.selNode.authentication.configPath.trim() !== '') {
if (this.selNode.Authentication && this.selNode.Authentication.configPath && this.selNode.Authentication.configPath.trim() !== '') {
this.links[4].name = this.lnImplementationStr;
this.showLnConfig = true;
}

@ -54,7 +54,7 @@ export class NodeSettingsComponent implements OnInit, OnDestroy {
if (!this.selNode.Settings.fiatConversion) {
this.selNode.Settings.currencyUnit = '';
}
this.previousSettings = JSON.parse(JSON.stringify(this.selNode.settings));
this.previousSettings = JSON.parse(JSON.stringify(this.selNode.Settings));
this.logger.info(selNode);
});
}
@ -85,7 +85,7 @@ export class NodeSettingsComponent implements OnInit, OnDestroy {
}
toggleSettings(toggleField: string, event?: any) {
this.selNode.settings[toggleField] = !this.selNode.settings[toggleField];
this.selNode.Settings[toggleField] = !this.selNode.Settings[toggleField];
}
changeThemeColor(newThemeColor: string) {
@ -101,7 +101,7 @@ export class NodeSettingsComponent implements OnInit, OnDestroy {
if (this.selNode.Settings.fiatConversion && !this.selNode.Settings.currencyUnit) {
return true;
}
this.logger.info(this.selNode.settings);
this.logger.info(this.selNode.Settings);
this.store.dispatch(setChildNodeSettingsLND({
payload: {
userPersona: this.selNode.Settings.userPersona, channelBackupPath: this.selNode.Settings.channelBackupPath,
@ -130,7 +130,7 @@ export class NodeSettingsComponent implements OnInit, OnDestroy {
onResetSettings() {
const prevIndex = this.selNode.index || -1;
this.selNode.settings = this.previousSettings;
this.selNode.Settings = this.previousSettings;
this.selectedThemeMode = this.themeModes.find((themeMode) => themeMode.id === this.previousSettings.themeMode) || this.themeModes[0];
this.selectedThemeColor = this.previousSettings.themeColor;
this.store.dispatch(setSelectedNode({ payload: { uiMessage: UI_MESSAGES.NO_SPINNER, prevLnNodeIndex: +prevIndex, currentLnNode: this.selNode, isInitialSetup: true } }));

@ -39,7 +39,7 @@ export class BoltzServiceSettingsComponent implements OnInit, OnDestroy {
this.selNode = selNode;
this.enableBoltz = !!(selNode.Settings.boltzServerUrl && selNode.Settings.boltzServerUrl.trim() !== '');
this.serverUrl = this.selNode.Settings.boltzServerUrl || '';
this.macaroonPath = this.selNode.authentication.boltzMacaroonPath;
this.macaroonPath = this.selNode.Authentication.boltzMacaroonPath;
this.previousSelNode = JSON.parse(JSON.stringify(this.selNode));
this.logger.info(selNode);
});
@ -68,7 +68,7 @@ export class BoltzServiceSettingsComponent implements OnInit, OnDestroy {
}
this.logger.info(this.selNode);
this.selNode.Settings.boltzServerUrl = this.serverUrl;
this.selNode.authentication.boltzMacaroonPath = this.macaroonPath;
this.selNode.Authentication.boltzMacaroonPath = this.macaroonPath;
// this.store.dispatch(updateNodeSettings({ payload: { uiMessage: UI_MESSAGES.UPDATE_BOLTZ_SETTINGS, service: ServicesEnum.BOLTZ, settings: { enable: this.enableBoltz, serverUrl: this.serverUrl, macaroonPath: this.macaroonPath } } }));
// this.store.dispatch(setChildNodeSettingsLND({
// payload: {
@ -93,7 +93,7 @@ export class BoltzServiceSettingsComponent implements OnInit, OnDestroy {
onReset() {
this.selNode = JSON.parse(JSON.stringify(this.previousSelNode));
this.serverUrl = this.selNode.Settings.boltzServerUrl || '';
this.macaroonPath = this.selNode.authentication.boltzMacaroonPath;
this.macaroonPath = this.selNode.Authentication.boltzMacaroonPath;
this.enableBoltz = !!(this.serverUrl && this.serverUrl.trim() !== '');
}

@ -15,9 +15,9 @@
</mat-form-field>
<mat-form-field>
<mat-label>Loop Macaroon Path</mat-label>
<input matInput type="text" id="swapMacaroonPath" name="swapMacaroonPath" tabindex="3" [required]="enableLoop" [disabled]="!enableLoop" [(ngModel)]="selNode.authentication.swapMacaroonPath">
<input matInput type="text" id="swapMacaroonPath" name="swapMacaroonPath" tabindex="3" [required]="enableLoop" [disabled]="!enableLoop" [(ngModel)]="selNode.Authentication.swapMacaroonPath">
<mat-hint>Path for the folder containing service 'loop.macaroon', eg. D:\\xyz\\AppData\\Local\\Loop\\testnet</mat-hint>
<mat-error *ngIf="!selNode.authentication.swapMacaroonPath && enableLoop">Loop macaroon path is required.</mat-error>
<mat-error *ngIf="!selNode.Authentication.swapMacaroonPath && enableLoop">Loop macaroon path is required.</mat-error>
</mat-form-field>
</div>
</form>

@ -44,7 +44,7 @@ export class LoopServiceSettingsComponent implements OnInit, OnDestroy {
onEnableServiceChanged(event) {
this.enableLoop = event.checked;
if (!this.enableLoop) {
this.selNode.authentication.swapMacaroonPath = '';
this.selNode.Authentication.swapMacaroonPath = '';
this.selNode.Settings.swapServerUrl = '';
}
}
@ -53,11 +53,11 @@ export class LoopServiceSettingsComponent implements OnInit, OnDestroy {
if (this.selNode.Settings.swapServerUrl && this.selNode.Settings.swapServerUrl.trim() !== '' && !this.form.controls.srvrUrl.value.includes('https://')) {
this.form.controls.srvrUrl.setErrors({ invalid: true });
}
if (this.enableLoop && (!this.selNode.Settings.swapServerUrl || this.selNode.Settings.swapServerUrl.trim() === '' || !this.selNode.authentication.swapMacaroonPath || this.selNode.authentication.swapMacaroonPath.trim() === '')) {
if (this.enableLoop && (!this.selNode.Settings.swapServerUrl || this.selNode.Settings.swapServerUrl.trim() === '' || !this.selNode.Authentication.swapMacaroonPath || this.selNode.Authentication.swapMacaroonPath.trim() === '')) {
return true;
}
this.logger.info(this.selNode);
// this.store.dispatch(updateNodeSettings({ payload: { uiMessage: UI_MESSAGES.UPDATE_LOOP_SETTINGS, service: ServicesEnum.LOOP, settings: { enable: this.enableLoop, serverUrl: this.selNode.Settings.swapServerUrl, macaroonPath: this.selNode.authentication.swapMacaroonPath } } }));
// this.store.dispatch(updateNodeSettings({ payload: { uiMessage: UI_MESSAGES.UPDATE_LOOP_SETTINGS, service: ServicesEnum.LOOP, settings: { enable: this.enableLoop, serverUrl: this.selNode.Settings.swapServerUrl, macaroonPath: this.selNode.Authentication.swapMacaroonPath } } }));
// this.store.dispatch(setChildNodeSettingsLND({
// payload: {
// userPersona: this.selNode.Settings.userPersona, channelBackupPath: this.selNode.Settings.channelBackupPath, selCurrencyUnit: this.selNode.Settings.currencyUnit, currencyUnits: this.selNode.Settings.currencyUnits, fiatConversion: this.selNode.Settings.fiatConversion,

@ -8,11 +8,11 @@
<mat-card>
<mat-card-content fxLayout="column">
<nav mat-tab-nav-bar mat-stretch-tabs="false" mat-align-tabs="start" [tabPanel]="tabPanel">
<div *ngIf="selNode?.settings?.swapServerUrl?.trim() !== ''" tabindex="1" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[0].link" routerLink="{{links[0].link}}" (click)="activeLink = links[0].link">{{links[0].name}}</div>
<div *ngIf="selNode?.settings?.boltzServerUrl?.trim() !== ''" tabindex="2" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[1].link" routerLink="{{links[1].link}}" [state]="{ initial: false }" (click)="activeLink = links[1].link">{{links[1].name}}</div>
<!-- <div *ngIf="selNode?.settings?.enablePeerswap" tabindex="3" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[2].link" routerLink="{{links[2].link}}" (click)="activeLink = links[2].link">{{links[2].name}}</div> -->
<!-- <div *ngIf="selNode?.settings?.swapServerUrl?.trim() === '' && selNode?.settings?.boltzServerUrl?.trim() === '' && !selNode?.settings?.enablePeerswap" tabindex="4" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[3].link" routerLink="{{links[3].link}}" (click)="activeLink = links[3].link">{{links[3].name}}</div> -->
<div *ngIf="selNode?.settings?.swapServerUrl?.trim() === '' && selNode?.settings?.boltzServerUrl?.trim() === ''" tabindex="3" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[2].link" routerLink="{{links[2].link}}" (click)="activeLink = links[2].link">{{links[2].name}}</div>
<div *ngIf="selNode?.Settings?.swapServerUrl?.trim() !== ''" tabindex="1" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[0].link" routerLink="{{links[0].link}}" (click)="activeLink = links[0].link">{{links[0].name}}</div>
<div *ngIf="selNode?.Settings?.boltzServerUrl?.trim() !== ''" tabindex="2" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[1].link" routerLink="{{links[1].link}}" [state]="{ initial: false }" (click)="activeLink = links[1].link">{{links[1].name}}</div>
<!-- <div *ngIf="selNode?.Settings?.enablePeerswap" tabindex="3" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[2].link" routerLink="{{links[2].link}}" (click)="activeLink = links[2].link">{{links[2].name}}</div> -->
<!-- <div *ngIf="selNode?.Settings?.swapServerUrl?.trim() === '' && selNode?.Settings?.boltzServerUrl?.trim() === '' && !selNode?.Settings?.enablePeerswap" tabindex="4" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[3].link" routerLink="{{links[3].link}}" (click)="activeLink = links[3].link">{{links[3].name}}</div> -->
<div *ngIf="selNode?.Settings?.swapServerUrl?.trim() === '' && selNode?.Settings?.boltzServerUrl?.trim() === ''" tabindex="3" role="tab" mat-tab-link class="mat-tab-label" [active]="activeLink === links[2].link" routerLink="{{links[2].link}}" (click)="activeLink = links[2].link">{{links[2].name}}</div>
</nav>
<mat-tab-nav-panel #tabPanel />
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" class="mat-tab-body-wrapper">

@ -40,7 +40,7 @@ export class ServicesSettingsComponent implements OnInit, OnDestroy {
}
setActiveLink() {
if (this.selNode && this.selNode.settings) {
if (this.selNode && this.selNode.Settings) {
if (this.selNode.Settings.swapServerUrl && this.selNode.Settings.swapServerUrl.trim() !== '') {
this.activeLink = this.links[0].link;
} else if (this.selNode.Settings.boltzServerUrl && this.selNode.Settings.boltzServerUrl.trim() !== '') {

@ -42,7 +42,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
this.store.select(rootSelectedNode).pipe(takeUntil(this.unSubs[2])).subscribe((selNode) => {
this.showBitcoind = false;
this.selNode = selNode;
if (this.selNode.settings && this.selNode.Settings.bitcoindConfigPath && this.selNode.Settings.bitcoindConfigPath.trim() !== '') {
if (this.selNode.Settings && this.selNode.Settings.bitcoindConfigPath && this.selNode.Settings.bitcoindConfigPath.trim() !== '') {
this.showBitcoind = true;
}
});

@ -41,18 +41,6 @@ export class Authentication {
}
export class Node {
constructor(
public Settings: Settings,
public Authentication: Authentication,
public index?: number,
public lnNode?: string,
public lnImplementation?: string
) { }
}
export class RTLConfiguration {
constructor(
@ -67,6 +55,18 @@ export class RTLConfiguration {
}
export class Node {
constructor(
public Settings: Settings,
public Authentication: Authentication,
public index?: number,
public lnNode?: string,
public lnImplementation?: string
) { }
}
export interface GetInfoRoot {
identity_pubkey?: string;
alias?: string;

@ -250,13 +250,13 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(openSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'UpdateNodeSettings', status: APICallStatusEnum.INITIATED } }));
const updateSettingReq = new Observable();
// if (action.payload.settings && action.payload.defaultNodeIndex) {
// const settingsRes = this.httpClient.post<Settings>(API_END_POINTS.CONF_API, { UpdateNodeSettings: action.payload.settings });
// if (action.payload.Settings && action.payload.defaultNodeIndex) {
// const settingsRes = this.httpClient.post<Settings>(API_END_POINTS.CONF_API, { UpdateNodeSettings: action.payload.Settings });
// const defaultNodeRes = this.httpClient.post(API_END_POINTS.CONF_API + '/node', { defaultNodeIndex: action.payload.defaultNodeIndex });
// updateSettingReq = forkJoin([settingsRes, defaultNodeRes]);
// } else if (action.payload.settings && !action.payload.defaultNodeIndex) {
// updateSettingReq = this.httpClient.post(API_END_POINTS.CONF_API, { UpdateNodeSettings: action.payload.settings });
// } else if (!action.payload.settings && action.payload.defaultNodeIndex) {
// } else if (action.payload.Settings && !action.payload.defaultNodeIndex) {
// updateSettingReq = this.httpClient.post(API_END_POINTS.CONF_API, { UpdateNodeSettings: action.payload.Settings });
// } else if (!action.payload.Settings && action.payload.defaultNodeIndex) {
// updateSettingReq = this.httpClient.post(API_END_POINTS.CONF_API + '/node', { defaultNodeIndex: action.payload.defaultNodeIndex });
// }
return updateSettingReq.pipe(map((updateStatus: any) => {

@ -20,7 +20,7 @@ const initNodeAuthentication = { configPath: '', swapMacaroonPath: '', boltzMaca
export const initRootState: RootState = {
apiURL: '',
apisCallStatus: { Login: { status: APICallStatusEnum.UN_INITIATED }, IsAuthorized: { status: APICallStatusEnum.UN_INITIATED } },
selNode: { index: 1, lnNode: 'Node 1', settings: initNodeSettings, authentication: initNodeAuthentication, lnImplementation: 'LND' },
selNode: { index: 1, lnNode: 'Node 1', Settings: initNodeSettings, Authentication: initNodeAuthentication, lnImplementation: 'LND' },
appConfig: {
defaultNodeIndex: -1,
selectedNodeIndex: -1,

Loading…
Cancel
Save