Landing page input on getInfo

Landing page input on getInfo
pull/209/head
Shahana Farooqui 5 years ago
parent c6b15bd1a9
commit 2a885f4a8b

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -9,5 +9,5 @@
<link rel="stylesheet" href="styles.486014dd6111683683a1.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.5a8254d67b3de36d3a01.js"></script><script src="polyfills-es5.92f4069201c83f4833ef.js" nomodule></script><script src="polyfills.5ddcccdb990eb395f306.js"></script><script src="main.0e632b40c560865bfa63.js"></script></body>
<script src="runtime.1814289a86602f939cc7.js"></script><script src="polyfills-es5.92f4069201c83f4833ef.js" nomodule></script><script src="polyfills.5ddcccdb990eb395f306.js"></script><script src="main.704cec2a8196592ebe56.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
!function(e){function r(r){for(var n,i,c=r[0],a=r[1],f=r[2],p=0,s=[];p<c.length;p++)o[i=c[p]]&&s.push(o[i][0]),o[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,c=1;c<t.length;c++)0!==o[t[c]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,i.nc&&c.setAttribute("nonce",i.nc),c.src=function(e){return i.p+""+({}[e]||e)+"."+{1:"dc65164c2cc38ecb3ec0",6:"ea6e222fdf7e19de0f64",7:"799b397cc45f59fefe32"}[e]+".js"}(e);var a=new Error;u=function(r){c.onerror=c.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;a.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",a.name="ChunkLoadError",a.type=n,a.request=u,t[1](a)}o[e]=void 0}};var f=setTimeout((function(){u({type:"timeout",target:c})}),12e4);c.onerror=c.onload=u,document.head.appendChild(c)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var c=window.webpackJsonp=window.webpackJsonp||[],a=c.push.bind(c);c.push=r,c=c.slice();for(var f=0;f<c.length;f++)r(c[f]);var l=a;t()}([]);
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)o[i=a[p]]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"."+{1:"dc65164c2cc38ecb3ec0",6:"de7b9a9ea1416e6e0481",7:"788798a1bdee291b94bf"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var l=c;t()}([]);

@ -218,14 +218,16 @@ connect.validateSingleNodeConfig = (config) => {
common.ln_implementation = 'LND';
}
if (undefined !== process.env.RTL_PASS) {
common.rtl_pass = hash.update(process.env.RTL_PASS).digest('hex');
} else if (config.Authentication.rtlPassHashed !== '' && undefined !== config.Authentication.rtlPassHashed) {
common.rtl_pass = config.Authentication.rtlPassHashed;
} else if (config.Authentication.rtlPass !== '' && undefined !== config.Authentication.rtlPass) {
common.rtl_pass = connect.convertCustomToHash('SINGLE');
}
if(!+config.SSO.rtlSSO) {
if (undefined !== process.env.RTL_PASS) {
common.rtl_pass = hash.update(process.env.RTL_PASS).digest('hex');
} else if (config.Authentication.rtlPassHashed !== '' && undefined !== config.Authentication.rtlPassHashed) {
common.rtl_pass = config.Authentication.rtlPassHashed;
} else if (config.Authentication.rtlPass !== '' && undefined !== config.Authentication.rtlPass) {
common.rtl_pass = connect.convertCustomToHash('SINGLE');
}
}
if (upperCase(common.node_auth_type) === 'CUSTOM' && (common.rtl_pass === '' || undefined === common.rtl_pass)) {
errMsg = errMsg + '\nCustom Node Authentication can be set with RTL password only. Please set RTL Password through environment or RTL.conf';
}
@ -269,17 +271,18 @@ connect.validateSingleNodeConfig = (config) => {
}
connect.validateMultiNodeConfig = (config) => {
common.node_auth_type = 'CUSTOM';
if (undefined !== process.env.RTL_PASS) {
common.rtl_pass = hash.update(process.env.RTL_PASS).digest('hex');
} else if (config.multiPassHashed !== '' && undefined !== config.multiPassHashed) {
common.rtl_pass = config.multiPassHashed;
} else if (config.multiPass !== '' && undefined !== config.multiPass) {
common.rtl_pass = connect.convertCustomToHash('MULTI');
} else {
errMsg = errMsg + '\nMulti Node Authentication can be set with multiPass only. Please set MultiPass in RTL-Multi-Node-Conf.json';
if(!+config.SSO.rtlSSO) {
common.node_auth_type = 'CUSTOM';
if (undefined !== process.env.RTL_PASS) {
common.rtl_pass = hash.update(process.env.RTL_PASS).digest('hex');
} else if (config.multiPassHashed !== '' && undefined !== config.multiPassHashed) {
common.rtl_pass = config.multiPassHashed;
} else if (config.multiPass !== '' && undefined !== config.multiPass) {
common.rtl_pass = connect.convertCustomToHash('MULTI');
} else {
errMsg = errMsg + '\nMulti Node Authentication can be set with multiPass only. Please set MultiPass in RTL-Multi-Node-Conf.json';
}
}
common.port = (undefined !== config.port) ? connect.normalizePort(config.port) : 3000;
if (config.nodes && config.nodes.length > 0) {
config.nodes.forEach((node, idx) => {
@ -418,7 +421,7 @@ connect.readCookie = (cookieFile) => {
common.cookie = fs.readFileSync(cookieFile, 'utf-8');
}
catch(err) {
console.error('Something went wrong while reading cookie: \n' + err);
console.error('Something went wrong while reading the cookie: \n' + err);
throw new Error(err);
}
}

@ -34,13 +34,13 @@ export class CLEffects implements OnDestroy {
infoFetchCL = this.actions$.pipe(
ofType(RTLActions.FETCH_INFO_CL),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]) => {
mergeMap(([action, store]: [RTLActions.FetchInfoCL, fromRTLReducer.RootState]) => {
this.store.dispatch(new RTLActions.ClearEffectErrorCl('FetchInfoCL'));
return this.httpClient.get<GetInfoCL>(this.CHILD_API_URL + environment.GETINFO_API)
.pipe(
map((info) => {
this.logger.info(info);
this.initializeRemainingData(info);
this.initializeRemainingData(info, action.payload.loadPage);
return {
type: RTLActions.SET_INFO_CL,
payload: (undefined !== info) ? info : {}
@ -646,7 +646,7 @@ export class CLEffects implements OnDestroy {
})
);
initializeRemainingData(info: any) {
initializeRemainingData(info: any, landingPage: string) {
this.sessionService.setItem('clUnlocked', 'true');
let chainObj = { chain: '', network: '' };
if (info.network === 'testnet') {
@ -680,7 +680,7 @@ export class CLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.FetchFeeRatesCL('perkb'));
this.store.dispatch(new RTLActions.FetchPeersCL());
let newRoute = this.location.path();
if (newRoute.includes('/login') || newRoute.includes('/error') || newRoute === '') {
if (newRoute.includes('/login') || newRoute.includes('/error') || newRoute === '' || landingPage === 'HOME' || newRoute.includes('?access-key=')) {
newRoute = '/cl/home';
} else {
if(newRoute.includes('/lnd/')) {
@ -691,7 +691,7 @@ export class CLEffects implements OnDestroy {
}
handleErrorWithoutAlert(actionName: string, err: { status: number, error: any }) {
this.logger.error(err);
this.logger.error('ERROR IN: ' + actionName + '\n' + JSON.stringify(err));
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
return of({ type: RTLActions.SIGNOUT });

@ -37,7 +37,7 @@ export class LNDEffects implements OnDestroy {
infoFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_INFO),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]) => {
mergeMap(([action, store]: [RTLActions.FetchInfo, fromRTLReducer.RootState]) => {
this.store.dispatch(new RTLActions.ClearEffectErrorLnd('FetchInfo'));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API)
.pipe(
@ -52,7 +52,7 @@ export class LNDEffects implements OnDestroy {
payload: {}
};
} else {
this.initializeRemainingData(info);
this.initializeRemainingData(info, action.payload.loadPage);
return {
type: RTLActions.SET_INFO,
payload: (undefined !== info) ? info : {}
@ -819,8 +819,8 @@ export class LNDEffects implements OnDestroy {
setTimeout(() => {
this.store.dispatch(new RTLActions.CloseSpinner());
this.logger.info('Successfully Initialized!');
this.store.dispatch(new RTLActions.FetchInfo());
this.router.navigate(['/lnd/home']);
this.store.dispatch(new RTLActions.FetchInfo({loadPage: 'HOME'}));
// this.router.navigate(['/lnd/home']);
}, 1000 * 90);
return { type: RTLActions.VOID };
}),
@ -942,7 +942,7 @@ export class LNDEffects implements OnDestroy {
})
);
initializeRemainingData(info: any) {
initializeRemainingData(info: any, landingPage: string) {
this.sessionService.setItem('lndUnlocked', 'true');
if (undefined !== info.chains) {
if (typeof info.chains[0] === 'string') {
@ -979,7 +979,7 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(new RTLActions.FetchInvoices({num_max_invoices: 25, reversed: true}));
this.store.dispatch(new RTLActions.FetchPayments());
let newRoute = this.location.path();
if (newRoute.includes('/unlock') || newRoute.includes('/login') || newRoute.includes('/error') || newRoute === '') {
if (newRoute.includes('/unlock') || newRoute.includes('/login') || newRoute.includes('/error') || newRoute === '' || landingPage === 'HOME' || newRoute.includes('?access-key=')) {
newRoute = '/lnd/home';
} else {
if(newRoute.includes('/cl/')) {
@ -990,7 +990,7 @@ export class LNDEffects implements OnDestroy {
}
handleErrorWithoutAlert(actionName: string, err: { status: number, error: any }) {
this.logger.error(err);
this.logger.error('ERROR IN: ' + actionName + '\n' + JSON.stringify(err));
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
return of({ type: RTLActions.SIGNOUT });
@ -1000,7 +1000,7 @@ export class LNDEffects implements OnDestroy {
}
}
handleErrorWithAlert(alerType: string, alertTitle: string, errURL: string, err: { status: number, error: any }) {
handleErrorWithAlert(alertType: string, alertTitle: string, errURL: string, err: { status: number, error: any }) {
this.logger.error(err);
if (err.status === 401) {
this.logger.info('Redirecting to Signin');
@ -1011,7 +1011,7 @@ export class LNDEffects implements OnDestroy {
type: RTLActions.OPEN_ALERT,
payload: {
width: '70%', data: {
type: alerType, titleMessage: alertTitle,
type: alertType, titleMessage: alertTitle,
message: JSON.stringify({ code: err.status, Message: err.error.error, URL: errURL })
}
}

@ -143,8 +143,8 @@ export class UnlockLNDComponent implements OnInit, OnDestroy {
onGoToHome() {
setTimeout(() => {
this.store.dispatch(new RTLActions.InitAppData());
this.router.navigate(['/lnd/home']);
this.store.dispatch(new RTLActions.FetchInfo({loadPage:'HOME'}));
// this.router.navigate(['/lnd/home']);
}, 1000 * 1);
}

@ -90,7 +90,6 @@ export const IS_AUTHORIZED = 'IS_AUTHORIZED';
export const IS_AUTHORIZED_RES = 'IS_AUTHORIZED_RES';
export const SIGNIN = 'SIGNIN';
export const SIGNOUT = 'SIGNOUT';
export const INIT_APP_DATA = 'INIT_APP_DATA';
export const PEER_LOOKUP = 'PEER_LOOKUP';
export const CHANNEL_LOOKUP = 'CHANNEL_LOOKUP';
export const INVOICE_LOOKUP = 'INVOICE_LOOKUP';
@ -262,6 +261,7 @@ export class SetChildNodeSettings implements Action {
export class FetchInfo implements Action {
readonly type = FETCH_INFO;
constructor(public payload: {loadPage: string}) {}
}
export class SetInfo implements Action {
@ -583,10 +583,6 @@ export class Signout implements Action {
constructor() {}
}
export class InitAppData implements Action {
readonly type = INIT_APP_DATA;
}
export class SetChildNodeSettingsCL implements Action {
readonly type = SET_CHILD_NODE_SETTINGS_CL;
constructor(public payload: SelNodeChild) {}
@ -594,6 +590,7 @@ export class SetChildNodeSettingsCL implements Action {
export class FetchInfoCL implements Action {
readonly type = FETCH_INFO_CL;
constructor(public payload: {loadPage: string}) {}
}
export class SetInfoCL implements Action {
@ -828,7 +825,7 @@ export type RTLActions =
GetNewAddress | SetNewAddress | SetChannelTransaction |
GenSeed | GenSeedResponse | InitWallet | InitWalletResponse | UnlockWallet |
FetchConfig | ShowConfig | PeerLookup | ChannelLookup | InvoiceLookup | SetLookup |
IsAuthorized | IsAuthorizedRes | Signin | Signout | InitAppData |
IsAuthorized | IsAuthorizedRes | Signin | Signout |
SetChildNodeSettingsCL | FetchInfoCL | SetInfoCL | FetchFeesCL | SetFeesCL | FetchFeeRatesCL | SetFeeRatesCL |
FetchBalanceCL | SetBalanceCL | FetchLocalRemoteBalanceCL | SetLocalRemoteBalanceCL |
GetNewAddressCL | SetNewAddressCL |

@ -255,7 +255,7 @@ export class RTLEffects implements OnDestroy {
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(new RTLActions.CloseSpinner());
this.initializeNode(action.payload);
this.initializeNode(action.payload.lnNode, action.payload.isInitialSetup);
return { type: RTLActions.VOID };
}),
catchError((err: any) => {
@ -275,17 +275,20 @@ export class RTLEffects implements OnDestroy {
}
));
initializeNode(node) {
let selNode = { channelBackupPath: node.lnNode.settings.channelBackupPath, satsToBTC: node.lnNode.settings.satsToBTC };
this.store.dispatch(new RTLActions.ResetRootStore(node.lnNode));
initializeNode(node: any, isInitialSetup: boolean) {
const landingPage = isInitialSetup ? '' : 'HOME';
let selNode = { channelBackupPath: node.settings.channelBackupPath, satsToBTC: node.settings.satsToBTC };
this.store.dispatch(new RTLActions.ResetRootStore(node));
this.store.dispatch(new RTLActions.ResetLNDStore(selNode));
this.store.dispatch(new RTLActions.ResetCLStore(selNode));
if(node.lnNode.lnImplementation.toUpperCase() === 'CLT') {
this.CHILD_API_URL = API_URL + '/cl';
this.store.dispatch(new RTLActions.FetchInfoCL());
} else {
this.CHILD_API_URL = API_URL + '/lnd';
this.store.dispatch(new RTLActions.FetchInfo());
if(this.sessionService.getItem('token')) {
if(node.lnImplementation.toUpperCase() === 'CLT') {
this.CHILD_API_URL = API_URL + '/cl';
this.store.dispatch(new RTLActions.FetchInfoCL({loadPage: landingPage}));
} else {
this.CHILD_API_URL = API_URL + '/lnd';
this.store.dispatch(new RTLActions.FetchInfo({loadPage: landingPage}));
}
}
}
@ -293,7 +296,6 @@ export class RTLEffects implements OnDestroy {
if (token) {
this.sessionService.setItem('lndUnlocked', 'true');
this.sessionService.setItem('token', token);
this.store.dispatch(new RTLActions.InitAppData());
} else {
this.sessionService.removeItem('lndUnlocked');
this.sessionService.removeItem('token');

Loading…
Cancel
Save