what
This commit is contained in:
1 parent
5823f809eb
commit
90130d7660
39 files changed
+787
-654
No files matched your search
@@ -38,7 +38,7 @@ const dependencies = [
|
|||||||
['bodyParser', 'body-parser'],
|
['bodyParser', 'body-parser'],
|
||||||
'path',
|
'path',
|
||||||
'fs',
|
'fs',
|
||||||
'node-cmd',
|
['cmd', 'node-cmd'],
|
||||||
['cookieParser', 'cookie-parser'],
|
['cookieParser', 'cookie-parser'],
|
||||||
'http', 'https',
|
'http', 'https',
|
||||||
['socket', 'socket.io'],
|
['socket', 'socket.io'],
|
||||||
@@ -54,7 +54,6 @@ for(let dep of dependencies){
|
|||||||
Functions.log({ action: 'info', data: `Loading '${name}' module` })
|
Functions.log({ action: 'info', data: `Loading '${name}' module` })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// other
|
// other
|
||||||
const
|
const
|
||||||
app = express(),
|
app = express(),
|
||||||
@@ -67,14 +66,6 @@ const
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// // ssl credentials
|
|
||||||
// if (conf.cert.key && conf.cert.crt && conf.cert.ca && conf.cert.enable)
|
|
||||||
// credentials = {
|
|
||||||
// key: fs.readFileSync(conf.cert.key, 'utf8'),
|
|
||||||
// cert: fs.readFileSync(conf.cert.crt, 'utf8'),
|
|
||||||
// ca: fs.readFileSync(conf.cert.ca, 'utf8')
|
|
||||||
// }
|
|
||||||
|
|
||||||
class DataBase {
|
class DataBase {
|
||||||
|
|
||||||
constructor(json) {
|
constructor(json) {
|
||||||
@@ -686,172 +677,167 @@ class Com {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(file, data) { // save data to file
|
// function save(file, data) { // save data to file
|
||||||
fs.writeFile(file, data, function (err) {
|
// fs.writeFile(file, data, function (err) {
|
||||||
if (err) {
|
// if (err) {
|
||||||
console.log(err);
|
// console.log(err);
|
||||||
return err;
|
// return err;
|
||||||
} else {
|
// } else {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
function dataparse(data) { // parse data coming from /data
|
// function dataparse(data) { // parse data coming from /data
|
||||||
l = data.length;
|
// l = data.length;
|
||||||
try {
|
// try {
|
||||||
obj = JSON.parse(data);
|
// obj = JSON.parse(data);
|
||||||
for (let key in obj) {
|
// for (let key in obj) {
|
||||||
if (key != "type") db.stats[key] = obj[key]
|
// if (key != "type") db.stats[key] = obj[key]
|
||||||
}
|
// }
|
||||||
|
|
||||||
Functions.log({
|
// Functions.log({
|
||||||
action: "data",
|
// action: "data",
|
||||||
data: "Data recieved succesfully. " + "[Length: " + l + "]"
|
// data: "Data recieved succesfully. " + "[Length: " + l + "]"
|
||||||
});
|
// });
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
Functions.log({
|
// Functions.log({
|
||||||
action: "err",
|
// action: "err",
|
||||||
data: "Invalid JSON string recieved. " + "[Length: " + l + "]"
|
// data: "Invalid JSON string recieved. " + "[Length: " + l + "]"
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
var to = 0
|
// var to = 0
|
||||||
switch (obj.type) {
|
// switch (obj.type) {
|
||||||
default: to = 0; break;
|
// default: to = 0; break;
|
||||||
case "stats":
|
// case "stats":
|
||||||
case "uptime": to = 9; break;
|
// case "uptime": to = 9; break;
|
||||||
|
|
||||||
case "network": to = 0; break;
|
// case "network": to = 0; break;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// emto(obj, to)
|
// // emto(obj, to)
|
||||||
Functions.blink();
|
// Functions.blink();
|
||||||
}
|
// }
|
||||||
|
|
||||||
function gpath(dir, arg) { // get path
|
// function gpath(dir, arg) { // get path
|
||||||
|
|
||||||
var path = [];
|
// var path = [];
|
||||||
|
|
||||||
Functions.isDefined(arg, ""); // if no user argument replace with empty
|
// Functions.isDefined(arg, ""); // if no user argument replace with empty
|
||||||
|
|
||||||
if (arg.startsWith("\/")) { // if arg is absolute, dont merge
|
// if (arg.startsWith("\/")) { // if arg is absolute, dont merge
|
||||||
path = arg.slice(1).split("\/");
|
// path = arg.slice(1).split("\/");
|
||||||
} else { // if arg is relative, merge
|
// } else { // if arg is relative, merge
|
||||||
if (!dir.startsWith("/")) dir = "/" + dir;
|
// if (!dir.startsWith("/")) dir = "/" + dir;
|
||||||
path = (dir + "/" + arg).slice(1).split("\/");
|
// path = (dir + "/" + arg).slice(1).split("\/");
|
||||||
}
|
// }
|
||||||
|
|
||||||
while (path.indexOf("..") != -1) { // remove realtive paths (..)
|
// while (path.indexOf("..") != -1) { // remove realtive paths (..)
|
||||||
if (path.indexOf("..") == 0) { // stop on empty
|
// if (path.indexOf("..") == 0) { // stop on empty
|
||||||
path = [""];
|
// path = [""];
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
z = path.indexOf(".."); // get index of (..)
|
// z = path.indexOf(".."); // get index of (..)
|
||||||
b = path.slice(0, z - 1); // get first half of path, without one stepdown
|
// b = path.slice(0, z - 1); // get first half of path, without one stepdown
|
||||||
c = path.slice(z + 1); // get second half, without (..)
|
// c = path.slice(z + 1); // get second half, without (..)
|
||||||
path = b.concat(c); // concat halves
|
// path = b.concat(c); // concat halves
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (path[path.length - 1] == "") path.splice(-1, 1); //remove empty dir at end
|
// if (path[path.length - 1] == "") path.splice(-1, 1); //remove empty dir at end
|
||||||
if (path[0] != "") path.unshift(""); // if no root path, add at beginning
|
// if (path[0] != "") path.unshift(""); // if no root path, add at beginning
|
||||||
if (path.length == 0) path.push(""); // if empty, add root dir
|
// if (path.length == 0) path.push(""); // if empty, add root dir
|
||||||
|
|
||||||
return path
|
// return path
|
||||||
}
|
// }
|
||||||
|
|
||||||
function gdir(path) { // get directory
|
// function gdir(path) { // get directory
|
||||||
if ((path.length == 0) || (path[0] == "")) {
|
// if ((path.length == 0) || (path[0] == "")) {
|
||||||
obj = filess;
|
// obj = filess;
|
||||||
}
|
// }
|
||||||
// else
|
// // else
|
||||||
// if(typeof(filess[path[0]]!="undefined")){
|
// // if(typeof(filess[path[0]]!="undefined")){
|
||||||
// obj = filess[path[0]];
|
// // obj = filess[path[0]];
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
for (i = 1; i < path.length; i++) {
|
// for (i = 1; i < path.length; i++) {
|
||||||
if (obj == null) break;
|
// if (obj == null) break;
|
||||||
if (typeof obj[path[i]] != "undefined") {
|
// if (typeof obj[path[i]] != "undefined") {
|
||||||
if (typeof obj[path[i]] != "object") {
|
// if (typeof obj[path[i]] != "object") {
|
||||||
obj = null
|
// obj = null
|
||||||
} else obj = obj[path[i]]
|
// } else obj = obj[path[i]]
|
||||||
} else obj = null
|
// } else obj = null
|
||||||
}
|
// }
|
||||||
return obj;
|
// return obj;
|
||||||
}
|
// }
|
||||||
|
|
||||||
function sfile(path, socket, id) { // get file
|
// function sfile(path, socket, id) { // get file
|
||||||
obj = gdir(path.slice(0, path.length - 1));
|
// obj = gdir(path.slice(0, path.length - 1));
|
||||||
if (obj == null) {
|
// if (obj == null) {
|
||||||
coms({
|
// coms({
|
||||||
data: "err: invalid directory",
|
// data: "err: invalid directory",
|
||||||
arg: [],
|
// arg: [],
|
||||||
flag: 0,
|
// flag: 0,
|
||||||
id: id
|
// id: id
|
||||||
}, socket);
|
// }, socket);
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
if (typeof obj[path[path.length - 1]] == "undefined") {
|
// if (typeof obj[path[path.length - 1]] == "undefined") {
|
||||||
coms({
|
// coms({
|
||||||
data: "err: file doesn't exist",
|
// data: "err: file doesn't exist",
|
||||||
arg: [],
|
// arg: [],
|
||||||
flag: 0,
|
// flag: 0,
|
||||||
id: id
|
// id: id
|
||||||
}, socket);
|
// }, socket);
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
if ((typeof obj[path[path.length - 1]].data == "undefined") && (typeof obj[path[path.length - 1]].link != "undefined")) {
|
// if ((typeof obj[path[path.length - 1]].data == "undefined") && (typeof obj[path[path.length - 1]].link != "undefined")) {
|
||||||
fs.readFile("files/" + obj[path[path.length - 1]].link, "utf8", function (err, fdata) {
|
// fs.readFile("files/" + obj[path[path.length - 1]].link, "utf8", function (err, fdata) {
|
||||||
if (err) {
|
// if (err) {
|
||||||
coms({
|
// coms({
|
||||||
data: err,
|
// data: err,
|
||||||
arg: [],
|
// arg: [],
|
||||||
flag: 0,
|
// flag: 0,
|
||||||
id: id
|
// id: id
|
||||||
}, socket);
|
// }, socket);
|
||||||
} else {
|
// } else {
|
||||||
coms({
|
// coms({
|
||||||
data: fdata,
|
// data: fdata,
|
||||||
arg: [],
|
// arg: [],
|
||||||
flag: 0,
|
// flag: 0,
|
||||||
id: id
|
// id: id
|
||||||
}, socket);
|
// }, socket);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
if (typeof obj[path[path.length - 1]].static != "undefined") coms({
|
// if (typeof obj[path[path.length - 1]].static != "undefined") coms({
|
||||||
data: "<a href='static/" + obj[path[path.length - 1]].static + "'>" + obj[path[path.length - 1]].static + "</a>",
|
// data: "<a href='static/" + obj[path[path.length - 1]].static + "'>" + obj[path[path.length - 1]].static + "</a>",
|
||||||
arg: [],
|
// arg: [],
|
||||||
flag: 0,
|
// flag: 0,
|
||||||
id: id
|
// id: id
|
||||||
}, socket);
|
// }, socket);
|
||||||
else coms({
|
// else coms({
|
||||||
data: obj[path[path.length - 1]].data,
|
// data: obj[path[path.length - 1]].data,
|
||||||
arg: [],
|
// arg: [],
|
||||||
flag: 0,
|
// flag: 0,
|
||||||
id: id
|
// id: id
|
||||||
}, socket);
|
// }, socket);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
function fsearch(dir, name) {
|
// function fsearch(dir, name) {
|
||||||
var is = false;
|
// var is = false;
|
||||||
for (let key in dir) {
|
// for (let key in dir) {
|
||||||
if ((typeof dir[key].data != 'undefined') || (typeof dir[key].link != 'undefined')) {
|
// if ((typeof dir[key].data != 'undefined') || (typeof dir[key].link != 'undefined')) {
|
||||||
if (name === key) is = true;
|
// if (name === key) is = true;
|
||||||
} else {
|
// } else {
|
||||||
is = fsearch(dir[key], name);
|
// is = fsearch(dir[key], name);
|
||||||
}
|
// }
|
||||||
if (is) break;
|
// if (is) break;
|
||||||
}
|
// }
|
||||||
return is
|
// return is
|
||||||
}
|
// }
|
||||||
|
|
||||||
function exit(sig) {
|
|
||||||
console.log(`\n${sig}`)
|
|
||||||
process.exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// express setup
|
// express setup
|
||||||
app
|
app
|
||||||
@@ -878,15 +864,12 @@ app
|
|||||||
// server setup
|
// server setup
|
||||||
|
|
||||||
const httpServer = http.createServer(app),
|
const httpServer = http.createServer(app),
|
||||||
io = new socket()
|
io = new socket(httpServer)
|
||||||
.attach(httpServer)
|
|
||||||
|
|
||||||
if (conf.cert.enable) {
|
process.on('SIGINT', sig => {
|
||||||
const httpsServer = https.createServer(credentials, app)
|
console.log(`\n${sig}`)
|
||||||
io.attach(httpsServer)
|
process.exit(0)
|
||||||
}
|
})
|
||||||
|
|
||||||
process.on('SIGINT', exit)
|
|
||||||
|
|
||||||
// stdin input listener
|
// stdin input listener
|
||||||
stdin.addListener("data", function (d) {
|
stdin.addListener("data", function (d) {
|
||||||
@@ -999,11 +982,7 @@ app.get('/', function (req, res) {
|
|||||||
) {
|
) {
|
||||||
res.redirect('https://' + req.hostname + req.originalUrl);
|
res.redirect('https://' + req.hostname + req.originalUrl);
|
||||||
} else {
|
} else {
|
||||||
res.render('pages/index', {
|
res.sendFile(path.join(__dirname, 'public/index.html'));
|
||||||
vars: {
|
|
||||||
hostname: db.config.hostname
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"verbose": true,
|
"verbose": true,
|
||||||
"ignore": ["main.js", "logs", "db.json"]
|
"ignore": ["main.js", "logs", "db.json", "public/packages/*"]
|
||||||
}
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="pl">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<!-- Document configuration -->
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
|
<meta name="theme-color" content="#272626">
|
||||||
|
<meta name="google-site-verification" content="qQeOFnhYi_FvBiPv_mYzmZiWHBTapnWGLWmyE-novig" />
|
||||||
|
<title>smart-home</title>
|
||||||
|
|
||||||
|
<!-- Icons -->
|
||||||
|
<link rel="shortcut icon" href="img/favicon.ico" sizes="128x128">
|
||||||
|
<link rel="shortcut icon" href="img/favicon.png" sizes="192x192">
|
||||||
|
<link rel="shortcut icon" href="img/faviconb.png" sizes="512x512">
|
||||||
|
|
||||||
|
<!-- Libraries from external CDNs -->
|
||||||
|
<!-- <script rel="preload" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> -->
|
||||||
|
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script> -->
|
||||||
|
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script> -->
|
||||||
|
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script> -->
|
||||||
|
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/atom-one-dark.min.css"> -->
|
||||||
|
|
||||||
|
<!-- Google Fonts -->
|
||||||
|
<!-- <link href="https://fonts.googleapis.com/css?family=Lato:400,700&subset=latin,latin-ext" rel="stylesheet" type="text/css"> -->
|
||||||
|
<!-- <link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" rel="stylesheet"> -->
|
||||||
|
|
||||||
|
<script src="res/jquery-3.3.1.min.js"></script>
|
||||||
|
<script src="res/socket.io.slim.js"></script>
|
||||||
|
<script rel="preload" src="/main.js"></script>
|
||||||
|
|
||||||
|
<link href="res/fontello.css" rel="stylesheet" type="text/css" />
|
||||||
|
<!-- <link href="fontello/css/fontello.css" rel="stylesheet" type="text/css" /> -->
|
||||||
|
<!-- <link href="hljsct.css" rel="stylesheet" type="text/css" /> -->
|
||||||
|
|
||||||
|
<link rel="manifest" href="manifest.json">
|
||||||
|
<link href="style.css" rel="stylesheet" type="text/css" />
|
||||||
|
<!-- <link href="tree.min.css" rel="stylesheet" type="text/css" /> -->
|
||||||
|
<!-- <script src="chart.min.js"></script> -->
|
||||||
|
|
||||||
|
<!-- <script src="highlight.min.js"></script> -->
|
||||||
|
<!-- <link rel="stylesheet" href="atom-one-dark.min.css"> -->
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<noscript><span class="command">
|
||||||
|
<txred>### Error: </txred>Javascript disabled<br>
|
||||||
|
</span></noscript>
|
||||||
|
</body>
|
||||||
+251
-466
@@ -1,186 +1,3 @@
|
|||||||
class H {
|
|
||||||
constructor(type) {
|
|
||||||
if ((typeof type != 'string') && (typeof type != 'object')) {
|
|
||||||
throw new Error('invalid object type')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type instanceof Node)
|
|
||||||
this.element = [type]
|
|
||||||
else if (type instanceof NodeList)
|
|
||||||
this.element = type
|
|
||||||
else
|
|
||||||
this.element = [document.createElement(type)]
|
|
||||||
}
|
|
||||||
|
|
||||||
addClass(...classNames) {
|
|
||||||
for (let key of classNames) {
|
|
||||||
for (let e of this.element) {
|
|
||||||
if (e.classList)
|
|
||||||
e.classList.add(key);
|
|
||||||
else
|
|
||||||
e.className += ' ' + key;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
removeClass(...classNames) {
|
|
||||||
for (let key of classNames) {
|
|
||||||
for (let e of this.element) {
|
|
||||||
if (e.classList)
|
|
||||||
e.classList.remove(key);
|
|
||||||
else
|
|
||||||
e.className = e.className.replace(new RegExp(`\\b${key}\\b`), "");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
setProp(properties) {
|
|
||||||
for (let prop in properties) {
|
|
||||||
for (let e of this.element) {
|
|
||||||
e.setAttribute(prop, properties[prop])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
append(...children) {
|
|
||||||
for (let child of children) {
|
|
||||||
var content = typeof child == 'string' ? document.createTextNode(child) : (child instanceof H ? child.element : child)
|
|
||||||
if (!(content instanceof Node)) {
|
|
||||||
if ((content instanceof NodeList) || (content instanceof Array)) {
|
|
||||||
for (var e of this.element) {
|
|
||||||
for (var se of content) {
|
|
||||||
e.appendChild(se)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
} else
|
|
||||||
throw new Error("Invalid input argument")
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let e of this.element) {
|
|
||||||
e.appendChild(content)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
remove() {
|
|
||||||
this.element.forEach(e => {
|
|
||||||
e.parentNode.removeChild(e)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
siblings() {
|
|
||||||
|
|
||||||
var siblings = []
|
|
||||||
|
|
||||||
for (let e of this.element) {
|
|
||||||
var sibling = e.parentNode.firstChild;
|
|
||||||
|
|
||||||
// Loop through each sibling and push to the array
|
|
||||||
while (sibling) {
|
|
||||||
if (sibling.nodeType === 1 && sibling !== e) {
|
|
||||||
siblings.push(sibling);
|
|
||||||
}
|
|
||||||
sibling = sibling.nextSibling
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return siblings;
|
|
||||||
};
|
|
||||||
|
|
||||||
data(obj) {
|
|
||||||
if (typeof obj == 'string') {
|
|
||||||
return this.element[0].dataset[obj]
|
|
||||||
}
|
|
||||||
for (let key in obj) {
|
|
||||||
this.element[0].dataset[key] = obj[key]
|
|
||||||
}
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
ready(fn) {
|
|
||||||
document.addEventListener('DOMContentLoaded', fn, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
on(e, t, f) {
|
|
||||||
switch (arguments.length) {
|
|
||||||
default:
|
|
||||||
case 1: throw new Error("Invalid arguments set")
|
|
||||||
case 2:
|
|
||||||
var ename = arguments[0],
|
|
||||||
target = '*',
|
|
||||||
fn = arguments[1]
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
var ename = arguments[0],
|
|
||||||
target = arguments[1]
|
|
||||||
fn = arguments[2]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let e of this.element) {
|
|
||||||
e.addEventListener(ename, e => {
|
|
||||||
if (e.target.matches(target))
|
|
||||||
fn()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return this
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static sel(selector) {
|
|
||||||
if (selector instanceof Node) return new H(selector)
|
|
||||||
return new H(document.querySelectorAll(selector))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(cname) {
|
|
||||||
/**
|
|
||||||
* Get cookie
|
|
||||||
* @param {string} cname cookie name
|
|
||||||
*
|
|
||||||
* @returns {string} cookie content (undefined if doesn't exist)
|
|
||||||
*/
|
|
||||||
|
|
||||||
var name = cname + "=";
|
|
||||||
var decodedCookie = decodeURIComponent(document.cookie);
|
|
||||||
var ca = decodedCookie.split(';');
|
|
||||||
for (var i = 0; i < ca.length; i++) {
|
|
||||||
var c = ca[i];
|
|
||||||
while (c.charAt(0) == ' ') {
|
|
||||||
c = c.substring(1);
|
|
||||||
}
|
|
||||||
if (c.indexOf(name) == 0)
|
|
||||||
return c.substring(name.length, c.length);
|
|
||||||
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCookie(cname, cvalue, exdays) {
|
|
||||||
/**
|
|
||||||
* Set cookie
|
|
||||||
* @param cname cookie name
|
|
||||||
* @param cvalue cookie value
|
|
||||||
* @param exdays cookie expiry in days
|
|
||||||
*
|
|
||||||
* @returns {undefined}
|
|
||||||
*/
|
|
||||||
|
|
||||||
var d = new Date();
|
|
||||||
isDefined(exdays, 3650);
|
|
||||||
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
|
|
||||||
document.cookie = cname + "=" + cvalue + ";expires=" + d.toUTCString() + ";path=/";
|
|
||||||
}
|
|
||||||
|
|
||||||
// function escapeh(unsafe) {
|
// function escapeh(unsafe) {
|
||||||
// if (typeof unsafe != "string") return unsafe;
|
// if (typeof unsafe != "string") return unsafe;
|
||||||
// return unsafe
|
// return unsafe
|
||||||
@@ -309,6 +126,50 @@ function makeID(n) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function date(format) {
|
||||||
|
/**
|
||||||
|
* thiserates current date in specified format
|
||||||
|
* long - DD/MM/YYYY HH:MM:SS
|
||||||
|
* log - DD/MMM HH:MM:SS
|
||||||
|
* tiny - MM:SS,SSS
|
||||||
|
* @param {string} format date format
|
||||||
|
*
|
||||||
|
* @returns {string} date in specified format
|
||||||
|
*/
|
||||||
|
|
||||||
|
var d = new Date,
|
||||||
|
out = new String,
|
||||||
|
h = d.getHours() < 10 ? "0" + d.getHours() : d.getHours(),
|
||||||
|
m = d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes(),
|
||||||
|
s = d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds(),
|
||||||
|
ms = (function () {
|
||||||
|
let ms = d.getMilliseconds()
|
||||||
|
return ms < 10 ? '00' + ms : (ms < 100 ? '0' + ms : ms)
|
||||||
|
})()
|
||||||
|
|
||||||
|
switch (format) {
|
||||||
|
default:
|
||||||
|
case 'long':
|
||||||
|
out = d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + m + ":" + s
|
||||||
|
break;
|
||||||
|
case 'log':
|
||||||
|
let p = new Date().toString().replace(/[A-Z]{3}\+/, '+').split(/ /)
|
||||||
|
out = p[2] + '/' + p[1] + ' ' + p[4]
|
||||||
|
break;
|
||||||
|
case 'tiny':
|
||||||
|
out = `${h}:${m}:${s}.${ms}`
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
function timestamp() {
|
||||||
|
return $('<txdrk></txdrk>')
|
||||||
|
.addClass('timestamp')
|
||||||
|
.append(date('tiny') + ' ')
|
||||||
|
}
|
||||||
|
|
||||||
function download(content, filename) {
|
function download(content, filename) {
|
||||||
/**
|
/**
|
||||||
* Download variable as file
|
* Download variable as file
|
||||||
@@ -630,36 +491,13 @@ function setSession(key, value) {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCookie(key) {
|
function resource(link) {
|
||||||
var name = key + "=";
|
|
||||||
var decodedCookie = decodeURIComponent(document.cookie);
|
|
||||||
var ca = decodedCookie.split(';');
|
|
||||||
for (var i = 0; i < ca.length; i++) {
|
|
||||||
var c = ca[i];
|
|
||||||
while (c.charAt(0) == ' ') {
|
|
||||||
c = c.substring(1);
|
|
||||||
}
|
|
||||||
if (c.indexOf(name) == 0) {
|
|
||||||
return c.substring(name.length, c.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCookie(key, value, exdays) {
|
|
||||||
var d = new Date();
|
|
||||||
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
|
|
||||||
var expires = "expires=" + d.toUTCString();
|
|
||||||
document.cookie = key + "=" + value + ";" + expires + ";path=/";
|
|
||||||
}
|
|
||||||
|
|
||||||
function resource(link){
|
|
||||||
fetch(link)
|
fetch(link)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
data.text()
|
data.text()
|
||||||
.then(text => {
|
.then(text => {
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1043,17 +881,17 @@ class Elements {
|
|||||||
.prop("spellcheck", false)
|
.prop("spellcheck", false)
|
||||||
.prop("autofocus", true)
|
.prop("autofocus", true)
|
||||||
)
|
)
|
||||||
.append(
|
// .append(
|
||||||
$("<span></span>")
|
// $("<span></span>")
|
||||||
.addClass("icons")
|
// .addClass("icons")
|
||||||
.append(
|
// .append(
|
||||||
$("<i></i>").addClass("icon-volume-up"),
|
// $("<i></i>").addClass("icon-volume-up"),
|
||||||
$("<i></i>").addClass("icon-lock-open"),
|
// $("<i></i>").addClass("icon-lock-open"),
|
||||||
$("<i></i>").addClass("icon-trash"),
|
// $("<i></i>").addClass("icon-trash"),
|
||||||
$("<i></i>").addClass("icon-level-down"),
|
// $("<i></i>").addClass("icon-level-down"),
|
||||||
$("<i></i>").addClass("icon-unlink")
|
// $("<i></i>").addClass("icon-unlink")
|
||||||
)
|
// )
|
||||||
)
|
// )
|
||||||
)
|
)
|
||||||
$("body").append($wind);
|
$("body").append($wind);
|
||||||
}
|
}
|
||||||
@@ -1066,74 +904,74 @@ class Elements {
|
|||||||
this.$commin = $wind.children(".commline").children(".commin");
|
this.$commin = $wind.children(".commline").children(".commin");
|
||||||
this.$jsonl = $wind.children(".jsonl");
|
this.$jsonl = $wind.children(".jsonl");
|
||||||
|
|
||||||
this.$commin.on("blur", function () {
|
// this.$commin.on("blur", function () {
|
||||||
if ($(this).closest(".wind").data("con").scroll) {
|
// if ($(this).closest(".wind").data("con").scroll) {
|
||||||
this.focus();
|
// this.focus();
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
|
||||||
var icons = $wind.children(".commline").children(".icons");
|
var icons = $wind.children(".commline").children(".icons");
|
||||||
|
|
||||||
this.icons = {};
|
// this.icons = {};
|
||||||
|
|
||||||
this.icons.$trash = icons.children("i.icon-trash");
|
// this.icons.$trash = icons.children("i.icon-trash");
|
||||||
this.icons.$trash.on("click", function () {
|
// this.icons.$trash.on("click", function () {
|
||||||
$(this).closest(".wind").data("con").clear();
|
// $(this).closest(".wind").data("con").clear();
|
||||||
})
|
// })
|
||||||
|
|
||||||
this.icons.$levelDown = icons.children("i.icon-level-down");
|
// this.icons.$levelDown = icons.children("i.icon-level-down");
|
||||||
this.icons.$levelDown.on("click", function () {
|
// this.icons.$levelDown.on("click", function () {
|
||||||
$(this).closest(".wind").data("con").scrollBottom(true);
|
// $(this).closest(".wind").data("con").scrollBottom(true);
|
||||||
})
|
// })
|
||||||
|
|
||||||
this.icons.$volume = icons.children("i.icon-volume-up");
|
// this.icons.$volume = icons.children("i.icon-volume-up");
|
||||||
|
|
||||||
this.icons.$lock = icons.children("i.icon-lock-open");
|
// this.icons.$lock = icons.children("i.icon-lock-open");
|
||||||
this.icons.$lock.change = function () {
|
// this.icons.$lock.change = function () {
|
||||||
var con = $wind.data("con")
|
// var con = $wind.data("con")
|
||||||
if (!con.scroll) {
|
// if (!con.scroll) {
|
||||||
this.removeClass();
|
// this.removeClass();
|
||||||
this.addClass("icon-lock-open");
|
// this.addClass("icon-lock-open");
|
||||||
con.scroll = true;
|
// con.scroll = true;
|
||||||
con.elements.$commin.focus();
|
// con.elements.$commin.focus();
|
||||||
} else {
|
// } else {
|
||||||
this.removeClass();
|
// this.removeClass();
|
||||||
this.addClass("icon-lock");
|
// this.addClass("icon-lock");
|
||||||
con.scroll = false;
|
// con.scroll = false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
this.icons.$lock.on("click", function () {
|
// this.icons.$lock.on("click", function () {
|
||||||
$(this).closest(".wind").data("con").elements.icons.$lock.change();
|
// $(this).closest(".wind").data("con").elements.icons.$lock.change();
|
||||||
});
|
// });
|
||||||
|
|
||||||
this.icons.$connection = icons.children("i.icon-unlink");
|
// this.icons.$connection = icons.children("i.icon-unlink");
|
||||||
this.icons.$connection.blink = function () {
|
// this.icons.$connection.blink = function () {
|
||||||
this.addClass("txgrn glow");
|
// this.addClass("txgrn glow");
|
||||||
setTimeout(function (icon) {
|
// setTimeout(function (icon) {
|
||||||
icon.removeClass("txgrn glow");
|
// icon.removeClass("txgrn glow");
|
||||||
}, 200, this);
|
// }, 200, this);
|
||||||
}
|
// }
|
||||||
this.icons.$connection.on("click", function () {
|
// this.icons.$connection.on("click", function () {
|
||||||
$(this).closest(".wind").data("con").executeCom("connection");
|
// $(this).closest(".wind").data("con").executeCom("connection");
|
||||||
})
|
// })
|
||||||
|
|
||||||
this.icons.$lock.enable = function () {
|
// this.icons.$lock.enable = function () {
|
||||||
this.removeClass();
|
// this.removeClass();
|
||||||
this.addClass("icon-lock-closed");
|
// this.addClass("icon-lock-closed");
|
||||||
}
|
// }
|
||||||
this.icons.$lock.disable = function () {
|
// this.icons.$lock.disable = function () {
|
||||||
this.removeClass();
|
// this.removeClass();
|
||||||
this.addClass("icon-lock");
|
// this.addClass("icon-lock");
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.icons.$connection.enable = function () {
|
// this.icons.$connection.enable = function () {
|
||||||
this.removeClass();
|
// this.removeClass();
|
||||||
this.addClass("icon-link");
|
// this.addClass("icon-link");
|
||||||
}
|
// }
|
||||||
this.icons.$connection.disable = function () {
|
// this.icons.$connection.disable = function () {
|
||||||
this.removeClass();
|
// this.removeClass();
|
||||||
this.addClass("icon-unlink");
|
// this.addClass("icon-unlink");
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.$commline = $wind.children(".commline");
|
this.$commline = $wind.children(".commline");
|
||||||
this.$commline.enable = function () {
|
this.$commline.enable = function () {
|
||||||
@@ -1163,7 +1001,6 @@ class Request {
|
|||||||
this.id = com.id;
|
this.id = com.id;
|
||||||
this.con = com.con.id;
|
this.con = com.con.id;
|
||||||
this.udata = com.con.udata;
|
this.udata = com.con.udata;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1195,16 +1032,16 @@ class Com {
|
|||||||
this.log = this.con.log // log method
|
this.log = this.con.log // log method
|
||||||
|
|
||||||
this._append()
|
this._append()
|
||||||
if(!this._local())
|
if (!this._local())
|
||||||
this._send()
|
this._send()
|
||||||
}
|
}
|
||||||
|
|
||||||
// append Com object to Con.commands
|
|
||||||
_append() {
|
_append() {
|
||||||
this.$elem = $("<div></div>")
|
this.$elem = $("<div></div>")
|
||||||
.prop("id", this.id)
|
.prop("id", this.id)
|
||||||
.addClass("command")
|
.addClass("command")
|
||||||
.append(
|
.append(
|
||||||
|
timestamp(),
|
||||||
this.$ud = $("<span></span>")
|
this.$ud = $("<span></span>")
|
||||||
.addClass("ud")
|
.addClass("ud")
|
||||||
.append(
|
.append(
|
||||||
@@ -1242,7 +1079,7 @@ class Com {
|
|||||||
|
|
||||||
switch (this.c) {
|
switch (this.c) {
|
||||||
default:
|
default:
|
||||||
if (this.con.socket.connected != true) {
|
if (this.con.Socket.socket.connected != true) {
|
||||||
this.log("socket disconnected", "error");
|
this.log("socket disconnected", "error");
|
||||||
this.insertResponse();
|
this.insertResponse();
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1344,7 +1181,7 @@ class Com {
|
|||||||
this._startLoading(); // start loading animation
|
this._startLoading(); // start loading animation
|
||||||
this.req = new Request(this); // create Request object
|
this.req = new Request(this); // create Request object
|
||||||
|
|
||||||
this.con.socket.emit("com", this.req); // send Request object
|
this.con.Socket.socket.emit("com", this.req); // send Request object
|
||||||
|
|
||||||
this.timer = setTimeout(function (com) { // set server timeout
|
this.timer = setTimeout(function (com) { // set server timeout
|
||||||
com.timeout(false); // call server response timeout
|
com.timeout(false); // call server response timeout
|
||||||
@@ -1383,7 +1220,7 @@ class Com {
|
|||||||
this.con.scrollBottom(false); // scroll to end of page (non-force)
|
this.con.scrollBottom(false); // scroll to end of page (non-force)
|
||||||
}
|
}
|
||||||
|
|
||||||
_unpack(res){
|
_unpack(res) {
|
||||||
switch (res.meta.flag) {
|
switch (res.meta.flag) {
|
||||||
default:
|
default:
|
||||||
case 0: // standard response, append data as plaintext
|
case 0: // standard response, append data as plaintext
|
||||||
@@ -1414,7 +1251,7 @@ class Com {
|
|||||||
$(this.con.elements.$commpath).html(data.data); // append response to command list
|
$(this.con.elements.$commpath).html(data.data); // append response to command list
|
||||||
break;
|
break;
|
||||||
case 6: // log response
|
case 6: // log response
|
||||||
this.log(res.data, res.meta.arg);
|
this.log(res.data.data, res.meta.arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
@@ -1431,7 +1268,7 @@ class Com {
|
|||||||
|
|
||||||
case 11: // toSyntax
|
case 11: // toSyntax
|
||||||
return toSyntax(res.data);
|
return toSyntax(res.data);
|
||||||
|
|
||||||
case 12: // ping
|
case 12: // ping
|
||||||
this.formatted =
|
this.formatted =
|
||||||
`${this.res.data} [${Math.floor(((performance.now() - this.time) - this.res.time[this.res.time.length - 1][0]) * 1000) / 1000} ms]`;
|
`${this.res.data} [${Math.floor(((performance.now() - this.time) - this.res.time[this.res.time.length - 1][0]) * 1000) / 1000} ms]`;
|
||||||
@@ -1457,7 +1294,6 @@ class Com {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
insertResponse() {
|
insertResponse() {
|
||||||
|
|
||||||
this._stopLoading(); // stop loading animation
|
this._stopLoading(); // stop loading animation
|
||||||
@@ -1469,19 +1305,17 @@ class Com {
|
|||||||
this.sr = $("<div></div>") // create response element
|
this.sr = $("<div></div>") // create response element
|
||||||
.append(this.formatted)
|
.append(this.formatted)
|
||||||
.addClass("sr")
|
.addClass("sr")
|
||||||
.hide()
|
// .hide()
|
||||||
|
|
||||||
this.$elem // append response data to Com element
|
this.$elem // append response data to Com element
|
||||||
.append(this.sr)
|
.append(this.sr)
|
||||||
|
|
||||||
|
|
||||||
this.sr.slideDown(200); // animate response div
|
// this.sr.slideDown(200); // animate response div
|
||||||
this.con.scrollBottom(false); // scroll to end of page (non-force)
|
this.con.scrollBottom(false); // scroll to end of page (non-force)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
remove() {
|
remove() {
|
||||||
this.$elem.remove();
|
this.$elem.remove();
|
||||||
}
|
}
|
||||||
@@ -1545,10 +1379,6 @@ class Com {
|
|||||||
this.con.elements.$commline.enable(); // enable commline
|
this.con.elements.$commline.enable(); // enable commline
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Con {
|
class Con {
|
||||||
@@ -1556,7 +1386,6 @@ class Con {
|
|||||||
constructor($wind) {
|
constructor($wind) {
|
||||||
|
|
||||||
this.id = makeID(6) // Con ID
|
this.id = makeID(6) // Con ID
|
||||||
this.socket = undefined; // socket connection object
|
|
||||||
this.elements = new Elements($wind); // DOM elements object
|
this.elements = new Elements($wind); // DOM elements object
|
||||||
|
|
||||||
// commands input history
|
// commands input history
|
||||||
@@ -1607,7 +1436,6 @@ class Con {
|
|||||||
this.fConnect = false; // first connect event flag
|
this.fConnect = false; // first connect event flag
|
||||||
// this.fAuth = false; // first auth event flag
|
// this.fAuth = false; // first auth event flag
|
||||||
this.first = false
|
this.first = false
|
||||||
this.udataExp = false; // auth credentials viability
|
|
||||||
this.verbose = Config.verbose; // log display level
|
this.verbose = Config.verbose; // log display level
|
||||||
|
|
||||||
// credentials
|
// credentials
|
||||||
@@ -1620,53 +1448,10 @@ class Con {
|
|||||||
shortid: undefined
|
shortid: undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
// trigger ready event after init
|
$(this.$wind).ready(()=>{
|
||||||
$($wind).ready(this.ready());
|
this._ready()
|
||||||
|
});
|
||||||
}
|
// this._ready()
|
||||||
|
|
||||||
set uAuth(val) {
|
|
||||||
|
|
||||||
if ((val === true) || (val === false))
|
|
||||||
this.udataExp = val
|
|
||||||
|
|
||||||
if (!val) this.log("User auth data expired", "warning", 3)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
get uAuth() {
|
|
||||||
|
|
||||||
return this.udataExp
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
receive(res) {
|
|
||||||
|
|
||||||
this.getCom(res.res.id).update(res);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
auth(udata) {
|
|
||||||
|
|
||||||
con.log("Auth data received", "ok", 2);
|
|
||||||
this.udata = udata;
|
|
||||||
this.uAuth = true;
|
|
||||||
this.elements.$commuser.change(this.udata.login, this.udata.badge);
|
|
||||||
// if (!this.fAuth) this.firstAuth()
|
|
||||||
this.motd()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
tryAuth() {
|
|
||||||
|
|
||||||
if(con.credentials){
|
|
||||||
con.socket.emit("auth", con.credentials);
|
|
||||||
con.log("Requesting authentication", "info", 2);
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
con.log("No credentials found", "info", 2);
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1740,6 +1525,7 @@ class Con {
|
|||||||
var out = $("<div></div>")
|
var out = $("<div></div>")
|
||||||
.addClass('inline')
|
.addClass('inline')
|
||||||
.append(
|
.append(
|
||||||
|
timestamp(),
|
||||||
$('<tx></tx>')
|
$('<tx></tx>')
|
||||||
.addClass(opt[0])
|
.addClass(opt[0])
|
||||||
.append("#".repeat(lvl))
|
.append("#".repeat(lvl))
|
||||||
@@ -1852,13 +1638,7 @@ class Con {
|
|||||||
}
|
}
|
||||||
|
|
||||||
commandHistory(key) {
|
commandHistory(key) {
|
||||||
// if(key==38)
|
|
||||||
// this.elements.commin.val(this.history.up);
|
|
||||||
// else if(key==40)
|
|
||||||
// this.elements.commin.val(this.history.down);
|
|
||||||
|
|
||||||
this.elements.$commin.val(key == 38 ? this.history.up : (key == 40 ? this.history.down : ""));
|
this.elements.$commin.val(key == 38 ? this.history.up : (key == 40 ? this.history.down : ""));
|
||||||
|
|
||||||
this.elements.$commin.focus();
|
this.elements.$commin.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1880,108 +1660,77 @@ class Con {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// firstAuth() {
|
_getPackage(name) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
// this.log("First auth", "info", 3)
|
|
||||||
|
|
||||||
// this.fAuth = true;
|
this.log(`Requesting ${name} module`, 'info')
|
||||||
// }
|
import(`./packages/${name}.js`)
|
||||||
|
.then(mod => {
|
||||||
|
this.log(`Downloaded ${name} module`, 'ok')
|
||||||
|
console.log(mod)
|
||||||
|
switch(mod.type){
|
||||||
|
case 'sub':
|
||||||
|
this[name] = new mod.default(this)
|
||||||
|
break;
|
||||||
|
case 'class':
|
||||||
|
this[name] = mod.default
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
this.log(`Downloading ${name} module failed: ${err}`, 'error')
|
||||||
|
|
||||||
motd() {
|
reject()
|
||||||
if(this.first) return
|
})
|
||||||
this.first = true
|
|
||||||
this.executeCom("motd");
|
|
||||||
if (location.hash != "") {
|
// var tag = document.createElement('script')
|
||||||
this.log(`Executing command from URI (${location.hash.slice(1)})`, "info", 3)
|
// tag.src = `packages/${name}.js`
|
||||||
this.executeCom(decodeURIComponent(location.hash.slice(1)));
|
|
||||||
}
|
// Config.packages.update(name, 'downloading')
|
||||||
|
|
||||||
|
|
||||||
|
// $(tag).ready(() => {
|
||||||
|
// Config.packages.update(name, 'downloaded')
|
||||||
|
// resolve()
|
||||||
|
// if (eval(`if(typeof ${name} != 'undefined')true;else false`)) {
|
||||||
|
|
||||||
|
// this.log(`${name} package downloaded`, 'ok')
|
||||||
|
// resolve()
|
||||||
|
// } else {
|
||||||
|
// Config.packages.update(name, 'failed')
|
||||||
|
// this.log(`${name} package download failed`, 'error')
|
||||||
|
// reject()
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// $('head').append(tag)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Con init ready event
|
_requires(name) {
|
||||||
ready() {
|
if(!Config.packages[name])
|
||||||
|
Config.packages[name] = this._getPackage(name)
|
||||||
|
|
||||||
|
return Config.packages[name]
|
||||||
|
// return new Promise((resolve, reject) => {
|
||||||
|
// if (Config.packages.check(name) == 'undefined')
|
||||||
|
// this._getPackage(name)
|
||||||
|
// else resolve()
|
||||||
|
|
||||||
|
// Config.packages.callback(name)
|
||||||
|
// .then(() => {
|
||||||
|
// this[name] = eval(`new ${name}(this)`)
|
||||||
|
// resolve()
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_ready() {
|
||||||
$(this.elements.$wind).prop("id", this.id); // attach Con id to DOM
|
$(this.elements.$wind).prop("id", this.id); // attach Con id to DOM
|
||||||
$(this.elements.$wind).data("con", this); // attach Con object to DOM
|
$(this.elements.$wind).data("con", this); // attach Con object to DOM
|
||||||
|
|
||||||
this.socket = io('/'); // new socket connection
|
|
||||||
|
|
||||||
// socket event register function modification (pass additional parameter)
|
|
||||||
this.socket.originalOn = this.socket.on;
|
|
||||||
this.socket.on = function (event, data, callback) {
|
|
||||||
return this.originalOn.call(this, event, (e) => callback(e, data));
|
|
||||||
};
|
|
||||||
|
|
||||||
// socket connecting start event
|
|
||||||
this.socket.on('connecting', this, function (data, con) {
|
|
||||||
con.log("Conecting...", "info", 2);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// socket disconnected event
|
|
||||||
this.socket.on("disconnect", this, function (data, con) {
|
|
||||||
con.log(`Disconnected from server: ${data}`, "warning");
|
|
||||||
con.elements.icons.$connection.disable();
|
|
||||||
con.uAuth = false
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
// socket connection error event
|
|
||||||
this.socket.on("connect_error", this, function (data, con) {
|
|
||||||
con.log(data, "error");
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
// socket succesfully connected event
|
|
||||||
this.socket.on('connect', this, function (data, con) {
|
|
||||||
|
|
||||||
con.log("Conected to the server", "ok");
|
|
||||||
con.elements.icons.$connection.enable();
|
|
||||||
if(!con.tryAuth()) con.motd()
|
|
||||||
else con.log("Credentials detected, waiting for auth before motd", "info", 2)
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// dynamic (refreshed) data update
|
|
||||||
this.socket.on("dynamic", this, function (data, con) {
|
|
||||||
con.elements.icons.$connection.blink();
|
|
||||||
console.log(data)
|
|
||||||
// /ChangeDom.updateInfo(data);
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
// message broadcast (private & public) event
|
|
||||||
this.socket.on("broadcast", this, function (data, con) {
|
|
||||||
con.elements.icons.$connection.blink();
|
|
||||||
con.log(data.data, "message");
|
|
||||||
con.m = data.frm;
|
|
||||||
con.scrollBottom(true);
|
|
||||||
if (data.imp) alert("Broadcast message received");
|
|
||||||
notif.play();
|
|
||||||
con.m = data.frm;
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
// remote execute event
|
|
||||||
this.socket.on("eval", this, function (data, con) {
|
|
||||||
con.elements.icons.$connection.blink();
|
|
||||||
$("head").append(eval(data.data));
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
// socket receive auth data event
|
|
||||||
this.socket.on('auth', this, function (res, con) {
|
|
||||||
con.elements.icons.$connection.blink();
|
|
||||||
con.auth(res);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// socket receive com response event
|
|
||||||
this.socket.on('com', this, function (res, con) {
|
|
||||||
con.elements.icons.$connection.blink();
|
|
||||||
con.receive(res);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// command input key handling
|
// command input key handling
|
||||||
this.elements.$commline.on("keydown", "input", function (e) {
|
this.elements.$commline.on("keydown", "input", function (e) {
|
||||||
var con = $(this).closest(".wind").data("con");
|
var con = $(this).closest(".wind").data("con");
|
||||||
@@ -2020,32 +1769,32 @@ class Con {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.elements.$wind.on('keydown', e => {
|
this.elements.$wind.on('keydown', e => {
|
||||||
var val = (e.altKey)*1
|
var val = (e.altKey) * 1
|
||||||
+ (e.ctrlKey)*2
|
+ (e.ctrlKey) * 2
|
||||||
+ (e.metaKey)*3
|
+ (e.metaKey) * 3
|
||||||
+ (e.shiftKey)*4
|
+ (e.shiftKey) * 4
|
||||||
+ e.key,
|
+ e.key,
|
||||||
options = {
|
options = {
|
||||||
'2l': () => this.clear()
|
'2l': () => this.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(options[val]){
|
if (options[val]) {
|
||||||
options[val]()
|
options[val]()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// focus on input on 'enter'
|
// // focus on input on 'enter'
|
||||||
this.elements.$wind.on("keydown", function (e) {
|
// this.elements.$wind.on("keydown", function (e) {
|
||||||
var con = $(this).data("con");
|
// var con = $(this).data("con");
|
||||||
|
|
||||||
switch (e.which) {
|
// switch (e.which) {
|
||||||
// ENTER key
|
// // ENTER key
|
||||||
case 13: con.elements.$commin.focus(); // focus on input
|
// case 13: con.elements.$commin.focus(); // focus on input
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
|
||||||
})
|
// })
|
||||||
|
|
||||||
// form key handling
|
// form key handling
|
||||||
this.elements.$commands.on("keydown", "form", function (e) {
|
this.elements.$commands.on("keydown", "form", function (e) {
|
||||||
@@ -2075,24 +1824,60 @@ class Con {
|
|||||||
// jsonl file input event listener
|
// jsonl file input event listener
|
||||||
this.elements.$jsonl[0].addEventListener('change', this.readJson, false);
|
this.elements.$jsonl[0].addEventListener('change', this.readJson, false);
|
||||||
|
|
||||||
// 'accept cookies' prompt
|
// // 'accept cookies' prompt
|
||||||
if (typeof getCookie("cookies") == "undefined") {
|
// if (typeof getCookie("cookies") == "undefined") {
|
||||||
setCookie("cookies", "1");
|
// setCookie("cookies", "1");
|
||||||
this.log("This site uses cookies. By continuing, you agree to our use of cookies. <a target = '_blank' href='http://wikipedia.org/wiki/HTTP_cookie'>Learn more</a>", "warning")
|
// this.log("This site uses cookies. By continuing, you agree to our use of cookies. <a target = '_blank' href='http://wikipedia.org/wiki/HTTP_cookie'>Learn more</a>", "warning")
|
||||||
}
|
// }
|
||||||
|
|
||||||
// update input width // TODO: get this working in pure css
|
// update input width // TODO: get this working in pure css
|
||||||
this.updateInputWidth();
|
this.updateInputWidth();
|
||||||
|
|
||||||
|
this.log("Console ready", 'ok')
|
||||||
|
|
||||||
|
this._requires("Socket")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var Config = {
|
var Config = {
|
||||||
notif: new Audio('unsure.mp3'), // notification sound object
|
notif: new Audio('res/unsure.mp3'), // notification sound object
|
||||||
treeDepth: 4, // tree visualization Depth
|
treeDepth: 4, // tree visualization Depth
|
||||||
socket: undefined, // socket connection object
|
socket: undefined, // socket connection object
|
||||||
cons: [], // cons list
|
cons: [], // cons list
|
||||||
|
packages: {},
|
||||||
|
// packages: {
|
||||||
|
// list: {},
|
||||||
|
// update(name, state) {
|
||||||
|
// if (this.list[name]) {
|
||||||
|
// this.list[name].state = state
|
||||||
|
// } else {
|
||||||
|
// this.list[name] = {
|
||||||
|
// state: state,
|
||||||
|
// callbacks: []
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (state == 'ready') {
|
||||||
|
// for (let fs of this.list[name].callbacks) {
|
||||||
|
// fs[0]()
|
||||||
|
// }
|
||||||
|
// } else if (state == 'failed') {
|
||||||
|
// for (let fs of this.list[name].callbacks) {
|
||||||
|
// fs[1]()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// callback(name, f) {
|
||||||
|
// return new Promise((resolve, reject) => {
|
||||||
|
// this.list[name].callbacks.push([resolve, reject])
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// check(name) {
|
||||||
|
// return typeof this.list[name] != 'undefined' ? this.list[name].state : 'undefined'
|
||||||
|
// }
|
||||||
|
// },
|
||||||
verbose: 2,
|
verbose: 2,
|
||||||
serviceWorker: false // enable serviceWorker
|
serviceWorker: false // enable serviceWorker
|
||||||
}
|
}
|
||||||
@@ -2100,9 +1885,9 @@ var Config = {
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("noscript").remove(); // remove 'js disabled' notice
|
$("noscript").remove(); // remove 'js disabled' notice
|
||||||
|
|
||||||
Config.notif.volume = 0.3; // lower notification volume
|
Config.notif.volume = 0.3
|
||||||
Config.cons.push(new Con()); // init new Con
|
Config.cons.push(new Con())
|
||||||
con = Config.cons[0]; // attach main Con to 'con' variable (for easier debugging)
|
con = Config.cons[0]
|
||||||
|
|
||||||
if ('serviceWorker' in navigator && Config.serviceWorker) { // check is serviceWorker is available
|
if ('serviceWorker' in navigator && Config.serviceWorker) { // check is serviceWorker is available
|
||||||
navigator.serviceWorker
|
navigator.serviceWorker
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
class Cookies {
|
||||||
|
getCookie(cname) {
|
||||||
|
/**
|
||||||
|
* Get cookie
|
||||||
|
* @param {string} cname cookie name
|
||||||
|
*
|
||||||
|
* @returns {string} cookie content (undefined if doesn't exist)
|
||||||
|
*/
|
||||||
|
|
||||||
|
var name = cname + "=";
|
||||||
|
var decodedCookie = decodeURIComponent(document.cookie);
|
||||||
|
var ca = decodedCookie.split(';');
|
||||||
|
for (var i = 0; i < ca.length; i++) {
|
||||||
|
var c = ca[i];
|
||||||
|
while (c.charAt(0) == ' ') {
|
||||||
|
c = c.substring(1);
|
||||||
|
}
|
||||||
|
if (c.indexOf(name) == 0)
|
||||||
|
return c.substring(name.length, c.length);
|
||||||
|
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCookie(cname, cvalue, exdays) {
|
||||||
|
/**
|
||||||
|
* Set cookie
|
||||||
|
* @param cname cookie name
|
||||||
|
* @param cvalue cookie value
|
||||||
|
* @param exdays cookie expiry in days
|
||||||
|
*
|
||||||
|
* @returns {undefined}
|
||||||
|
*/
|
||||||
|
|
||||||
|
var d = new Date();
|
||||||
|
isDefined(exdays, 3650);
|
||||||
|
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
|
||||||
|
document.cookie = cname + "=" + cvalue + ";expires=" + d.toUTCString() + ";path=/";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class Core{
|
||||||
|
constructor(){
|
||||||
|
console.log('aaa')
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
export var type = "sub"
|
||||||
|
export default class Socket {
|
||||||
|
|
||||||
|
constructor(con) {
|
||||||
|
this.con = con
|
||||||
|
|
||||||
|
// socket event register function modification (pass additional parameter)
|
||||||
|
// this.socket.originalOn = this.socket.on;
|
||||||
|
// this.socket.on = function (event, data, callback) {
|
||||||
|
// return this.originalOn.call(this, event, (e) => callback(e, data));
|
||||||
|
// };
|
||||||
|
|
||||||
|
this.socket = io('/')
|
||||||
|
|
||||||
|
// socket connecting start event
|
||||||
|
this.socket.on('connecting', (data) => con.log("Conecting...", "info", 2));
|
||||||
|
this.socket.on("connect_error", (data) => con.log(data, "error"))
|
||||||
|
|
||||||
|
this.socket.on('auth', (data) => this.auth(data));
|
||||||
|
this.socket.on('com', (data) => this.receive(data));
|
||||||
|
|
||||||
|
// socket disconnected event
|
||||||
|
this.socket.on("disconnect", (data) => {
|
||||||
|
con.log(`Disconnected from server: ${data}`, "warning")
|
||||||
|
con.uAuth(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
// socket succesfully connected event
|
||||||
|
this.socket.on('connect', (data) => {
|
||||||
|
|
||||||
|
con.log("Conected to the server", "ok")
|
||||||
|
if (!this.tryAuth()) this.motd()
|
||||||
|
else con.log("Credentials detected, waiting for auth before motd", "info", 2)
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// // dynamic (refreshed) data update
|
||||||
|
// this.socket.on("dynamic", (data) => {
|
||||||
|
// console.log(data)
|
||||||
|
// // /ChangeDom.updateInfo(data);
|
||||||
|
// })
|
||||||
|
|
||||||
|
// message broadcast (private & public) event
|
||||||
|
// this.socket.on("broadcast", (data) => {
|
||||||
|
// con.log(data.data, "message");
|
||||||
|
// con.m = data.frm;
|
||||||
|
// con.scrollBottom(true);
|
||||||
|
// if (data.imp) alert("Broadcast message received");
|
||||||
|
// notif.play();
|
||||||
|
// con.m = data.frm;
|
||||||
|
|
||||||
|
// })
|
||||||
|
|
||||||
|
// remote execute event TODO: fix
|
||||||
|
// this.socket.on("eval", (data) => $("head").append(eval(data.data)))
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
motd() {
|
||||||
|
if (this.con.first) return
|
||||||
|
this.con.first = true
|
||||||
|
this.con.executeCom("motd");
|
||||||
|
if (location.hash != "") {
|
||||||
|
this.con.log(`Executing command from URI (${location.hash.slice(1)})`, "info", 3)
|
||||||
|
this.con.executeCom(decodeURIComponent(location.hash.slice(1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
receive(res) {
|
||||||
|
this.con.getCom(res.res.id).update(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
uAuth(val) {
|
||||||
|
if (val) this.con.udataExp = val
|
||||||
|
return this.con.udataExp
|
||||||
|
}
|
||||||
|
|
||||||
|
auth(udata) {
|
||||||
|
con.log("Auth data received", "ok", 2);
|
||||||
|
this.con.udata = udata;
|
||||||
|
this.con.uAuth(true)
|
||||||
|
this.con.elements.$commuser.change(this.con.udata.login, this.con.udata.badge);
|
||||||
|
// if (!this.fAuth) this.firstAuth()
|
||||||
|
this.con.motd()
|
||||||
|
}
|
||||||
|
|
||||||
|
tryAuth() {
|
||||||
|
if (con.credentials) {
|
||||||
|
con.socket.emit("auth".credentials);
|
||||||
|
con.log("Requesting authentication", "info", 2);
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
con.log("No credentials found", "info", 2);
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
var what = "aa"
|
||||||
|
export {
|
||||||
|
what as test
|
||||||
|
}
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
export var type = "class"
|
||||||
|
export default class Tree {
|
||||||
|
constructor(data) {
|
||||||
|
this.data = data
|
||||||
|
|
||||||
|
if (this._typeOf(data) != "array" && this._typeOf(data) != "object")
|
||||||
|
return $("<span></span>").append(_contentType(data)).append(": ").append(data + "")
|
||||||
|
|
||||||
|
this.$ = $("<ul></ul>")
|
||||||
|
.addClass("ascii tree")
|
||||||
|
.append(
|
||||||
|
$("<li></li>")
|
||||||
|
.append(
|
||||||
|
this._contentType(data),
|
||||||
|
this._collapse(false),
|
||||||
|
this._recur(data, 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
get(){
|
||||||
|
return this.$
|
||||||
|
}
|
||||||
|
|
||||||
|
_typeOf(o) {
|
||||||
|
var t = typeof o
|
||||||
|
|
||||||
|
if (o instanceof Array) t = "array"
|
||||||
|
if (o instanceof RegExp) t = "regex"
|
||||||
|
if (o === null) t = "null"
|
||||||
|
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
_contentType(v, name) {
|
||||||
|
|
||||||
|
var type = this._typeOf(v)
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
|
||||||
|
case 'number': return $("<txred></txred>").append(name ? name : "number")
|
||||||
|
case 'string': return $("<txgrn></txgrn>").append(name ? name : "string")
|
||||||
|
case 'boolean': return $("<txorn></txorn>").append(name ? name : "boolean")
|
||||||
|
case 'function': return $("<txcya></txcya>").append(name ? name : "function")
|
||||||
|
case 'array': return $("<txyel></txyel>").append(name ? name : "array")
|
||||||
|
case 'object': return $("<txblu></txblu>").append(name ? name : "object")
|
||||||
|
case 'regex': return $("<txprp></txprp>").append(name ? name : "regex")
|
||||||
|
case 'null': return $("<txdrk></txdrk>").append(name ? name : "null")
|
||||||
|
case 'undefined': return $("<txdrk></txdrk>").append(name ? name : "undefined")
|
||||||
|
default: return $("<txdrk></txdrk>").append(name ? name : "?")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_collapse(n) {
|
||||||
|
if (n) {
|
||||||
|
return $("<span></span>")
|
||||||
|
.addClass("collapse")
|
||||||
|
.append(
|
||||||
|
$("<i></i>")
|
||||||
|
.addClass('icon-plus-squared')
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return $("<span></span>")
|
||||||
|
.addClass("collapse")
|
||||||
|
.append(
|
||||||
|
$("<i></i>")
|
||||||
|
.addClass('icon-minus-squared')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_recur(obj, depth) {
|
||||||
|
|
||||||
|
let m = this.mdepth || Config.treeDepth || 4
|
||||||
|
const maxd = m <= 7 ? m : 7; // max depth
|
||||||
|
const maxn = 50; // max level length
|
||||||
|
const maxs = 150; // max string length
|
||||||
|
const maxc = 2; // level to collapse after
|
||||||
|
|
||||||
|
var $list = $("<ul></ul>");
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
for (let key in obj) {
|
||||||
|
i++;
|
||||||
|
if (i > maxn) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
var content = obj[key]; // content
|
||||||
|
var type = this._typeOf(obj[key]); // content type
|
||||||
|
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 'object':
|
||||||
|
case 'array':
|
||||||
|
if ($.isEmptyObject(content)) { // is content epmty
|
||||||
|
$list.append( // empty object
|
||||||
|
$("<li></li>")
|
||||||
|
.append(this._contentType(content, key))
|
||||||
|
.append(": ")
|
||||||
|
.append(`<txpnk>[empty]</txpnk>`)
|
||||||
|
)
|
||||||
|
} else { // content not empty
|
||||||
|
if (depth > maxd) { // is max depth reached
|
||||||
|
$list.append( // function description (max depth reached)
|
||||||
|
$("<li></li>")
|
||||||
|
.append(this._contentType(content, key))
|
||||||
|
.append(": ")
|
||||||
|
.append(`<txpnk>${isWhat(content)}</txpnk>`)
|
||||||
|
)
|
||||||
|
} else { // max depth not reached
|
||||||
|
$list.append( // continue recursion
|
||||||
|
$("<li></li>")
|
||||||
|
.append(this._contentType(content, key))
|
||||||
|
.append(": ")
|
||||||
|
.append( // collapse button
|
||||||
|
this._collapse(depth >= maxc)
|
||||||
|
)
|
||||||
|
.append(this._recur(content, depth + 1))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'function':
|
||||||
|
$list.append(
|
||||||
|
$("<li></li>")
|
||||||
|
.append(this._contentType(content, key))
|
||||||
|
.append(": ")
|
||||||
|
.append(
|
||||||
|
`<txpnk>${isWhat(content)}</txpnk>`
|
||||||
|
)
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$list.append(
|
||||||
|
$("<li></li>")
|
||||||
|
.append(this._contentType(content, key))
|
||||||
|
.append(": ")
|
||||||
|
.append(content)
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > maxn) {
|
||||||
|
|
||||||
|
$list.append(
|
||||||
|
$("<li></li>")
|
||||||
|
.append(
|
||||||
|
$("<txprp></txprp>")
|
||||||
|
.append(`... ${i - maxn} more`)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (depth > maxc) {
|
||||||
|
$list.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
File renamed without changes.
File renamed without changes.
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
@import url("fontello/css/animation.css");
|
||||||
|
@import url("fontello/css/fontello.css");
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Vendored
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+13
-14
@@ -2,7 +2,7 @@
|
|||||||
font-family: 'Ubuntu Mono';
|
font-family: 'Ubuntu Mono';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(ubuntu-mono.woff2) format('woff2');
|
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(res/ubuntu-mono.woff2) format('woff2');
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ txprp, .txprp {color: #AE00FF;}
|
|||||||
padding: 0px 15px;
|
padding: 0px 15px;
|
||||||
color: white;
|
color: white;
|
||||||
/* font-family: Ubuntu Mono; */
|
/* font-family: Ubuntu Mono; */
|
||||||
overflow-y: hidden;
|
overflow-y: scroll;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
@@ -106,14 +106,9 @@ body::-webkit-scrollbar,
|
|||||||
|
|
||||||
/* commandline row */
|
/* commandline row */
|
||||||
.commline{
|
.commline{
|
||||||
position: absolute;
|
|
||||||
bottom: 0px;
|
|
||||||
left: 0px;
|
|
||||||
right: 0px;
|
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: 10px 15px;
|
padding-bottom: 15px;
|
||||||
background: rgba(0,0,0,0.6);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
label{
|
label{
|
||||||
@@ -152,16 +147,20 @@ table{
|
|||||||
/* command output element */
|
/* command output element */
|
||||||
.commands{
|
.commands{
|
||||||
line-height: 1.28;
|
line-height: 1.28;
|
||||||
padding: 25px 0px;
|
padding: 15px 0px;
|
||||||
padding-bottom: 40px;
|
padding-bottom: 0px;
|
||||||
overflow-y: scroll;
|
overflow-y: visible;
|
||||||
max-height: 100%;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timestamp{
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
::selection,
|
::selection,
|
||||||
::-moz-selection{
|
::-moz-selection{
|
||||||
|
color: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
.frosted::before {
|
.frosted::before {
|
||||||
|
|||||||
Reference in new issue
Block a user