Skip to content

Commit 3ab11c8

Browse files
Merge pull request #26 from ElementsProject/fix-token-expiry
Token expiry and other UI fixes
2 parents 129ae0a + 2aea113 commit 3ab11c8

20 files changed

+35
-28
lines changed

.github/docs/Contributing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Development
44
* Change directory: cd cln-application
55
* Install dependencies: Assuming that nodejs (v14 & above) and npm are already installed, run `npm install`.
66
* Setup environment variables: Assuming that bitcoind and core-lightning are already running, adjust environment variables listed in `./env.sh` file and execute the script with `'. env.sh'` to setup required environment variables to connect to the node.
7-
* Setup Commando auth: Update `LIGHTNING_PUBKEY` and `LIGHTNING_RUNE` variables in `.commando` for successful backend authentication and connection via commando.
7+
* Setup Commando auth: Update `LIGHTNING_PUBKEY` and `LIGHTNING_RUNE` variables in `.commando` for successful backend authentication and connection via commando. Or run `entrypoint.sh` with correct lightningd path to do the same.
88
* Run backend server: Get backend server up by running `npm run backend:serve`.
99
* Watch backend server: Watch backend server for realtime changes with `npm run backend:watch`.
1010
* React frontend server: React development server is set to serve on port 4300. Run `npm run frontend:dev` script to get it working.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@
118118
119119
# Acknowledgements
120120
121-
- This app is inpired by the work done by [Umbrel lightning app](https://github.com/getumbrel/umbrel-lightning).
121+
- This app is inspired by the work done by [Umbrel lightning app](https://github.com/getumbrel/umbrel-lightning).
122122
123123
- The backend api connects with core lightning via [lnmessage](https://github.com/aaronbarnardsound/lnmessage).

apps/backend/dist/controllers/auth.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class AuthController {
1212
const vpRes = verifyPassword(req.body.password);
1313
if (vpRes === true) {
1414
const token = jwt.sign({ userID: SECRET_KEY }, SECRET_KEY);
15-
res.cookie('token', token, { httpOnly: true, maxAge: 3600 * 24 * 7 });
15+
// Expire the token in a day
16+
res.cookie('token', token, { httpOnly: true, maxAge: 3600000 * 24 });
1617
return res.status(201).json({ isAuthenticated: true, isValidPassword: isValidPassword() });
1718
}
1819
else {

apps/backend/source/controllers/auth.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class AuthController {
2020
const vpRes = verifyPassword(req.body.password);
2121
if (vpRes === true) {
2222
const token = jwt.sign({ userID: SECRET_KEY }, SECRET_KEY);
23-
res.cookie('token', token, { httpOnly: true, maxAge: 3600 * 24 * 7 });
23+
// Expire the token in a day
24+
res.cookie('token', token, { httpOnly: true, maxAge: 3600000 * 24 });
2425
return res.status(201).json({ isAuthenticated: true, isValidPassword: isValidPassword() });
2526
} else {
2627
const err = new AuthError(vpRes, vpRes, HttpStatusCode.UNAUTHORIZED, vpRes);
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"files": {
3-
"main.css": "/static/css/main.179aa97d.css",
4-
"main.js": "/static/js/main.08092983.js",
3+
"main.css": "/static/css/main.ec053e02.css",
4+
"main.js": "/static/js/main.45257535.js",
55
"static/media/Inter-Bold.ttf": "/static/media/Inter-Bold.88fa7ae373b07b41ecce.ttf",
66
"static/media/Inter-SemiBold.ttf": "/static/media/Inter-SemiBold.4d56bb21f2399db8ad48.ttf",
77
"static/media/Inter-Medium.ttf": "/static/media/Inter-Medium.6dcbc9bed1ec438907ee.ttf",
88
"static/media/Inter-Thin.ttf": "/static/media/Inter-Thin.f341ca512063c66296d1.ttf",
99
"index.html": "/index.html",
10-
"main.179aa97d.css.map": "/static/css/main.179aa97d.css.map",
11-
"main.08092983.js.map": "/static/js/main.08092983.js.map"
10+
"main.ec053e02.css.map": "/static/css/main.ec053e02.css.map",
11+
"main.45257535.js.map": "/static/js/main.45257535.js.map"
1212
},
1313
"entrypoints": [
14-
"static/css/main.179aa97d.css",
15-
"static/js/main.08092983.js"
14+
"static/css/main.ec053e02.css",
15+
"static/js/main.45257535.js"
1616
]
1717
}

apps/frontend/build/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./images/cln-favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="color-scheme" content="light dark"><meta name="description" content="Core lightning application"/><link rel="apple-touch-icon" href="./images/cln-logo-dark.png"/><title>Core Lightning</title><script defer="defer" src="/static/js/main.08092983.js"></script><link href="/static/css/main.179aa97d.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./images/cln-favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="color-scheme" content="light dark"><meta name="description" content="Core lightning application"/><link rel="apple-touch-icon" href="./images/cln-logo-dark.png"/><title>Core Lightning</title><script defer="defer" src="/static/js/main.45257535.js"></script><link href="/static/css/main.ec053e02.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

apps/frontend/build/static/css/main.179aa97d.css.map

-1
This file was deleted.

apps/frontend/build/static/css/main.179aa97d.css apps/frontend/build/static/css/main.ec053e02.css

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/frontend/build/static/css/main.ec053e02.css.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/frontend/build/static/js/main.08092983.js.map

-1
This file was deleted.

apps/frontend/build/static/js/main.08092983.js apps/frontend/build/static/js/main.45257535.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/frontend/build/static/js/main.45257535.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/frontend/src/components/cln/BTCWallet/BTCWallet.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
.btc-transactions-tabs {
44
border-bottom: 0.5px solid $border-color;
5+
padding: 0 2rem 0.25rem 0.25rem;
56
}
67

78
@include color-mode(dark) {
89
.btc-transactions-tabs {
910
border-bottom: 0.5px solid $border-color-dark;
10-
padding: 0 2rem 0 0.25rem;
1111
}
1212
}

apps/frontend/src/components/cln/CLNWallet/CLNWallet.scss

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77
border-right: none;
88
border-top: none;
99
& .nav-item .nav-link {
10-
padding: 0 2rem 0 0.25rem;
10+
padding: 0 1rem 0.25rem 0.25rem;
1111
color: $light;
12+
& span {
13+
padding: 0.25rem 0.25rem 0.25rem 0.25rem;
14+
}
1215
&.active, &:hover, &:focus {
1316
background-color: transparent;
14-
border-bottom: 1px solid $primary;
17+
& span {
18+
border-bottom: 2px solid $primary;
19+
}
1520
}
1621
}
1722
}

apps/frontend/src/components/cln/CLNWallet/CLNWallet.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ const CLNWallet = (props) => {
6363
>
6464
<Nav className='flex-row cln-transactions-tabs'>
6565
<Nav.Item>
66-
<Nav.Link eventKey='transactions'>Transactions</Nav.Link>
66+
<Nav.Link eventKey='transactions'><span>Transactions</span></Nav.Link>
6767
</Nav.Item>
6868
<Nav.Item>
69-
<Nav.Link eventKey='offers'>Offers</Nav.Link>
69+
<Nav.Link eventKey='offers'><span>Offers</span></Nav.Link>
7070
</Nav.Item>
7171
</Nav>
7272
<PerfectScrollbar className='ps-show-always'>

apps/frontend/src/components/modals/Logout/Logout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ const LogoutComponent = () => {
3333
<Col xs={2} className='message-type-box d-flex align-items-center justify-content-center'>
3434
<QuestionMarkSVG />
3535
</Col>
36-
<Col xs={10} className='py-3 px-2'>
36+
<Col xs={10} className='p-3'>
3737
<Col className='d-flex align-items-center justify-content-between'>
38-
<Col xs={7}>Logout?</Col>
38+
<Col xs={7} className='ps-1'>Logout?</Col>
3939
<button type="button" className="btn btn-rounded btn-sm btn-secondary" onClick={() => logoutHandler(true)}>Yes</button>
4040
<button type="button" className="btn btn-rounded btn-sm btn-secondary" onClick={() => logoutHandler(false)}>No</button>
4141
</Col>

apps/frontend/src/styles/shared.scss

+1
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ svg {
378378
.dropdown {
379379
& .dropdown-item {
380380
font-weight: 500;
381+
padding: 0.5rem 1rem;
381382
&.active, &:active, &:focus, &:hover {
382383
color: $primary;
383384
background-color: unset;

env.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if [ "$SETUP" == "docker" ]; then
3131
export COMMANDO_CONFIG="/data/.lightning/.commando-env"
3232
echo "Docker Environment Variables Set"
3333
else
34-
export DEVICE_DOMAIN_NAME="umbrel.local"
34+
export DEVICE_DOMAIN_NAME="local.local"
3535
export LOCAL_HOST="http://""$DEVICE_DOMAIN_NAME"
3636
export APP_BITCOIN_NODE_IP="localhost"
3737
export APP_CORE_LIGHTNING_DAEMON_IP="localhost"

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
"scripts": {
88
"frontend:dev": "npm run start -w cln-application-frontend",
99
"frontend:build": "npm run build -w cln-application-frontend",
10-
"backend:dev": "npm run start -w cln-application-backend",
1110
"backend:build": "npm run build -w cln-application-backend",
1211
"backend:serve": "npm run serve -w cln-application-backend",
1312
"backend:watch": "npm run watch -w cln-application-backend",
14-
"dev": "npm run backend:dev & npm run frontend:dev",
13+
"dev": "npm run backend:serve & npm run frontend:dev",
1514
"build": "npm run backend:build & npm run frontend:build",
1615
"start": "npm run serve -w cln-application-backend"
1716
},

0 commit comments

Comments
 (0)