mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2025-03-11 01:27:27 +01:00
Server Config Read
Server Config Read
This commit is contained in:
parent
0b0ece429f
commit
f14ae903d9
9 changed files with 46 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
.mat-raised-button {
|
||||
/* .mat-raised-button {
|
||||
margin-top: 5px !important;
|
||||
max-height: 36px;
|
||||
}
|
||||
|
@ -223,4 +223,4 @@
|
|||
.cursor-pointer {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
<link rel="icon" type="image/x-icon" href="./assets/img/favicon.ico">
|
||||
<link rel="stylesheet" href="styles.c15bc5aec7303c953f16.css"></head>
|
||||
<link rel="stylesheet" href="styles.f81094359075ff81a528.css"></head>
|
||||
<body>
|
||||
<rtl-root></rtl-root>
|
||||
|
||||
<script type="text/javascript" src="runtime.6afe30102d8fe7337431.js"></script><script type="text/javascript" src="polyfills.c7939909ac1e754960ad.js"></script><script type="text/javascript" src="main.11a4ab7fea338667ab3f.js"></script></body></html>
|
||||
<script type="text/javascript" src="runtime.6afe30102d8fe7337431.js"></script><script type="text/javascript" src="polyfills.c7939909ac1e754960ad.js"></script><script type="text/javascript" src="main.f6cf508d657100faf2e2.js"></script></body></html>
|
1
angular/main.f6cf508d657100faf2e2.js
Normal file
1
angular/main.f6cf508d657100faf2e2.js
Normal file
File diff suppressed because one or more lines are too long
1
angular/styles.f81094359075ff81a528.css
Normal file
1
angular/styles.f81094359075ff81a528.css
Normal file
File diff suppressed because one or more lines are too long
4
app.js
4
app.js
|
@ -14,6 +14,7 @@ const graphInfoRoutes = require("./routes/graphInfo");
|
|||
const newAddressRoutes = require("./routes/newAddress");
|
||||
const transactionsRoutes = require("./routes/transactions");
|
||||
const UISettingsRoutes = require("./routes/UISettings");
|
||||
const LNDSettingsRoutes = require("./routes/lndConfSettings");
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
|
@ -24,7 +25,7 @@ app.use((req, res, next) => {
|
|||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
res.setHeader(
|
||||
"Access-Control-Allow-Headers",
|
||||
"Origin, X-Requested-With, Content-Type, Accept, Authorization"
|
||||
"Origin, X-Requested-With, Content-Type, Accept, Authorization, filePath"
|
||||
);
|
||||
res.setHeader(
|
||||
"Access-Control-Allow-Methods",
|
||||
|
@ -45,6 +46,7 @@ app.use("/api/network", graphInfoRoutes);
|
|||
app.use("/api/newaddress", newAddressRoutes);
|
||||
app.use("/api/transactions", transactionsRoutes);
|
||||
app.use("/api/uisettings", UISettingsRoutes);
|
||||
app.use("/api/lndconf", LNDSettingsRoutes);
|
||||
|
||||
// sending angular application when route doesn't match
|
||||
app.use((req, res, next) => {
|
||||
|
|
17
controllers/lndConfSettings.js
Normal file
17
controllers/lndConfSettings.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
var fs = require('fs');
|
||||
|
||||
exports.getLNDSettings = (req, res, next) => {
|
||||
console.log('Getting LND Conf Settings!');
|
||||
fs.readFile(req.headers.filepath, function(err, data) {
|
||||
if (err) {
|
||||
console.log('Reading LND Conf Settings Failed!');
|
||||
res.status(500).json({
|
||||
message: "Reading LND Conf Settings Failed!",
|
||||
error: err
|
||||
});
|
||||
} else {
|
||||
console.log('LND Conf read successfully');
|
||||
res.status(200).json(data.toString('utf8'));
|
||||
}
|
||||
});
|
||||
};
|
|
@ -3,16 +3,23 @@ var options = require("../connect");
|
|||
var config = require('../config');
|
||||
|
||||
exports.getNewAddress = (req, res, next) => {
|
||||
options.url = config.lnd_server_url + '/newaddress';
|
||||
options.url = config.lnd_server_url + '/newaddress?type=' + req.query.type;
|
||||
console.log('\n-------------------------------------------------');
|
||||
console.log('Get New Address');
|
||||
console.log('-------------------------------------------------');
|
||||
console.log('Request Query Params: ' + JSON.stringify(req.query));
|
||||
console.log('Options URL: ' + JSON.stringify(options.url));
|
||||
request.get(options, (error, response, body) => {
|
||||
console.log("New Address Received: " + JSON.stringify(body));
|
||||
if(undefined === body || body.error) {
|
||||
const body_str = (undefined === body) ? '' : JSON.stringify(body);
|
||||
const search_idx = (undefined === body) ? -1 : body_str.search('Not Found');
|
||||
console.log("New Address Received: " + body_str);
|
||||
if(undefined === body || search_idx > -1 || body.error) {
|
||||
res.status(500).json({
|
||||
message: "Fetching new address failed!",
|
||||
error: (undefined === body) ? 'ERROR From Server!' : body.error
|
||||
error: (undefined === body || search_idx > -1) ? 'ERROR From Server!' : body.error
|
||||
});
|
||||
} else {
|
||||
res.status(200).json(body);
|
||||
res.status(200).json(body);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
7
routes/lndConfSettings.js
Normal file
7
routes/lndConfSettings.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const LNDSettingsController = require("../controllers/lndConfSettings");
|
||||
const express = require("express");
|
||||
const router = express.Router();
|
||||
|
||||
router.get("/", LNDSettingsController.getLNDSettings);
|
||||
|
||||
module.exports = router;
|
|
@ -1 +1 @@
|
|||
{"name":"RTL","loadingSpinner":false,"fixedHeader":false,"sidenavIsOpened":true,"sidenavIsPinned":true,"sidenavUserBlock":true,"menu":"vertical","menuType":"default","theme":"light-blue","rtl":false}
|
||||
{"name":"RTL","loadingSpinner":false,"fixedHeader":false,"sidenavIsOpened":true,"sidenavIsPinned":true,"sidenavUserBlock":true,"menu":"vertical","menuType":"default","theme":"light-blue","rtl":false, "lndConfigPath":"" }
|
Loading…
Add table
Reference in a new issue