formatting and lint compliance

pull/1/head
ansuz 7 years ago
parent 480b499d7b
commit 118ceef2f2

@ -9,6 +9,7 @@ www/scratch
www/common/toolbar.js
www/common/hyperscript.js
www/common/tippy.min.js
www/common/onlyoffice/*
www/pad/wysiwygarea-plugin.js
www/pad/mediatag-plugin.js
@ -17,3 +18,4 @@ www/pad/mediatag-plugin-dialog.js
www/common/media-tag-nacl.min.js
customize/

@ -1,6 +1,7 @@
/* jshint esversion: 6 */
const sockjs = require('sockjs');
const co = require('co');
var config;
try {
config = require('./config');
} catch (e) {
@ -9,10 +10,10 @@ try {
}
var origin = config.httpUnsafeOrigin || 'http://localhost:3000/';
exports.install = function(server, callbackFunction) {
module.exports.install = function(server, callbackFunction) {
var sockjs_opts = {sockjs_url: ""},
sockjs_echo = sockjs.createServer(sockjs_opts),
urlParse = new RegExp("^/common/onlyoffice/doc/([0-9-.a-zA-Z_=]*)/c.+", 'i');
sockjs_echo = sockjs.createServer(sockjs_opts);
//urlParse = new RegExp("^/common/onlyoffice/doc/([0-9-.a-zA-Z_=]*)/c.+", 'i');
console.log("Start ooserver");
console.log("Port " + sockjs_echo.port);
@ -43,16 +44,12 @@ function getBaseUrlByConnection(conn) {
function sendData(conn, data) {
conn.write(JSON.stringify(data));
}
function sendDataWarning(conn, msg) {
sendData(conn, {type: "warning", message: msg});
}
function sendDataMessage(conn, msg) {
sendData(conn, {type: "message", messages: msg});
}
//function sendDataWarning(conn, msg) { sendData(conn, {type: "warning", message: msg}); }
//function sendDataMessage(conn, msg) { sendData(conn, {type: "message", messages: msg}); }
sockjs_echo.on('connection', function(conn) {
console.log("ooserver in connection");
if (null == conn) {
if (null === conn) {
console.log("null == conn");
return;
}
@ -63,18 +60,22 @@ sockjs_echo.on('connection', function(conn) {
console.log("ooserver setting handlers");
conn.on('data', function(message) {
console.log("In data");
return co(function* () {
var data;
try {
console.log("Received: " + message);
var data = JSON.parse(message);
data = JSON.parse(message);
switch (data.type) {
case 'auth':
console.log("Response auth");
var fileUrl = origin + "oodoc/test.bin";
if (data.openCmd.format=="xlsx")
fileUrl = origin + "oocell/test.bin"
else if (data.openCmd.format=="pptx")
fileUrl = origin + "ooslide/test.bin"
if (data.openCmd) {
if (data.openCmd.format === "xlsx") {
fileUrl = origin + "oocell/test.bin";
} else if (data.openCmd.format === "pptx") {
fileUrl = origin + "ooslide/test.bin";
}
}
sendData(conn, {"type":"auth","result":1,"sessionId":"08e77705-dc5c-477d-b73a-b1a7cbca1e9b","sessionTimeConnect":1494226099270,"participants":[]});
sendData(conn, {"type":"documentOpen","data":{"type":"open","status":"ok","data":{"Editor.bin":fileUrl}}});
break;
@ -82,18 +83,16 @@ sockjs_echo.on('connection', function(conn) {
break;
}
} catch (e) {
console.log("error receiving response: docId = %s type = %s\r\n%s", docId, (data && data.type) ? data.type : 'null', e.stack);
console.error(e);
//console.log("error receiving response: docId = %s type = %s\r\n%s", docId, (data && data.type) ? data.type : 'null', e.stack);
}
});
});
conn.on('error', function() {
console.log("On error");
});
conn.on('close', function() {
return co(function* () {
console.log("On close");
});
});
console.log("ooserver sending welcome message");
sendData(conn, {
type: 'license',

@ -12,7 +12,6 @@
"stream-to-pull-stream": "^1.7.2",
"tweetnacl": "~0.12.2",
"ws": "^1.0.1",
"co": "^4.6.0",
"sockjs": "^0.3.18"
},
"devDependencies": {

@ -1,4 +1,5 @@
config = {
/* globals DocsAPI */
window.config = {
"document": {
"fileType": "xlsx",
"key": "Khirz6zTPdfd7",
@ -26,8 +27,8 @@ config = {
}
console.log("in change (remote)");
},
"onReady": function(evt) { console.log("in onReady"); },
"onAppReady": function(evt) { console.log("in onAppReady"); },
"onReady": function(/*evt*/) { console.log("in onReady"); },
"onAppReady": function(/*evt*/) { console.log("in onAppReady"); },
}
};
window.onbeforeunload = function () {
@ -35,6 +36,5 @@ window.onbeforeunload = function () {
if (ifr) { ifr.remove(); }
};
var docEditor = new DocsAPI.DocEditor("placeholder", config);
window.docEditor = new DocsAPI.DocEditor("placeholder", window.config);

@ -1,4 +1,5 @@
config = {
/* globals DocsAPI */
window.config = {
"document": {
"fileType": "docx",
"key": "Khirz6zTPdfd7",
@ -13,12 +14,11 @@ config = {
}
},
"events": {
"onDocumentStateChange": function(evt) { console.log("in change"); },
"onReady": function(evt) { console.log("in onReady"); }
"onDocumentStateChange": function (/* evt */) { console.log("in change"); },
"onReady": function (/* evt */) { console.log("in onReady"); }
}
};
window.onbeforeunload = null;
var docEditor = new DocsAPI.DocEditor("placeholder", config);
window.docEditor = new DocsAPI.DocEditor("placeholder", window.config);

@ -1,4 +1,5 @@
config = {
/* globals DocsAPI */
window.config = {
"document": {
"fileType": "pptx",
"key": "Khirz6zTPdfd7",
@ -13,12 +14,12 @@ config = {
}
},
"events": {
"onDocumentStateChange": function(evt) { console.log("in change"); },
"onReady": function(evt) { console.log("in onReady"); }
"onDocumentStateChange": function (/* evt */) { console.log("in change"); },
"onReady": function (/* evt */) { console.log("in onReady"); }
}
};
window.onbeforeunload = null;
var docEditor = new DocsAPI.DocEditor("placeholder", config);
window.docEditor = new DocsAPI.DocEditor("placeholder", window.config);

Loading…
Cancel
Save