Merge branch 'soon'
@ -0,0 +1,49 @@
|
||||
/* jshint esversion: 6 */
|
||||
/* global process */
|
||||
const Nacl = require('tweetnacl/nacl-fast');
|
||||
|
||||
// XXX npm "os" and "child_process"
|
||||
|
||||
// TODO if this process is using too much CPU, we can use "cluster" to add load balancing to this code
|
||||
//console.log('New child process', process.pid);
|
||||
process.on('message', function (data) {
|
||||
//console.log('In process', process.pid);
|
||||
//console.log(+new Date(), "Message received by subprocess");
|
||||
if (!data || !data.key || !data.msg || !data.txid) {
|
||||
return void process.send({
|
||||
error:'E_INVAL'
|
||||
});
|
||||
}
|
||||
const txid = data.txid;
|
||||
|
||||
var signedMsg;
|
||||
try {
|
||||
signedMsg = Nacl.util.decodeBase64(data.msg);
|
||||
} catch (e) {
|
||||
return void process.send({
|
||||
txid: txid,
|
||||
error: 'E_BAD_MESSAGE',
|
||||
});
|
||||
}
|
||||
|
||||
var validateKey;
|
||||
try {
|
||||
validateKey = Nacl.util.decodeBase64(data.key);
|
||||
} catch (e) {
|
||||
return void process.send({
|
||||
txid: txid,
|
||||
error:'E_BADKEY'
|
||||
});
|
||||
}
|
||||
// validate the message
|
||||
const validated = Nacl.sign.open(signedMsg, validateKey);
|
||||
if (!validated) {
|
||||
return void process.send({
|
||||
txid: txid,
|
||||
error:'FAILED'
|
||||
});
|
||||
}
|
||||
process.send({
|
||||
txid: txid,
|
||||
});
|
||||
});
|
@ -1 +0,0 @@
|
||||
{}
|
@ -1,17 +0,0 @@
|
||||
plus.png
|
||||
x:6 y:6
|
||||
|
||||
plus_2x.png
|
||||
x:12 y:12
|
||||
|
||||
plus_copy.png
|
||||
x:6 y:12
|
||||
|
||||
plus_copy_2x.png
|
||||
x:12 y:25
|
||||
|
||||
text_copy.png
|
||||
x:2 y:11
|
||||
|
||||
text_copy_2x.png
|
||||
x:5 y:23
|
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 540 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 384 KiB |
Before Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 362 KiB |
Before Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 837 B |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1001 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 870 B |
@ -1,346 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ONLYOFFICE Documents</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-touch-fullscreen" content="yes">
|
||||
|
||||
<style type="text/css">
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#wrap {
|
||||
position:absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div id="placeholder"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="api.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
|
||||
// Url parameters
|
||||
|
||||
var urlParams = getUrlParams(),
|
||||
cfg = getEditorConfig(urlParams),
|
||||
doc = getDocumentData(urlParams);
|
||||
|
||||
// Document Editor
|
||||
|
||||
var docEditor = new DocsAPI.DocEditor('placeholder', {
|
||||
type: urlParams['type'],
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
documentType: urlParams['doctype'] || 'text',
|
||||
document: doc,
|
||||
editorConfig: cfg,
|
||||
events: {
|
||||
'onReady': onDocEditorReady,
|
||||
'onDocumentStateChange': onDocumentStateChange,
|
||||
'onRequestEditRights': onRequestEditRights,
|
||||
'onRequestHistory': onRequestHistory,
|
||||
'onRequestHistoryData': onRequestHistoryData,
|
||||
'onRequestEmailAddresses': onRequestEmailAddresses,
|
||||
'onRequestStartMailMerge': onRequestStartMailMerge,
|
||||
'onRequestHistoryClose': onRequestHistoryClose,
|
||||
'onError': onError
|
||||
}
|
||||
});
|
||||
|
||||
// Document Editor event handlers
|
||||
|
||||
function onRequestEmailAddresses() {
|
||||
docEditor.setEmailAddresses({emailAddresses: ['aaa@mail.ru'], createEmailAccountUrl: 'http://ya.ru'});
|
||||
}
|
||||
|
||||
function onRequestHistory() {
|
||||
docEditor.refreshHistory({
|
||||
'currentVersion': 3,
|
||||
'history': [
|
||||
{
|
||||
'user': {
|
||||
id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
|
||||
name: 'Татьяна Щербакова'
|
||||
},
|
||||
'changes': null,
|
||||
'created': '1/18/2015 6:38 PM',
|
||||
'version': 1,
|
||||
'versionGroup': 1,
|
||||
'key': 'wyX9AwRq_677SWKjhfk='
|
||||
},
|
||||
{
|
||||
'user': {
|
||||
id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
|
||||
name: 'Татьяна Щербакова'
|
||||
},
|
||||
'changes': [
|
||||
{
|
||||
'user': {
|
||||
id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
|
||||
name: 'Татьяна Щербакова'
|
||||
},
|
||||
'created': '1/19/2015 6:30 PM'
|
||||
},
|
||||
{
|
||||
'user': {
|
||||
'id': '8952d4ee-e8a5-42bf-11f0-6cd77801ec15',
|
||||
'name': 'Александр Трофимов'
|
||||
},
|
||||
'created': '1/19/2015 6:32 PM'
|
||||
},
|
||||
{
|
||||
'user': {
|
||||
id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
|
||||
name: 'Татьяна Щербакова'
|
||||
},
|
||||
'created': '1/19/2015 6:38 PM'
|
||||
}
|
||||
],
|
||||
'created': '2/19/2015 6:38 PM',
|
||||
'version': 2,
|
||||
'versionGroup': 1,
|
||||
'key': 'wyX9AwRq_677SWKjhfk='
|
||||
},
|
||||
{
|
||||
'user': {
|
||||
id: '895255ee-e8a5-42bf-86f0-6cd77801ec15',
|
||||
name: 'Me'
|
||||
},
|
||||
'changes': null,
|
||||
'created': '2/21/2015 6:38 PM',
|
||||
'version': 3,
|
||||
'versionGroup': 2,
|
||||
'key': 'wyX9AwRq_677SWKjhfk='
|
||||
},
|
||||
{
|
||||
'user': {
|
||||
id: '8952d4ee-e8a5-42bf-11f0-6cd77801ec15',
|
||||
name: 'Александр Трофимов'
|
||||
},
|
||||
'changes': null,
|
||||
'created': '2/22/2015 6:37 PM',
|
||||
'version': 4,
|
||||
'versionGroup': 3,
|
||||
'key': 'wyX9AwRq_677SWKjhfk='
|
||||
},
|
||||
{
|
||||
'user': {
|
||||
id: '8952d4ee-e8a5-42bf-11f0-6cd33801ec15',
|
||||
name: 'Леонид Орлов'
|
||||
},
|
||||
'changes': null,
|
||||
'created': '2/24/2015 6:29 PM',
|
||||
'version': 5,
|
||||
'versionGroup': 3,
|
||||
'key': 'wyX9AwRq_677SWKjhfk='
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
function onRequestHistoryData(revision) {
|
||||
docEditor.setHistoryData(
|
||||
{
|
||||
'version': revision.data,
|
||||
'url': 'http://isa2',
|
||||
'urlDiff': 'http://isa2',
|
||||
'changesUrl': 'http://isa2'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function onRequestStartMailMerge() {
|
||||
docEditor.processMailMerge(true, 'some error message');
|
||||
}
|
||||
|
||||
function onRequestHistoryClose() {
|
||||
// reload page
|
||||
}
|
||||
|
||||
function onDocEditorReady(event) {
|
||||
if (event.target) {
|
||||
//console.log('Ready! Editor: ', event.target);
|
||||
}
|
||||
}
|
||||
|
||||
function onDocumentStateChange(event) {
|
||||
var isModified = event.data;
|
||||
//console.log(isModified);
|
||||
}
|
||||
|
||||
function onRequestEditRights(event) {
|
||||
// occurs whenever the user tryes to enter edit mode
|
||||
docEditor.applyEditRights(true, "Someone is editing this document right now. Please try again later.");
|
||||
}
|
||||
|
||||
function onError(event) {
|
||||
// critical error happened
|
||||
// examine event.data.errorCode and event.data.errorDescription for details
|
||||
}
|
||||
|
||||
function onDownloadAs(event) {
|
||||
// return url of downloaded doc
|
||||
// console.log(event.data);
|
||||
}
|
||||
|
||||
|
||||
// helpers
|
||||
|
||||
function getUrlParams() {
|
||||
var e,
|
||||
a = /\+/g, // Regex for replacing addition symbol with a space
|
||||
r = /([^&=]+)=?([^&]*)/g,
|
||||
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
|
||||
q = window.location.search.substring(1),
|
||||
urlParams = {};
|
||||
|
||||
while (e = r.exec(q))
|
||||
urlParams[d(e[1])] = d(e[2]);
|
||||
|
||||
return urlParams;
|
||||
}
|
||||
|
||||
function getDocumentData(urlParams) {
|
||||
return {
|
||||
key: urlParams["key"],
|
||||
url: urlParams["url"] || '_offline_',
|
||||
title: urlParams["title"],
|
||||
fileType: urlParams["filetype"],
|
||||
vkey: urlParams["vkey"],
|
||||
permissions: {
|
||||
edit: true,
|
||||
download: true,
|
||||
reader: true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getEditorConfig(urlParams) {
|
||||
return {
|
||||
mode : urlParams["mode"] || 'edit',
|
||||
lang : urlParams["lang"] || 'en',
|
||||
canCoAuthoring : true,
|
||||
createUrl : 'http://www.example.com/create',
|
||||
|
||||
user: {
|
||||
id: urlParams["userid"] || 'uid-901', firstname: urlParams["userfname"] || 'Mitchell', lastname: urlParams["userlname"] || 'Hamish'
|
||||
},
|
||||
recent : [
|
||||
{title: 'Memory.docx', url: 'http://onlyoffice.com', folder: 'Document Editor'},
|
||||
{title: 'Description.doc', url: 'http://onlyoffice.com', folder: 'Document Editor'},
|
||||
{title: 'DocEditor_right.xsl', url: 'http://onlyoffice.com', folder: 'Spreadsheet Editor'},
|
||||
{title: 'api.rtf', url: 'http://onlyoffice.com', folder: 'Unnamed folder'}
|
||||
],
|
||||
// templates : [
|
||||
// {name: 'Contracts', icon: '../../api/documents/resources/templates/contracts.png', url: 'http://...'},
|
||||
// {name: 'Letter', icon: '../../api/documents/resources/templates/letter.png', url: 'http://...'},
|
||||
// {name: 'List', icon: '../../api/documents/resources/templates/list.png', url: 'http://...'},
|
||||
// {name: 'Plan', icon: '../../api/documents/resources/templates/plan.png', url: 'http://...'}
|
||||
// ],
|
||||
embedded : {
|
||||
embedUrl : 'http://onlyoffice.com/embed',
|
||||
fullscreenUrl : 'http://onlyoffice.com/fullscreen',
|
||||
saveUrl : 'http://onlyoffice.com/download',
|
||||
shareUrl : 'http://tl.com/72b4la97',
|
||||
toolbarDocked : 'top'
|
||||
}
|
||||
,customization: {
|
||||
// logo: {
|
||||
// image: 'https://dylnrgbh910l3.cloudfront.net/studio/tag/i8.8.237/skins/default/images/onlyoffice_logo/editor_logo_general.png', // default size 86 x 20
|
||||
// imageEmbedded: 'https://d2hw9csky753gb.cloudfront.net/studio/tag/i8.8.237/skins/default/images/onlyoffice_logo/editor_embedded_logo.png', // default size 124 x 20
|
||||
// url: 'http://...'
|
||||
// },
|
||||
// backgroundColor: '#ffffff',
|
||||
// textColor: '#ff0000',
|
||||
// customer: {
|
||||
// name: 'SuperPuper',
|
||||
// address: 'New-York, 125f-25',
|
||||
// mail: 'support@gmail.com',
|
||||
// www: 'www.superpuper.com',
|
||||
// info: 'Some info',
|
||||
// logo: 'https://img.imgsmail.ru/r/default/portal/0.1.29/logo.png' // default size 216 x 35
|
||||
// },
|
||||
// goback: {text: 'Go To London', url: 'http://...'},
|
||||
about: true,
|
||||
feedback: true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Mobile version
|
||||
|
||||
function isMobile(){
|
||||
var prefixes = {
|
||||
ios: 'i(?:Pad|Phone|Pod)(?:.*)CPU(?: iPhone)? OS ',
|
||||
android: '(Android |HTC_|Silk/)',
|
||||
blackberry: 'BlackBerry(?:.*)Version\/',
|
||||
rimTablet: 'RIM Tablet OS ',
|
||||
webos: '(?:webOS|hpwOS)\/',
|
||||
bada: 'Bada\/'
|
||||
},
|
||||
i, prefix, match;
|
||||
|
||||
for (i in prefixes){
|
||||
if (prefixes.hasOwnProperty(i)) {
|
||||
prefix = prefixes[i];
|
||||
|
||||
if (navigator.userAgent.match(new RegExp('(?:'+prefix+')([^\\s;]+)')))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var fixSize = function() {
|
||||
var wrapEl = document.getElementById('wrap');
|
||||
if (wrapEl){
|
||||
wrapEl.style.height = screen.availHeight + 'px';
|
||||
window.scrollTo(0, -1);
|
||||
wrapEl.style.height = window.innerHeight + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
var fixIpadLandscapeIos7 = function() {
|
||||
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
|
||||
var wrapEl = document.getElementById('wrap');
|
||||
if (wrapEl){
|
||||
wrapEl.style.position = "fixed";
|
||||
wrapEl.style.bottom = 0;
|
||||
wrapEl.style.width = "100%";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (isMobile()){
|
||||
window.addEventListener('load', fixSize);
|
||||
window.addEventListener('resize', fixSize);
|
||||
|
||||
fixIpadLandscapeIos7();
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 584 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 104 B |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 104 B |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 584 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 104 B |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 104 B |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 17 KiB |