|
|
@ -1,4 +1,4 @@ |
|
|
|
var path = require('path'); |
|
|
|
var pathmodule = require('path'); |
|
|
|
var app = require('express')(); |
|
|
|
var http = require('http').Server(app); |
|
|
|
var https = require('https'); |
|
|
@ -117,7 +117,7 @@ return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), da |
|
|
|
// get pipelines
|
|
|
|
// ***************************************************
|
|
|
|
|
|
|
|
async function getpipelines(token) { |
|
|
|
async function getpipelines(token,pipelinename) { |
|
|
|
const agent = new https.Agent({ |
|
|
|
rejectUnauthorized: false, |
|
|
|
}); |
|
|
@ -133,21 +133,41 @@ async function getpipelines(token) { |
|
|
|
'Authorization': 'Bearer '+token |
|
|
|
} |
|
|
|
}) |
|
|
|
/* |
|
|
|
var params = { |
|
|
|
playbook: value |
|
|
|
} |
|
|
|
var options = { |
|
|
|
params: params, |
|
|
|
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, |
|
|
|
}; |
|
|
|
|
|
|
|
const playbook = await api.GET('playbookCode',options); |
|
|
|
return playbook |
|
|
|
*/ |
|
|
|
try { |
|
|
|
|
|
|
|
var pipelines = { |
|
|
|
"source":'ssologin' |
|
|
|
"querytokenFilter":'uWr4FKRqrmpCRkJ9WLuI0DNuDWOGTkfcSzyZkJirZvJwwFDffLWrraqzzSPLeuQqL3TF9', |
|
|
|
"filter":pipelinename |
|
|
|
} |
|
|
|
//var params = {
|
|
|
|
// pipeline: pipelines
|
|
|
|
// }
|
|
|
|
var params = { |
|
|
|
pipeline: pipelines |
|
|
|
querytokenFilter:'uWr4FKRqrmpCRkJ9WLuI0DNuDWOGTkfcSzyZkJirZvJwwFDffLWrraqzzSPLeuQqL3TF9', |
|
|
|
filter:pipelinename |
|
|
|
} |
|
|
|
|
|
|
|
var options = { |
|
|
|
params: params, |
|
|
|
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, |
|
|
|
}; |
|
|
|
|
|
|
|
//https://api.swarmlab.io/gettutorlabrooms?sort=pipelinename%7Casc&page=1&per_page=5&filter=&type=scripts&tutor=yes
|
|
|
|
instance.defaults.timeout = 30000; |
|
|
|
const res = await instance.get('/gettutorlabrooms',params,options); |
|
|
|
//const res = await instance.get('/getplaygrounds',params,options);
|
|
|
|
const res = await instance.get('/getplaygrounds',options); |
|
|
|
if(res.status == 200){ |
|
|
|
return res.data |
|
|
|
}else{ |
|
|
@ -175,6 +195,25 @@ global.online='ob'; |
|
|
|
watcher |
|
|
|
.on('add', function(path) { |
|
|
|
console.log('File', path, 'has been added'); |
|
|
|
var pathfile = pathmodule.basename(path); |
|
|
|
console.log('Filepath ', pathfile, ' check'); |
|
|
|
// /var/lab/playground-serverlogs/ondemand_playgroundnodejs_masterJPMqt1Jr-RgpMZFwJ-log
|
|
|
|
var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407" // desto
|
|
|
|
(async() => { |
|
|
|
var resdata = await getpipelines(token,path) |
|
|
|
console.log('info', JSON.stringify(resdata)); |
|
|
|
/* |
|
|
|
if(isvalid.action == 'ok'){ |
|
|
|
console.log("Authserver ok ", s.id + ' - ' + token); |
|
|
|
global.SOCKET.user = isvalid.user |
|
|
|
global.SOCKET.scope = isvalid.scope // space delimeter
|
|
|
|
global.SOCKET.token = isvalid.token |
|
|
|
s.auth = true; |
|
|
|
}else{ |
|
|
|
console.log("Authserver no ", s.id + ' - ' + token); |
|
|
|
} |
|
|
|
*/ |
|
|
|
})() |
|
|
|
}) |
|
|
|
.on('addDir', function(path) { |
|
|
|
console.log('Directory', path, 'has been added'); |
|
|
|