Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
2cb1334
First commit, ready for live testing
Jan 20, 2024
b1cded3
Add logging to fpc and remove process.exit from testing
Jan 20, 2024
bf527d8
Fix typo for SSL server address
Jan 20, 2024
4ae49dc
Use global homePort instead of computing it again
Jan 20, 2024
b001da7
Fix up logger for fpc, add move vars to computed
Jan 21, 2024
2c7c237
Move logfile generation to function
Jan 21, 2024
3269ef6
Move computed to run on config change, add upnp to userconfig file
Jan 22, 2024
f5f71f8
Move autoUpnp to be reloadable by config file
Jan 22, 2024
e60aee6
Try seperate loggers to see if merging them is causing an error
Jan 22, 2024
22ab663
Fix naming errors for path (homeDir vs appRoot) fix properties
Jan 22, 2024
c5909ee
Bump fpc version
Jan 22, 2024
b183c91
Bump fpc dep
Jan 22, 2024
7e081c7
Remove incorrect comment
Jan 22, 2024
ea3aeb0
First cut at adding node tags
Jan 23, 2024
336c667
Fix type checking in apiServer
Jan 23, 2024
a84eae9
Fix typo for iter
Jan 23, 2024
25f9545
Fix typing for key
Jan 23, 2024
558ab4b
Add some logging for homeapp
Jan 23, 2024
4851835
Fix typos
Jan 23, 2024
bb0c56b
Fix function name typo
Jan 23, 2024
e8bd22a
Use correct format for zelidauth
Jan 23, 2024
b4c113e
Format tags as string
Jan 23, 2024
1440319
Fix linting errors
Jan 23, 2024
e881762
Fix another linting error
Jan 23, 2024
9792cea
Load tags on mount if available, limit tags to 16 chars in gui
Jan 23, 2024
7ce3ab6
Fix lint errors
Jan 23, 2024
b60f131
Tidy up routerIp and compute up front in apiSever
Jan 24, 2024
54f95b0
Fix all linting errors
Jan 24, 2024
0a27933
Remove dynamic userconfig from static server config
Jan 24, 2024
484a02a
Undo last change, do it an easier way
Jan 24, 2024
9b45632
Update upnp tests
Jan 24, 2024
d5c00cd
Add fpc tests and cleanup based on tests
Jan 25, 2024
243e102
upnpClient to cache gateway in case of multicast error
Jan 25, 2024
f3ebd3f
Lint/Fix up all my Python habits
Jan 25, 2024
6510577
Add apiServer tests and fix apiServer
Jan 26, 2024
a729cbc
Lint
Jan 26, 2024
6f3319e
Remove unused var
Jan 26, 2024
c67ff12
Bugfix for connection errors and change config file import logic
Jan 27, 2024
ef6f91b
Bump fluxport-controller version to include bugfix
Jan 28, 2024
8d63d02
Bump version, and apiServer update
Feb 5, 2024
edbb592
Tighten up regex to disallow leading zeros. Lint.
Feb 5, 2024
3f17140
Simplify ip validation
Feb 5, 2024
e5986d9
Bump conroller version - pull in built js
Feb 6, 2024
1273f4f
Add timeout and try / catch for gossip server calls
Feb 6, 2024
e9b0ec9
Fix typo
Feb 6, 2024
1fb6a12
Lint
Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ module.exports = {
plugins: [
'vue',
],
globals: {
userconfig: true,
},
rules: {
'max-len': [
'error',
Expand Down
7 changes: 7 additions & 0 deletions HomeUI/src/services/FluxService.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ export default {
getFluxVersion() {
return Api().get('/flux/version');
},
getFluxTags(zelidauthHeader) {
return Api().get('/flux/tags', {
headers: {
zelidauth: zelidauthHeader,
},
});
},
broadcastMessage(zelidauthHeader, message) {
const data = message;
const axiosConfig = {
Expand Down
31 changes: 31 additions & 0 deletions HomeUI/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
:data="getNodeStatusResponse.nodeStatus"
:variant="getNodeStatusResponse.class"
/>
<list-entry
v-if="tags && privilege === 'admin'"
title="Tags"
:data="tags"
/>
<list-entry
title="Static Ip ISP/Org"
:data="staticIp ? 'Yes' : 'No'"
Expand Down Expand Up @@ -232,6 +237,7 @@ export default {
},
staticIp: false,
signClient: null,
tags: null,
};
},
computed: {
Expand All @@ -251,6 +257,7 @@ export default {
this.daemonWelcomeGetFluxNodeStatus();
this.getZelIdLoginPhrase();
this.getOwnerZelid();
this.getTags();
this.getStaticIpInfo();
this.initMMSDK();
},
Expand Down Expand Up @@ -294,6 +301,15 @@ export default {
this.$store.commit('flux/setUserZelid', obtainedZelid);
}
},
async getTags() {
const zelidauth = localStorage.getItem('zelidauth');
if (!zelidauth) return;
const response = await FluxService.getFluxTags(zelidauth);
if (response.data.status === 'success') {
const tags = response.data.data;
this.tags = Object.keys(tags).map((key) => `${key.slice(0, 16)}: ${tags[key].slice(0, 16)}`).join(', ');
}
},
async getStaticIpInfo() {
const response = await FluxService.getStaticIpInfo();
console.log(response);
Expand Down Expand Up @@ -353,6 +369,9 @@ export default {
this.$store.commit('flux/setPrivilege', data.data.privilage);
this.$store.commit('flux/setZelid', zelidauth.zelid);
localStorage.setItem('zelidauth', qs.stringify(zelidauth));
if (data.data.privilage === 'admin') {
this.getTags();
}
this.showToast('success', data.data.message);
}
console.log(data);
Expand Down Expand Up @@ -431,6 +450,9 @@ export default {
this.$store.commit('flux/setPrivilege', response.data.data.privilage);
this.$store.commit('flux/setZelid', zelidauth.zelid);
localStorage.setItem('zelidauth', qs.stringify(zelidauth));
if (response.data.data.privilage === 'admin') {
this.getTags();
}
this.showToast('success', response.data.data.message);
} else {
this.showToast(this.getVariant(response.data.status), response.data.data.message || response.data.data);
Expand Down Expand Up @@ -469,6 +491,9 @@ export default {
this.$store.commit('flux/setPrivilege', response.data.data.privilage);
this.$store.commit('flux/setZelid', zelidauth.zelid);
localStorage.setItem('zelidauth', qs.stringify(zelidauth));
if (response.data.data.privilage === 'admin') {
this.getTags();
}
this.showToast('success', response.data.data.message);
} else {
this.showToast(this.getVariant(response.data.status), response.data.data.message || response.data.data);
Expand Down Expand Up @@ -551,6 +576,9 @@ export default {
this.$store.commit('flux/setPrivilege', response.data.data.privilage);
this.$store.commit('flux/setZelid', zelidauth.zelid);
localStorage.setItem('zelidauth', qs.stringify(zelidauth));
if (response.data.data.privilage === 'admin') {
this.getTags();
}
this.showToast('success', response.data.data.message);
} else {
this.showToast(this.getVariant(response.data.status), response.data.data.message || response.data.data);
Expand Down Expand Up @@ -602,6 +630,9 @@ export default {
this.$store.commit('flux/setPrivilege', response.data.data.privilage);
this.$store.commit('flux/setZelid', zelidauth.zelid);
localStorage.setItem('zelidauth', qs.stringify(zelidauth));
if (response.data.data.privilage === 'admin') {
this.getTags();
}
this.showToast('success', response.data.data.message);
} else {
this.showToast(this.getVariant(response.data.status), response.data.data.message || response.data.data);
Expand Down
5 changes: 2 additions & 3 deletions ZelBack/config/default.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// eslint-disable-next-line prefer-const
let userconfig = require('../../config/userconfig');
let { isDevelopment } = require('../../config/userconfig');

const isDevelopment = userconfig.initial.development || false;
isDevelopment = isDevelopment || false;

module.exports = {
development: isDevelopment,
Expand Down
10 changes: 5 additions & 5 deletions ZelBack/src/lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const levels = {

const logLevel = config && config.logLevel ? config.logLevel : levels.debug;

const homeDirPath = path.join(__dirname, '../../../');
const appRootPath = path.join(__dirname, '../../../');

const fileSizeCache = {};

Expand Down Expand Up @@ -69,7 +69,7 @@ function debug(args) {
try {
console.log(args);
// write to file
const filepath = `${homeDirPath}debug.log`;
const filepath = `${appRootPath}debug.log`;
writeToFile(filepath, args);
} catch (err) {
console.error('This should not have happened');
Expand All @@ -83,7 +83,7 @@ function error(args) {
}
try {
// write to file
const filepath = `${homeDirPath}error.log`;
const filepath = `${appRootPath}error.log`;
writeToFile(filepath, args);
debug(args);
} catch (err) {
Expand All @@ -98,7 +98,7 @@ function warn(args) {
}
try {
// write to file
const filepath = `${homeDirPath}warn.log`;
const filepath = `${appRootPath}warn.log`;
writeToFile(filepath, args);
debug(args);
} catch (err) {
Expand All @@ -113,7 +113,7 @@ function info(args) {
}
try {
// write to file
const filepath = `${homeDirPath}info.log`;
const filepath = `${appRootPath}info.log`;
writeToFile(filepath, args);
debug(args);
} catch (err) {
Expand Down
3 changes: 3 additions & 0 deletions ZelBack/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ module.exports = (app, expressWs) => {
app.get('/flux/nodejsversions', cache('30 seconds'), (req, res) => {
fluxService.getNodeJsVersions(req, res);
});
app.get('/flux/tags', cache('30 seconds'), (req, res) => {
fluxService.getFluxTags(req, res);
});
app.get('/flux/ip', cache('30 seconds'), (req, res) => {
fluxService.getFluxIP(req, res);
});
Expand Down
11 changes: 5 additions & 6 deletions ZelBack/src/services/appsService.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global userconfig */
const config = require('config');
const https = require('https');
const axios = require('axios');
Expand Down Expand Up @@ -5826,17 +5825,17 @@ async function restoreFluxPortsSupport() {
try {
const isUPNP = upnpService.isUPNP();

const apiPort = userconfig.initial.apiport || config.server.apiport;
const homePort = +apiPort - 1;
const apiPortSSL = +apiPort + 1;
const syncthingPort = +apiPort + 2;
const { apiPort } = userconfig.computed;
const { homePort } = userconfig.computed;
const { apiPortSsl } = userconfig.computed;
const { syncthingPort } = userconfig.computed;

const firewallActive = await fluxNetworkHelper.isFirewallActive();
if (firewallActive) {
// setup UFW if active
await fluxNetworkHelper.allowPort(serviceHelper.ensureNumber(apiPort));
await fluxNetworkHelper.allowPort(serviceHelper.ensureNumber(homePort));
await fluxNetworkHelper.allowPort(serviceHelper.ensureNumber(apiPortSSL));
await fluxNetworkHelper.allowPort(serviceHelper.ensureNumber(apiPortSsl));
await fluxNetworkHelper.allowPort(serviceHelper.ensureNumber(syncthingPort));
}

Expand Down
12 changes: 3 additions & 9 deletions ZelBack/src/services/benchmarkService.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* global userconfig */
const benchmarkrpc = require('daemonrpc');
const config = require('config');
const path = require('path');
const fs = require('fs');
const serviceHelper = require('./serviceHelper');
const messageHelper = require('./messageHelper');
const verificationHelper = require('./verificationHelper');
Expand All @@ -14,9 +11,6 @@ const isTestnet = userconfig.initial.testnet;

const rpcport = isTestnet === true ? config.benchmark.rpcporttestnet : config.benchmark.rpcport;

const homeDirPath = path.join(__dirname, '../../../../');
const newBenchmarkPath = path.join(homeDirPath, '.fluxbenchmark');

let response = messageHelper.createErrorMessage();

/**
Expand All @@ -32,7 +26,7 @@ async function executeCall(rpc, params) {
try {
let rpcuser = 'zelbenchuser';
let rpcpassword = 'zelbenchpassword';
if (fs.existsSync(newBenchmarkPath)) {
if (userconfig.computed.isNewBenchPath) {
rpcuser = 'fluxbenchuser';
rpcpassword = 'fluxbenchpassword';
}
Expand Down Expand Up @@ -246,8 +240,8 @@ async function executeUpnpBench() {
log.info('executeUpnpBench - Flux not yet synced');
return;
}
const isUPNP = upnpService.isUPNP();
if ((userconfig.initial.apiport && userconfig.initial.apiport !== config.server.apiport) || isUPNP) {

if (upnpService.isUPNP()) {
log.info('Calling FluxBench startMultiPortBench');
log.info(await startMultiPortBench());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global userconfig */
const messageHelper = require('../messageHelper');
const daemonServiceUtils = require('./daemonServiceUtils');
const daemonServiceBlockchainRpcs = require('./daemonServiceBlockchainRpcs');
Expand Down
Loading