Functional Route Guard

Functional Route Guard
pull/1248/head
Shahana Farooqui 11 months ago
parent 6a72950fbe
commit cea4c9dec4

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

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

@ -10,9 +10,9 @@
<link i18n-rel="" rel="mask-icon" href="assets/images/favicon-light/safari-pinned-tab.svg" color="#5bbad5">
<meta i18n-content="" name="msapplication-TileColor" content="#da532c">
<meta i18n-content="" name="theme-color" content="#ffffff">
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:95%}@media only screen and (max-width: 56.25em){html{font-size:90%}}@media only screen and (max-width: 37.5em){html{font-size:80%}}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}</style><link rel="stylesheet" href="styles.b8517c06fec8ff5b.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.b8517c06fec8ff5b.css"></noscript></head>
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:95%}@media only screen and (max-width: 56.25em){html{font-size:90%}}@media only screen and (max-width: 37.5em){html{font-size:80%}}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}</style><link rel="stylesheet" href="styles.a04c018645a5044a.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.a04c018645a5044a.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.4e09381a0ca9f8c5.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.a8d0423aed5824d7.js" type="module"></script>
<script src="runtime.2136ac2986261ec4.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.3ccfe42677016a42.js" type="module"></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

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
(()=>{"use strict";var e,v={},m={};function r(e){var o=m[e];if(void 0!==o)return o.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(o,t,i,f)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,f]=e[n],s=!0,l=0;l<t.length;l++)(!1&f||a>=f)&&Object.keys(r.O).every(b=>r.O[b](t[l]))?t.splice(l--,1):(s=!1,f<a&&(a=f));if(s){e.splice(n--,1);var d=i();void 0!==d&&(o=d)}}return o}f=f||0;for(var n=e.length;n>0&&e[n-1][2]>f;n--)e[n]=e[n-1];e[n]=[t,i,f]},r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((o,t)=>(r.f[t](e,o),o),[])),r.u=e=>e+"."+{167:"bba0ab48235f9054",267:"5508f97536cb5708",315:"d20113f8d2f54786",636:"8e6af702364d1f11"}[e]+".js",r.miniCssF=e=>{},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={},o="RTLApp:";r.l=(t,i,f,n)=>{if(e[t])e[t].push(i);else{var a,s;if(void 0!==f)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==o+f){a=u;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",o+f),a.src=r.tu(t)),e[t]=[i];var c=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),s&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:o=>o},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,f)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)f.push(n[2]);else if(666!=i){var a=new Promise((u,c)=>n=e[i]=[u,c]);f.push(n[2]=a);var s=r.p+r.u(i),l=new Error;r.l(s,u=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var c=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;l.message="Loading chunk "+i+" failed.\n("+c+": "+p+")",l.name="ChunkLoadError",l.type=c,l.request=p,n[1](l)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var o=(i,f)=>{var l,d,[n,a,s]=f,u=0;if(n.some(p=>0!==e[p])){for(l in a)r.o(a,l)&&(r.m[l]=a[l]);if(s)var c=s(r)}for(i&&i(f);u<n.length;u++)r.o(e,d=n[u])&&e[d]&&e[d][0](),e[d]=0;return r.O(c)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})()})();

@ -1 +0,0 @@
(()=>{"use strict";var e,v={},m={};function r(e){var f=m[e];if(void 0!==f)return f.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(f,t,i,o)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,o]=e[n],c=!0,l=0;l<t.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[l]))?t.splice(l--,1):(c=!1,o<a&&(a=o));if(c){e.splice(n--,1);var d=i();void 0!==d&&(f=d)}}return f}o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[t,i,o]},r.d=(e,f)=>{for(var t in f)r.o(f,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:f[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((f,t)=>(r.f[t](e,f),f),[])),r.u=e=>e+"."+{167:"0a9eb98ff4d99d80",267:"3689ab295fbf3315",315:"9579a11e45886597",636:"0b59d6feb16561e4"}[e]+".js",r.miniCssF=e=>{},r.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),(()=>{var e={},f="RTLApp:";r.l=(t,i,o,n)=>{if(e[t])e[t].push(i);else{var a,c;if(void 0!==o)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==f+o){a=u;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",f+o),a.src=r.tu(t)),e[t]=[i];var s=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:f=>f},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,o)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)o.push(n[2]);else if(666!=i){var a=new Promise((u,s)=>n=e[i]=[u,s]);o.push(n[2]=a);var c=r.p+r.u(i),l=new Error;r.l(c,u=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var s=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;l.message="Loading chunk "+i+" failed.\n("+s+": "+p+")",l.name="ChunkLoadError",l.type=s,l.request=p,n[1](l)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var f=(i,o)=>{var l,d,[n,a,c]=o,u=0;if(n.some(p=>0!==e[p])){for(l in a)r.o(a,l)&&(r.m[l]=a[l]);if(c)var s=c(r)}for(i&&i(o);u<n.length;u++)r.o(e,d=n[u])&&e[d]&&e[d][0](),e[d]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(f.bind(null,0)),t.push=f.bind(null,t.push.bind(t))})()})();

File diff suppressed because one or more lines are too long

@ -57,7 +57,7 @@ if (isDevMode()) { isDevEnvironemt = true; }
declarations: [AppComponent],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
AuthGuard, SessionService, DataService, WebSocketClientService, LoopService, CommonService, BoltzService
SessionService, DataService, WebSocketClientService, LoopService, CommonService, BoltzService
],
bootstrap: [AppComponent]
})

@ -26,35 +26,35 @@ type PathMatch = 'full' | 'prefix' | undefined;
export const routes: Routes = [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'login' },
{ path: 'lnd', loadChildren: () => import('./lnd/lnd.module').then((childModule) => childModule.LNDModule), canActivate: [AuthGuard] },
{ path: 'cln', loadChildren: () => import('./cln/cln.module').then((childModule) => childModule.CLNModule), canActivate: [AuthGuard] },
{ path: 'ecl', loadChildren: () => import('./eclair/ecl.module').then((childModule) => childModule.ECLModule), canActivate: [AuthGuard] },
{ path: 'lnd', loadChildren: () => import('./lnd/lnd.module').then((childModule) => childModule.LNDModule), canActivate: [AuthGuard()] },
{ path: 'cln', loadChildren: () => import('./cln/cln.module').then((childModule) => childModule.CLNModule), canActivate: [AuthGuard()] },
{ path: 'ecl', loadChildren: () => import('./eclair/ecl.module').then((childModule) => childModule.ECLModule), canActivate: [AuthGuard()] },
{
path: 'settings', component: SettingsComponent, canActivate: [AuthGuard], children: [
path: 'settings', component: SettingsComponent, canActivate: [AuthGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'app' },
{ path: 'app', component: AppSettingsComponent, canActivate: [AuthGuard] },
{ path: 'auth', component: AuthSettingsComponent, canActivate: [AuthGuard] },
{ path: 'bconfig', component: BitcoinConfigComponent, canActivate: [AuthGuard] }
{ path: 'app', component: AppSettingsComponent, canActivate: [AuthGuard()] },
{ path: 'auth', component: AuthSettingsComponent, canActivate: [AuthGuard()] },
{ path: 'bconfig', component: BitcoinConfigComponent, canActivate: [AuthGuard()] }
]
},
{
path: 'config', component: NodeConfigComponent, canActivate: [AuthGuard], children: [
path: 'config', component: NodeConfigComponent, canActivate: [AuthGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'nodesettings' },
{ path: 'nodesettings', component: NodeSettingsComponent, canActivate: [AuthGuard] },
{ path: 'pglayout', component: PageSettingsComponent, canActivate: [AuthGuard] },
{ path: 'nodesettings', component: NodeSettingsComponent, canActivate: [AuthGuard()] },
{ path: 'pglayout', component: PageSettingsComponent, canActivate: [AuthGuard()] },
{
path: 'services', component: ServicesSettingsComponent, canActivate: [AuthGuard], children: [
path: 'services', component: ServicesSettingsComponent, canActivate: [AuthGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'loop' },
{ path: 'loop', component: LoopServiceSettingsComponent, canActivate: [AuthGuard] },
{ path: 'boltz', component: BoltzServiceSettingsComponent, canActivate: [AuthGuard] }
{ path: 'loop', component: LoopServiceSettingsComponent, canActivate: [AuthGuard()] },
{ path: 'boltz', component: BoltzServiceSettingsComponent, canActivate: [AuthGuard()] }
]
},
{ path: 'experimental', component: ExperimentalSettingsComponent, canActivate: [AuthGuard] },
{ path: 'lnconfig', component: LNPConfigComponent, canActivate: [AuthGuard] }
{ path: 'experimental', component: ExperimentalSettingsComponent, canActivate: [AuthGuard()] },
{ path: 'lnconfig', component: LNPConfigComponent, canActivate: [AuthGuard()] }
]
},
{
path: 'services', component: LNServicesComponent, canActivate: [AuthGuard], children: [
path: 'services', component: LNServicesComponent, canActivate: [AuthGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'loop' },
{ path: 'loop', pathMatch: <PathMatch>'full', redirectTo: 'loop/loopout' },
{ path: 'loop/:selTab', component: LoopComponent },

@ -125,9 +125,7 @@ import { CLNUnlockedGuard } from '../shared/services/auth.guard';
CLNOpenLiquidityChannelComponent,
CLNChannelActiveHTLCsTableComponent
],
providers: [
CLNUnlockedGuard
],
providers: [],
bootstrap: [CLNRootComponent]
})
export class CLNModule { }

@ -44,70 +44,70 @@ export const ClnRoutes: Routes = [
path: '', component: CLNRootComponent,
children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'home' },
{ path: 'home', component: CLNHomeComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'home', component: CLNHomeComponent, canActivate: [CLNUnlockedGuard()] },
{
path: 'onchain', component: CLNOnChainComponent, canActivate: [CLNUnlockedGuard], children: [
path: 'onchain', component: CLNOnChainComponent, canActivate: [CLNUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'receive/utxos' },
{ path: 'receive/:selTab', component: CLNOnChainReceiveComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'send/:selTab', component: CLNOnChainSendComponent, data: { sweepAll: false }, canActivate: [CLNUnlockedGuard] },
{ path: 'sweep/:selTab', component: CLNOnChainSendComponent, data: { sweepAll: true }, canActivate: [CLNUnlockedGuard] }
{ path: 'receive/:selTab', component: CLNOnChainReceiveComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'send/:selTab', component: CLNOnChainSendComponent, data: { sweepAll: false }, canActivate: [CLNUnlockedGuard()] },
{ path: 'sweep/:selTab', component: CLNOnChainSendComponent, data: { sweepAll: true }, canActivate: [CLNUnlockedGuard()] }
]
},
{
path: 'connections', component: CLNConnectionsComponent, canActivate: [CLNUnlockedGuard], children: [
path: 'connections', component: CLNConnectionsComponent, canActivate: [CLNUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'channels' },
{
path: 'channels', component: CLNChannelsTablesComponent, canActivate: [CLNUnlockedGuard], children: [
path: 'channels', component: CLNChannelsTablesComponent, canActivate: [CLNUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'open' },
{ path: 'open', component: CLNChannelOpenTableComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'pending', component: CLNChannelPendingTableComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'activehtlcs', component: CLNChannelActiveHTLCsTableComponent, canActivate: [CLNUnlockedGuard] }
{ path: 'open', component: CLNChannelOpenTableComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'pending', component: CLNChannelPendingTableComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'activehtlcs', component: CLNChannelActiveHTLCsTableComponent, canActivate: [CLNUnlockedGuard()] }
]
},
{ path: 'peers', component: CLNPeersComponent, data: { sweepAll: false }, canActivate: [CLNUnlockedGuard] }
{ path: 'peers', component: CLNPeersComponent, data: { sweepAll: false }, canActivate: [CLNUnlockedGuard()] }
]
},
{ path: 'liquidityads', component: CLNLiquidityAdsListComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'liquidityads', component: CLNLiquidityAdsListComponent, canActivate: [CLNUnlockedGuard()] },
{
path: 'transactions', component: CLNTransactionsComponent, canActivate: [CLNUnlockedGuard], children: [
path: 'transactions', component: CLNTransactionsComponent, canActivate: [CLNUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'payments' },
{ path: 'payments', component: CLNLightningPaymentsComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'invoices', component: CLNLightningInvoicesTableComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'offers', component: CLNOffersTableComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'offrBookmarks', component: CLNOfferBookmarksTableComponent, canActivate: [CLNUnlockedGuard] }
{ path: 'payments', component: CLNLightningPaymentsComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'invoices', component: CLNLightningInvoicesTableComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'offers', component: CLNOffersTableComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'offrBookmarks', component: CLNOfferBookmarksTableComponent, canActivate: [CLNUnlockedGuard()] }
]
},
{
path: 'messages', component: CLNSignVerifyMessageComponent, canActivate: [CLNUnlockedGuard], children: [
path: 'messages', component: CLNSignVerifyMessageComponent, canActivate: [CLNUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'sign' },
{ path: 'sign', component: CLNSignComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'verify', component: CLNVerifyComponent, canActivate: [CLNUnlockedGuard] }
{ path: 'sign', component: CLNSignComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'verify', component: CLNVerifyComponent, canActivate: [CLNUnlockedGuard()] }
]
},
{
path: 'routing', component: CLNRoutingComponent, canActivate: [CLNUnlockedGuard], children: [
path: 'routing', component: CLNRoutingComponent, canActivate: [CLNUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'forwardinghistory' },
{ path: 'forwardinghistory', component: CLNForwardingHistoryComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'failedtransactions', component: CLNFailedTransactionsComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'localfail', component: CLNLocalFailedTransactionsComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'routingpeers', component: CLNRoutingPeersComponent, canActivate: [CLNUnlockedGuard] }
{ path: 'forwardinghistory', component: CLNForwardingHistoryComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'failedtransactions', component: CLNFailedTransactionsComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'localfail', component: CLNLocalFailedTransactionsComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'routingpeers', component: CLNRoutingPeersComponent, canActivate: [CLNUnlockedGuard()] }
]
},
{
path: 'reports', component: CLNReportsComponent, canActivate: [CLNUnlockedGuard], children: [
path: 'reports', component: CLNReportsComponent, canActivate: [CLNUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'routingreport' },
{ path: 'routingreport', component: CLNRoutingReportComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'transactions', component: CLNTransactionsReportComponent, canActivate: [CLNUnlockedGuard] }
{ path: 'routingreport', component: CLNRoutingReportComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'transactions', component: CLNTransactionsReportComponent, canActivate: [CLNUnlockedGuard()] }
]
},
{
path: 'graph', component: CLNGraphComponent, canActivate: [CLNUnlockedGuard], children: [
path: 'graph', component: CLNGraphComponent, canActivate: [CLNUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'lookups' },
{ path: 'lookups', component: CLNLookupsComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'queryroutes', component: CLNQueryRoutesComponent, canActivate: [CLNUnlockedGuard] }
{ path: 'lookups', component: CLNLookupsComponent, canActivate: [CLNUnlockedGuard()] },
{ path: 'queryroutes', component: CLNQueryRoutesComponent, canActivate: [CLNUnlockedGuard()] }
]
},
{ path: 'rates', component: CLNNetworkInfoComponent, canActivate: [CLNUnlockedGuard] },
{ path: 'rates', component: CLNNetworkInfoComponent, canActivate: [CLNUnlockedGuard()] },
{ path: '**', component: NotFoundComponent },
{ path: 'network', redirectTo: 'rates' },
{ path: 'wallet', redirectTo: 'home' },

@ -998,7 +998,7 @@ export class CLNEffects implements OnDestroy {
));
initializeRemainingData(info: any, landingPage: string) {
this.sessionService.setItem('clUnlocked', 'true');
this.sessionService.setItem('clnUnlocked', 'true');
const node_data = {
identity_pubkey: info.id,
alias: info.alias,

@ -97,9 +97,7 @@ import { ECLUnlockedGuard } from '../shared/services/auth.guard';
ECLOnChainSendModalComponent,
ECLChannelInformationComponent
],
providers: [
ECLUnlockedGuard
],
providers: [],
bootstrap: [ECLRootComponent]
})
export class ECLModule { }

