removed some extra networking code

This commit is contained in:
Paul Sori 2019-04-26 22:51:48 -04:00
parent be7d6a661d
commit 9f7ee473aa
6 changed files with 0 additions and 127 deletions

View File

@ -93,8 +93,6 @@
const {ipcRenderer} = require('electron');
const app = remote.app;
const dialog = remote.require('electron').dialog;
const internalIp = require('internal-ip');
const publicIpMod = require('public-ip');
const superagent = require('superagent');
const path = require('path');
const fs = require('fs');
@ -106,11 +104,6 @@
var configFile = path.join(app.getPath('userData'), 'save/server-config.json');
var editThisUser;
var bootFlag = false;
var publicIp;
(async () => {
publicIp = await publicIpMod.v4();
})();
// Open a tags in OS browser
document.addEventListener('click', function (event) {
@ -597,10 +590,6 @@
<div class="card">\
<div class="row row-mod">\
<div class="section-header">Network Details</div>\
<div class="col s12">\
<div>Local IP: {{networkIp}}</div>\
<div>Public IP: {{pIp}}</div>\
</div>\
</div>\
</div>\
</div>\
@ -638,15 +627,6 @@
</div>\
</div>\
</div>',
computed: {
networkIp: function () {
// `this` points to the vm instance
return internalIp.v4.sync();
},
pIp: function() {
return publicIp;
}
},
methods: {
updateConfig: function() {
fs.writeFileSync(configFile, JSON.stringify(loadJson), 'utf8');
@ -755,22 +735,6 @@
}
});
const securityViewLoggedIn = Vue.component('security-view-logged-in', {
template: '\
<div class="ssl-overlay card">\
<div id="logged-in-panel" class="logged-in-panel">\
<img class="logged-in-checkmark" src="images/checkmark.svg">\
<div>\
<p class="bigger-text">Logged In</p>\
<p>Domain: <span id="your-domain">LOADING...</span> </br>\
IP Address: <span id="ip-status">LOADING...</span> </br>\
Certs: <span id="cert-status">LOADING...</span> </br>\
</p>\
</div>\
</div>\
</div>'
});
const securityViewSignup = Vue.component('security-view-signup', {
data: function() {
return {

View File

@ -1,57 +0,0 @@
const natupnp = require('nat-upnp');
const winston = require('winston');
var tunnelInterval;
function set_gateway(gateIP) {
gateway = gateIP;
}
function tunnel(port, protocol, callback) {
tunnel_uPNP(port, callback);
}
function tunnel_uPNP(port, callback) {
winston.info('Preparing to tunnel via upnp protocol');
var client = natupnp.createClient();
client.portMapping({
public: port,
private: port,
ttl: 0
}, function (err) {
// Will be called once finished
if (err) {
winston.error(`uPNP failed: ${err}`);
// Clear Interval
if (tunnelInterval && callback) {
clearInterval(tunnelInterval);
}
if (callback) {
callback(false);
}
return;
}
if (callback) {
callback(true);
}
});
}
exports.setup = function (program, callback) {
if (program.tunnel.gateway) {
set_gateway(args.gateway);
}
if (program.tunnel.refreshInterval) {
tunnelInterval = setInterval(function () {
tunnel(program.port, program.tunnel.protocol);
}, program.tunnel.refreshInterval);
}
tunnel(program.port, program.tunnel.protocol, callback);
}

View File

@ -23,11 +23,6 @@ exports.setup = function (args) {
.option('-u, --user <user>', 'Set Username')
.option('-x, --password <password>', 'Set Password')
// Port Forwarding
.option('-t, --tunnel', 'Use nat-pmp to configure port forwarding')
.option('-g, --gateway <gateway>', 'Manually set gateway IP for the tunnel option')
.option('-r, --refresh <refresh>', 'Refresh rate', /^\d+$/i)
// lastFM
.option('-l, --luser <user>', 'Set LastFM Username')
.option('-z, --lpass <password>', 'Set LastFM Password')

View File

@ -3,7 +3,6 @@ const fs = require('fs');
const fe = require('path');
const os = require('os');
const mkdirp = require('make-dir');
const internalIp = require('internal-ip');
const AutoLaunch = require('auto-launch');
const mstreamAutoLaunch = new AutoLaunch({ name: 'mStream' });
@ -163,11 +162,6 @@ function bootServer(program) {
shell.openExternal(protocol + '://localhost:' + program.port + '/winamp')
}
},
{
label: protocol + '://' + internalIp.v4.sync() + ':' + program.port, click: function () {
shell.openExternal(protocol + '://' + internalIp.v4.sync() + ':' + program.port)
}
},
] },
{ type: 'separator' },
{

View File

@ -132,26 +132,6 @@ exports.serveIt = function (program) {
let protocol = program.ssl && program.ssl.cert && program.ssl.key ? 'https' : 'http';
winston.info(`Access mStream locally: ${protocol + '://localhost:' + program.port}`);
winston.info(`Try the WinAmp Demo: ${protocol + '://localhost:' + program.port}/winamp`);
require('internal-ip').v4().then(ip => {
winston.info(`Access mStream on your local network: ${protocol + '://' + ip + ':' + program.port}`);
});
// Handle Port Forwarding
if (program.tunnel) {
try {
require('./modules/auto-port-forwarding.js').setup(program, function (status) {
if (status !== true) {
throw new Error('Port Forwarding Failed');
}
require('public-ip').v4().then(ip => {
winston.info(`Access mStream on the internet: ${protocol + '://' + ip + ':' + program.port}`);
});
});
} catch (err) {
winston.error('Port Forwarding Failed. The server is running but you will have to configure your own port forwarding');
}
}
dbModule.runAfterBoot(program);
ddns.setup(program);

View File

@ -26,16 +26,13 @@
"express": "^4.16.4",
"inquirer": "^6.2.2",
"inquirer-select-directory": "^1.2.0",
"internal-ip": "^4.2.0",
"jsonwebtoken": "^8.5.0",
"lokijs": "^1.5.6",
"make-dir": "^2.1.0",
"mime-types": "^2.1.22",
"music-metadata": "^3.5.2",
"nanoid": "^2.0.1",
"nat-upnp": "^1.1.0",
"portscanner": "^2.1.1",
"public-ip": "^3.0.0",
"superagent": "^5.0.2",
"winston": "^3.2.1",
"ws": "^6.1.4"