Removed some session cruft.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3379 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2017-01-16 13:00:05 +00:00
parent 5200fbc852
commit ba0b3bf465
3 changed files with 4 additions and 9 deletions

View File

@ -1,7 +1,6 @@
"use strict";
var gSocket;
var gSessionId;
var gCredentials;
var gErrorCount = 0;
var gCommandHistory = [];
@ -111,7 +110,6 @@ function receive(data) {
if (line && line.action == "ping") {
gSocket.send(JSON.stringify({action: "pong"}));
} else if (line && line.action == "session") {
gSessionId = line.sessionId;
gCredentials = line.credentials;
updateLogin();
} else if (line && line[0] && line[0].action == "ready") {

View File

@ -9,6 +9,7 @@ var network = require("network");
var gProcessIndex = 0;
var gProcesses = {};
var gSessionIndex = 0;
var gGlobalSettings = {
index: "/~cory/index",
@ -35,11 +36,7 @@ function getCookies(headers) {
}
function makeSessionId() {
var id = "";
for (var i = 0; i < 64; i++) {
id += (Math.floor(Math.random() * 16)).toString(16);
}
return id;
return (gSessionIndex++).toString();
}
function printError(out, error) {

View File

@ -160,10 +160,10 @@ function socket(request, response, client) {
packageOwner = match[1];
packageName = match[2];
}
var sessionId = makeSessionId();
response.send(JSON.stringify({lines: [{action: "session", sessionId: sessionId, credentials: credentials}]}), 0x1);
response.send(JSON.stringify({lines: [{action: "session", credentials: credentials}]}), 0x1);
options.terminalApi = message.terminalApi || [];
var sessionId = makeSessionId();
process = await getSessionProcess(packageOwner, packageName, sessionId, options);
process.terminal.readOutput(function(message) {
response.send(JSON.stringify(message), 0x1);