@ -34,54 +34,54 @@ export const EclRoutes: Routes = [
path: '', component: ECLRootComponent,
children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'home' },
{ path: 'home', component: ECLHomeComponent, canActivate: [ECLUnlockedGuard] },
{ path: 'home', component: ECLHomeComponent, canActivate: [ECLUnlockedGuard()] },
{
path: 'onchain', component: ECLOnChainComponent, canActivate: [ECLUnlockedGuard], children: [
path: 'onchain', component: ECLOnChainComponent, canActivate: [ECLUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'receive' },
{ path: 'receive', component: ECLOnChainReceiveComponent, canActivate: [ECLUnlockedGuard] },
{ path: 'send', component: ECLOnChainSendComponent, canActivate: [ECLUnlockedGuard] }
{ path: 'receive', component: ECLOnChainReceiveComponent, canActivate: [ECLUnlockedGuard()] },
{ path: 'send', component: ECLOnChainSendComponent, canActivate: [ECLUnlockedGuard()] }
]
},
{
path: 'connections', component: ECLConnectionsComponent, canActivate: [ECLUnlockedGuard], children: [
path: 'connections', component: ECLConnectionsComponent, canActivate: [ECLUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'channels' },
{
path: 'channels', component: ECLChannelsTablesComponent, canActivate: [ECLUnlockedGuard], children: [
path: 'channels', component: ECLChannelsTablesComponent, canActivate: [ECLUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'open' },
{ path: 'open', component: ECLChannelOpenTableComponent, canActivate: [ECLUnlockedGuard] },
{ path: 'pending', component: ECLChannelPendingTableComponent, canActivate: [ECLUnlockedGuard] },
{ path: 'inactive', component: ECLChannelInactiveTableComponent, canActivate: [ECLUnlockedGuard] }
{ path: 'open', component: ECLChannelOpenTableComponent, canActivate: [ECLUnlockedGuard()] },
{ path: 'pending', component: ECLChannelPendingTableComponent, canActivate: [ECLUnlockedGuard()] },
{ path: 'inactive', component: ECLChannelInactiveTableComponent, canActivate: [ECLUnlockedGuard()] }
]
},
{ path: 'peers', component: ECLPeersComponent, data: { sweepAll: false }, canActivate: [ECLUnlockedGuard] }
{ path: 'peers', component: ECLPeersComponent, data: { sweepAll: false }, canActivate: [ECLUnlockedGuard()] }
]
},
{
path: 'transactions', component: ECLTransactionsComponent, canActivate: [ECLUnlockedGuard], children: [
path: 'transactions', component: ECLTransactionsComponent, canActivate: [ECLUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'payments' },
{ path: 'payments', component: ECLLightningPaymentsComponent, canActivate: [ECLUnlockedGuard] },
{ path: 'invoices', component: ECLLightningInvoicesComponent, canActivate: [ECLUnlockedGuard] }
{ path: 'payments', component: ECLLightningPaymentsComponent, canActivate: [ECLUnlockedGuard()] },
{ path: 'invoices', component: ECLLightningInvoicesComponent, canActivate: [ECLUnlockedGuard()] }
]
},
{
path: 'routing', component: ECLRoutingComponent, canActivate: [ECLUnlockedGuard], children: [
path: 'routing', component: ECLRoutingComponent, canActivate: [ECLUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'forwardinghistory' },
{ path: 'forwardinghistory', component: ECLForwardingHistoryComponent, canActivate: [ECLUnlockedGuard] },
{ path: 'peers', component: ECLRoutingPeersComponent, canActivate: [ECLUnlockedGuard] }
{ path: 'forwardinghistory', component: ECLForwardingHistoryComponent, canActivate: [ECLUnlockedGuard()] },
{ path: 'peers', component: ECLRoutingPeersComponent, canActivate: [ECLUnlockedGuard()] }
]
},
{
path: 'reports', component: ECLReportsComponent, canActivate: [ECLUnlockedGuard], children: [
path: 'reports', component: ECLReportsComponent, canActivate: [ECLUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'routingreport' },
{ path: 'routingreport', component: ECLRoutingReportComponent, canActivate: [ECLUnlockedGuard] },
{ path: 'transactions', component: ECLTransactionsReportComponent, canActivate: [ECLUnlockedGuard] }
{ path: 'routingreport', component: ECLRoutingReportComponent, canActivate: [ECLUnlockedGuard()] },
{ path: 'transactions', component: ECLTransactionsReportComponent, canActivate: [ECLUnlockedGuard()] }
]
},
{
path: 'graph', component: ECLGraphComponent, canActivate: [ECLUnlockedGuard], children: [
path: 'graph', component: ECLGraphComponent, canActivate: [ECLUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'lookups' },
{ path: 'lookups', component: ECLLookupsComponent, canActivate: [ECLUnlockedGuard] },
{ path: 'queryroutes', component: ECLQueryRoutesComponent, canActivate: [ECLUnlockedGuard] }
{ path: 'lookups', component: ECLLookupsComponent, canActivate: [ECLUnlockedGuard()] },
{ path: 'queryroutes', component: ECLQueryRoutesComponent, canActivate: [ECLUnlockedGuard()] }
]
},
{ path: '**', component: NotFoundComponent }

