master
Selcuk Sari 4 years ago
parent ee602ee891
commit 8cec8261ac

@ -17,7 +17,7 @@
"pdf-lib": "^1.17.1",
"pug": "^3.0.2",
"socket.io": "^4.5.1",
"xterm": "^4.18.0"
"xterm": "^4.19.0"
},
"devDependencies": {
"nodemon": "^2.0.18"
@ -2633,9 +2633,9 @@
}
},
"node_modules/xterm": {
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/xterm/-/xterm-4.18.0.tgz",
"integrity": "sha512-JQoc1S0dti6SQfI0bK1AZvGnAxH4MVw45ZPFSO6FHTInAiau3Ix77fSxNx3mX4eh9OL4AYa8+4C8f5UvnSfppQ=="
"version": "4.19.0",
"resolved": "https://registry.npmjs.org/xterm/-/xterm-4.19.0.tgz",
"integrity": "sha512-c3Cp4eOVsYY5Q839dR5IejghRPpxciGmLWWaP9g+ppfMeBChMeLa1DCA+pmX/jyDZ+zxFOmlJL/82qVdayVoGQ=="
},
"node_modules/yallist": {
"version": "4.0.0",
@ -4675,9 +4675,9 @@
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
},
"xterm": {
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/xterm/-/xterm-4.18.0.tgz",
"integrity": "sha512-JQoc1S0dti6SQfI0bK1AZvGnAxH4MVw45ZPFSO6FHTInAiau3Ix77fSxNx3mX4eh9OL4AYa8+4C8f5UvnSfppQ=="
"version": "4.19.0",
"resolved": "https://registry.npmjs.org/xterm/-/xterm-4.19.0.tgz",
"integrity": "sha512-c3Cp4eOVsYY5Q839dR5IejghRPpxciGmLWWaP9g+ppfMeBChMeLa1DCA+pmX/jyDZ+zxFOmlJL/82qVdayVoGQ=="
},
"yallist": {
"version": "4.0.0",

@ -18,7 +18,7 @@
"pdf-lib": "^1.17.1",
"pug": "^3.0.2",
"socket.io": "^4.5.1",
"xterm": "^4.18.0"
"xterm": "^4.19.0"
},
"devDependencies": {
"nodemon": "^2.0.18"

@ -0,0 +1,190 @@
/**
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
* https://github.com/chjj/term.js
* @license MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Originally forked from (with the author's permission):
* Fabrice Bellard's javascript vt100 for jslinux:
* http://bellard.org/jslinux/
* Copyright (c) 2011 Fabrice Bellard
* The original design remains. The terminal itself
* has been extended to include xterm CSI codes, among
* other features.
*/
/**
* Default styles for xterm.js
*/
.xterm {
cursor: text;
position: relative;
user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
}
.xterm.focus,
.xterm:focus {
outline: none;
}
.xterm .xterm-helpers {
position: absolute;
top: 0;
/**
* The z-index of the helpers must be higher than the canvases in order for
* IMEs to appear on top.
*/
z-index: 5;
}
.xterm .xterm-helper-textarea {
padding: 0;
border: 0;
margin: 0;
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
position: absolute;
opacity: 0;
left: -9999em;
top: 0;
width: 0;
height: 0;
z-index: -5;
/** Prevent wrapping so the IME appears against the textarea at the correct position */
white-space: nowrap;
overflow: hidden;
resize: none;
}
.xterm .composition-view {
/* TODO: Composition position got messed up somewhere */
background: #000;
color: #FFF;
display: none;
position: absolute;
white-space: nowrap;
z-index: 1;
}
.xterm .composition-view.active {
display: block;
}
.xterm .xterm-viewport {
/* On OS X this is required in order for the scroll bar to appear fully opaque */
background-color: #000;
overflow-y: scroll;
cursor: default;
position: absolute;
right: 0;
left: 0;
top: 0;
bottom: 0;
}
.xterm .xterm-screen {
position: relative;
}
.xterm .xterm-screen canvas {
position: absolute;
left: 0;
top: 0;
}
.xterm .xterm-scroll-area {
visibility: hidden;
}
.xterm-char-measure-element {
display: inline-block;
visibility: hidden;
position: absolute;
top: 0;
left: -9999em;
line-height: normal;
}
.xterm.enable-mouse-events {
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
cursor: default;
}
.xterm.xterm-cursor-pointer,
.xterm .xterm-cursor-pointer {
cursor: pointer;
}
.xterm.column-select.focus {
/* Column selection mode */
cursor: crosshair;
}
.xterm .xterm-accessibility,
.xterm .xterm-message {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 10;
color: transparent;
}
.xterm .live-region {
position: absolute;
left: -9999px;
width: 1px;
height: 1px;
overflow: hidden;
}
.xterm-dim {
opacity: 0.5;
}
.xterm-underline {
text-decoration: underline;
}
.xterm-strikethrough {
text-decoration: line-through;
}
.xterm-screen .xterm-decoration-container .xterm-decoration {
z-index: 6;
position: absolute;
}
.xterm-decoration-overview-ruler {
z-index: 7;
position: absolute;
top: 0;
right: 0;
pointer-events: none;
}
.xterm-decoration-top {
z-index: 2;
position: relative;
}

@ -1,3 +1,9 @@
// var socket = io();
// socket.on("test", (s) => {
// console.log(s);
// });
window.addEventListener("load", function () {
fetch("http://localhost:3000/flasher/getProjects", {
method: "POST",
@ -13,16 +19,10 @@ window.addEventListener("load", function () {
.catch((err) => ("Error occured", err));
});
var socket = io();
socket.on("test", (s) => {
console.log(s);
});
form.addEventListener("submit", function (e) {
e.preventDefault();
if (input.value) {
socket.emit("chat message", input.value);
input.value = "";
}
});
// form.addEventListener("submit", function (e) {
// e.preventDefault();
// if (input.value) {
// socket.emit("chat message", input.value);
// input.value = "";
// }
// });

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,25 +1,6 @@
const express = require("express");
const router = express.Router();
// var socketList = [];
// io.sockets.on("connection", function (socket) {
// // add socket to list on connection
// socketList.push(socket);
// // remove socket from list on disconnect
// socket.on("disconnect", function () {
// socketList.splice(socketList.indexOf(socket), 1);
// });
// socket.on("search", function (country) {
// // Give list of sockets where (socket.country) = country
// var filteredList = socketList.filter(function (s) {
// return s.country == country;
// });
// });
// });
router.post("/getProjects", function (req, res, next) {
console.log("yes there is a request");
var io = req.app.get("io");

@ -1,9 +1,23 @@
extends layout.pug
block content
script(src='/socket.io/socket.io.js')
script(src='/js/flasher.js')
link(href='css/xterm.css' rel='stylesheet')
h3.text-center.mt-3 Flasher
.container
.row
.col
p Hello
.col-5
p Hello
.col-3
#terminal
script(src='/socket.io/socket.io.js')
script(src="js/xterm.js")
script(src='js/flasher.js')
script.
var term = new Terminal({cols:60,rows:20});
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
var socket = io();
socket.on("test", (s) => {
term.write(s);
term.write("\r\n");
});

@ -22,10 +22,10 @@ block content
input#xpos.form-control(type="number",required='',value="50")
.col
label(for="ypos") Y Position
input#ypos.form-control(type="number",required='',value="50")
input#ypos.form-control(type="number",required='',value="250")
.col
label(for="scalefactor") Scale Factor
input#sf.form-control(type="number",required='', step="0.001",value="0.5")
input#sf.form-control(type="number",required='', step="0.001",value="0.09")
.m-3.text-start
button.btn.btn-primary(type="submit") Confirm
.col-sm-4

Loading…
Cancel
Save