added instance sftp port
This commit is contained in:
+15
-2
@@ -97,7 +97,6 @@ async function main() {
|
|||||||
const upnpPortList = run('upnpc -l');
|
const upnpPortList = run('upnpc -l');
|
||||||
// console.log(upnpPortList);
|
// console.log(upnpPortList);
|
||||||
|
|
||||||
|
|
||||||
for (const instance of JSON.parse(instancesJSON)) {
|
for (const instance of JSON.parse(instancesJSON)) {
|
||||||
if (instance.DeploymentArgs['GenericModule.App.Ports'] != undefined) {
|
if (instance.DeploymentArgs['GenericModule.App.Ports'] != undefined) {
|
||||||
// 0 - TCP; 1 = UDP; 2 - Both
|
// 0 - TCP; 1 = UDP; 2 - Both
|
||||||
@@ -147,8 +146,22 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (instance.DeploymentArgs['FileManagerPlugin.SFTP.SFTPPortNumber'] != undefined) {
|
||||||
|
let Name = `AMP ${instance.FriendlyName} SFTP`;
|
||||||
|
let Number = instance.DeploymentArgs['FileManagerPlugin.SFTP.SFTPPortNumber'];
|
||||||
|
instancesPorts += `${Name}\n`;
|
||||||
|
|
||||||
|
if (!upnpPortList.includes(Name)) {
|
||||||
|
try {
|
||||||
|
run(`upnpc -e "${Name}" -a ${config.ip} ${Number} ${Number} TCP`);
|
||||||
|
console.log(`Port added: "${Name}" ${Number} TCP`);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Port failed: "${Name}" ${Number} TCP`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Delete all AMP
|
// Delete all AMP
|
||||||
// for (const portMap of upnpPortList.split('\n')) {
|
// for (const portMap of upnpPortList.split('\n')) {
|
||||||
// if (portMap.includes("AMP")) {
|
// if (portMap.includes("AMP")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user