@ -137,9 +137,7 @@ import { LNDUnlockedGuard } from '../shared/services/auth.guard';
OnChainSendModalComponent,
OnChainLabelModalComponent
],
providers: [
LNDUnlockedGuard
],
providers: [],
bootstrap: [LNDRootComponent]
})
export class LNDModule { }

@ -46,77 +46,77 @@ export const LndRoutes: Routes = [
path: '', component: LNDRootComponent,
children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'home' },
{ path: 'home', component: HomeComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'home', component: HomeComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'wallet', component: WalletComponent, canActivate: [AuthGuard] },
{
path: 'onchain', component: OnChainComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'onchain', component: OnChainComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'receive/utxos' },
{ path: 'receive/:selTab', component: OnChainReceiveComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'send/:selTab', component: OnChainSendComponent, data: { sweepAll: false }, canActivate: [LNDUnlockedGuard] },
{ path: 'sweep/:selTab', component: OnChainSendComponent, data: { sweepAll: true }, canActivate: [LNDUnlockedGuard] }
{ path: 'receive/:selTab', component: OnChainReceiveComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'send/:selTab', component: OnChainSendComponent, data: { sweepAll: false }, canActivate: [LNDUnlockedGuard()] },
{ path: 'sweep/:selTab', component: OnChainSendComponent, data: { sweepAll: true }, canActivate: [LNDUnlockedGuard()] }
]
},
{
path: 'connections', component: ConnectionsComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'connections', component: ConnectionsComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'channels' },
{
path: 'channels', component: ChannelsTablesComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'channels', component: ChannelsTablesComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'open' },
{ path: 'open', component: ChannelOpenTableComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'pending', component: ChannelPendingTableComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'closed', component: ChannelClosedTableComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'activehtlcs', component: ChannelActiveHTLCsTableComponent, canActivate: [LNDUnlockedGuard] }
{ path: 'open', component: ChannelOpenTableComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'pending', component: ChannelPendingTableComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'closed', component: ChannelClosedTableComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'activehtlcs', component: ChannelActiveHTLCsTableComponent, canActivate: [LNDUnlockedGuard()] }
]
},
{ path: 'peers', component: PeersComponent, data: { sweepAll: false }, canActivate: [LNDUnlockedGuard] }
{ path: 'peers', component: PeersComponent, data: { sweepAll: false }, canActivate: [LNDUnlockedGuard()] }
]
},
{
path: 'transactions', component: TransactionsComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'transactions', component: TransactionsComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'payments' },
{ path: 'payments', component: LightningPaymentsComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'invoices', component: LightningInvoicesComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'lookuptransactions', component: LookupTransactionsComponent, canActivate: [LNDUnlockedGuard] }
{ path: 'payments', component: LightningPaymentsComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'invoices', component: LightningInvoicesComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'lookuptransactions', component: LookupTransactionsComponent, canActivate: [LNDUnlockedGuard()] }
]
},
{
path: 'messages', component: SignVerifyMessageComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'messages', component: SignVerifyMessageComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'sign' },
{ path: 'sign', component: SignComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'verify', component: VerifyComponent, canActivate: [LNDUnlockedGuard] }
{ path: 'sign', component: SignComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'verify', component: VerifyComponent, canActivate: [LNDUnlockedGuard()] }
]
},
{
path: 'channelbackup', component: BackupComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'channelbackup', component: BackupComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'bckup' },
{ path: 'bckup', component: ChannelBackupTableComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'restore', component: ChannelRestoreTableComponent, canActivate: [LNDUnlockedGuard] }
{ path: 'bckup', component: ChannelBackupTableComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'restore', component: ChannelRestoreTableComponent, canActivate: [LNDUnlockedGuard()] }
]
},
{
path: 'routing', component: RoutingComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'routing', component: RoutingComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'forwardinghistory' },
{ path: 'forwardinghistory', component: ForwardingHistoryComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'peers', component: RoutingPeersComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'nonroutingprs', component: NonRoutingPeersComponent, canActivate: [LNDUnlockedGuard] }
{ path: 'forwardinghistory', component: ForwardingHistoryComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'peers', component: RoutingPeersComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'nonroutingprs', component: NonRoutingPeersComponent, canActivate: [LNDUnlockedGuard()] }
]
},
{
path: 'reports', component: ReportsComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'reports', component: ReportsComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'routingreport' },
{ path: 'routingreport', component: RoutingReportComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'transactions', component: TransactionsReportComponent, canActivate: [LNDUnlockedGuard] }
{ path: 'routingreport', component: RoutingReportComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'transactions', component: TransactionsReportComponent, canActivate: [LNDUnlockedGuard()] }
]
},
{
path: 'graph', component: GraphComponent, canActivate: [LNDUnlockedGuard], children: [
path: 'graph', component: GraphComponent, canActivate: [LNDUnlockedGuard()], children: [
{ path: '', pathMatch: <PathMatch>'full', redirectTo: 'lookups' },
{ path: 'lookups', component: LookupsComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'queryroutes', component: QueryRoutesComponent, canActivate: [LNDUnlockedGuard] }
{ path: 'lookups', component: LookupsComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'queryroutes', component: QueryRoutesComponent, canActivate: [LNDUnlockedGuard()] }
]
},
{ path: 'lookups', component: LookupsComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'network', component: NetworkInfoComponent, canActivate: [LNDUnlockedGuard] },
{ path: 'lookups', component: LookupsComponent, canActivate: [LNDUnlockedGuard()] },
{ path: 'network', component: NetworkInfoComponent, canActivate: [LNDUnlockedGuard()] },
{ path: '**', component: NotFoundComponent },
{ path: 'rates', redirectTo: 'network' }
]

@ -1,57 +1,42 @@
import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { inject } from '@angular/core';
import { Router, ActivatedRoute, CanActivateFn } from '@angular/router';
import { SessionService } from './session.service';
import { map } from 'rxjs/operators';
@Injectable()
export class AuthGuard implements CanActivate {
constructor(private router: Router, private sessionService: SessionService) { }
canActivate(route: ActivatedRouteSnapshot): boolean | Observable<boolean> | Promise<boolean> {
if (!this.sessionService.getItem('token')) {
export function AuthGuard(): CanActivateFn {
return () => {
const router = inject(Router);
const route = inject(ActivatedRoute);
const sessionService = inject(SessionService);
if (!sessionService.getItem('token')) {
return false;
} else if (route.url[0].path !== 'settings' && route.url[0].path !== 'auth' && this.sessionService.getItem('defaultPassword') === 'true') {
this.router.navigate(['/settings/auth']);
} else if (route.snapshot.url && route.snapshot.url.length && route.snapshot.url[0].path !== 'settings' && route.snapshot.url[0].path !== 'auth' && sessionService.getItem('defaultPassword') === 'true') {
router.navigate(['/settings/auth']);
return false;
} else {
return true;
}
}
}
@Injectable()
export class LNDUnlockedGuard implements CanActivate {
constructor(private sessionService: SessionService) { }
canActivate(): boolean | Observable<boolean> | Promise<boolean> {
return !!this.sessionService.watchSession().pipe(map((session) => session.lndUnlocked));
}
}
@Injectable()
export class CLNUnlockedGuard implements CanActivate {
constructor(private sessionService: SessionService) { }
canActivate(): boolean | Observable<boolean> | Promise<boolean> {
return !!this.sessionService.watchSession().pipe(map((session) => session.clUnlocked));
}
}
@Injectable()
export class ECLUnlockedGuard implements CanActivate {
constructor(private sessionService: SessionService) { }
canActivate(): boolean | Observable<boolean> | Promise<boolean> {
return !!this.sessionService.watchSession().pipe(map((session) => session.eclUnlocked));
}
}
};
};
export function LNDUnlockedGuard(): CanActivateFn {
return () => {
const sessionService = inject(SessionService);
return !!sessionService.watchSession().pipe(map((session) => session.lndUnlocked));
};
};
export function CLNUnlockedGuard(): CanActivateFn {
return () => {
const sessionService = inject(SessionService);
return !!sessionService.watchSession().pipe(map((session) => session.clnUnlocked));
};
};
export function ECLUnlockedGuard(): CanActivateFn {
return () => {
const sessionService = inject(SessionService);
return !!sessionService.watchSession().pipe(map((session) => session.eclUnlocked));
};
};

@ -557,7 +557,7 @@ export class RTLEffects implements OnDestroy {
selNode['currencyUnits'] = [...CURRENCY_UNITS, node.settings.currencyUnit];
}
this.sessionService.removeItem('lndUnlocked');
this.sessionService.removeItem('clUnlocked');
this.sessionService.removeItem('clnUnlocked');
this.sessionService.removeItem('eclUnlocked');
this.store.dispatch(resetRootStore({ payload: node }));
this.store.dispatch(resetLNDStore({ payload: selNode }));

Loading…
Cancel
Save