summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/locales/de.json6
-rw-r--r--src/locales/en.json2
-rw-r--r--src/locales/it.json9
-rw-r--r--src/locales/lb.json4
-rw-r--r--src/locales/mk.json6
-rw-r--r--src/locales/sv.json14
-rw-r--r--src/locales/vi.json9
-rw-r--r--src/locales/zh-hant.json8
-rw-r--r--src/node/db/API.js111
-rw-r--r--src/node/handler/APIHandler.js48
-rw-r--r--src/node/handler/PadMessageHandler.js70
-rw-r--r--src/node/handler/SocketIORouter.js9
-rw-r--r--src/node/hooks/express/socketio.js49
-rw-r--r--src/node/utils/RemoteAddress.js1
-rw-r--r--src/node/utils/Settings.js1
-rw-r--r--src/package.json6
-rw-r--r--src/static/css/pad.css47
-rw-r--r--src/static/css/timeslider.css1
-rw-r--r--src/static/js/ace2_inner.js18
-rw-r--r--src/static/js/pad.js1
-rw-r--r--src/static/js/pad_editbar.js17
21 files changed, 331 insertions, 106 deletions
diff --git a/src/locales/de.json b/src/locales/de.json
index 05a9af79..25594da1 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -12,9 +12,9 @@
"pad.toolbar.bold.title": "Fett (Strg-B)",
"pad.toolbar.italic.title": "Kursiv (Strg-I)",
"pad.toolbar.underline.title": "Unterstrichen (Strg-U)",
- "pad.toolbar.strikethrough.title": "Durchgestrichen",
- "pad.toolbar.ol.title": "Nummerierte Liste",
- "pad.toolbar.ul.title": "Ungeordnete Liste",
+ "pad.toolbar.strikethrough.title": "Durchgestrichen (Strg+5)",
+ "pad.toolbar.ol.title": "Nummerierte Liste (Strg+Shift+N)",
+ "pad.toolbar.ul.title": "Ungeordnete Liste (Strg+Shift+L)",
"pad.toolbar.indent.title": "Einrücken (TAB)",
"pad.toolbar.unindent.title": "Ausrücken (Shift+TAB)",
"pad.toolbar.undo.title": "Rückgängig (Strg-Z)",
diff --git a/src/locales/en.json b/src/locales/en.json
index d9b98389..9a25b18c 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -12,7 +12,7 @@
"pad.toolbar.unindent.title": "Outdent (Shift+TAB)",
"pad.toolbar.undo.title": "Undo (Ctrl+Z)",
"pad.toolbar.redo.title": "Redo (Ctrl+Y)",
- "pad.toolbar.clearAuthorship.title": "Clear Authorship Colors",
+ "pad.toolbar.clearAuthorship.title": "Clear Authorship Colors (Ctrl+Shift+C)",
"pad.toolbar.import_export.title": "Import/Export from/to different file formats",
"pad.toolbar.timeslider.title": "Timeslider",
"pad.toolbar.savedRevision.title": "Save Revision",
diff --git a/src/locales/it.json b/src/locales/it.json
index 8292c4f2..501733f8 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -4,7 +4,8 @@
"Beta16",
"Gianfranco",
"Muxator",
- "Vituzzu"
+ "Vituzzu",
+ "Macofe"
]
},
"index.newPad": "Nuovo Pad",
@@ -12,9 +13,9 @@
"pad.toolbar.bold.title": "Grassetto (Ctrl-B)",
"pad.toolbar.italic.title": "Corsivo (Ctrl-I)",
"pad.toolbar.underline.title": "Sottolineato (Ctrl-U)",
- "pad.toolbar.strikethrough.title": "Barrato",
- "pad.toolbar.ol.title": "Elenco numerato",
- "pad.toolbar.ul.title": "Elenco puntato",
+ "pad.toolbar.strikethrough.title": "Barrato (Ctrl+5)",
+ "pad.toolbar.ol.title": "Elenco numerato (Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "Elenco puntato (Ctrl+Shift+L)",
"pad.toolbar.indent.title": "Rientro (TAB)",
"pad.toolbar.unindent.title": "Riduci rientro (Shift+TAB)",
"pad.toolbar.undo.title": "Annulla (Ctrl-Z)",
diff --git a/src/locales/lb.json b/src/locales/lb.json
index 7f936906..841add75 100644
--- a/src/locales/lb.json
+++ b/src/locales/lb.json
@@ -6,8 +6,8 @@
]
},
"index.newPad": "Neie Pad",
- "pad.toolbar.ol.title": "Numeréiert Lëscht",
- "pad.toolbar.ul.title": "Net-numeréiert Lëscht",
+ "pad.toolbar.ol.title": "Numeréiert Lëscht (Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "Net-numeréiert Lëscht (Ctrl+Shift+L)",
"pad.toolbar.undo.title": "Réckgängeg (Ctrl-Z)",
"pad.toolbar.redo.title": "Widderhuelen (Ctrl-Y)",
"pad.toolbar.savedRevision.title": "Versioun späicheren",
diff --git a/src/locales/mk.json b/src/locales/mk.json
index 8aaf9917..aec40b27 100644
--- a/src/locales/mk.json
+++ b/src/locales/mk.json
@@ -10,9 +10,9 @@
"pad.toolbar.bold.title": "Задебелено (Ctrl-B)",
"pad.toolbar.italic.title": "Косо (Ctrl-I)",
"pad.toolbar.underline.title": "Подвлечено (Ctrl-U)",
- "pad.toolbar.strikethrough.title": "Прецртано",
- "pad.toolbar.ol.title": "Подреден список",
- "pad.toolbar.ul.title": "Неподреден список",
+ "pad.toolbar.strikethrough.title": "Прецртано (Ctrl+5)",
+ "pad.toolbar.ol.title": "Подреден список (Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "Неподреден список (Ctrl+Shift+L)",
"pad.toolbar.indent.title": "Вовлекување (TAB)",
"pad.toolbar.unindent.title": "Отстап (Shift+TAB)",
"pad.toolbar.undo.title": "Врати (Ctrl-Z)",
diff --git a/src/locales/sv.json b/src/locales/sv.json
index 623def9a..ab6f3820 100644
--- a/src/locales/sv.json
+++ b/src/locales/sv.json
@@ -11,9 +11,9 @@
"pad.toolbar.bold.title": "Fet (Ctrl-B)",
"pad.toolbar.italic.title": "Kursiv (Ctrl-I)",
"pad.toolbar.underline.title": "Understruken (Ctrl-U)",
- "pad.toolbar.strikethrough.title": "Genomstruken",
- "pad.toolbar.ol.title": "Numrerad lista",
- "pad.toolbar.ul.title": "Osorterad lista",
+ "pad.toolbar.strikethrough.title": "Genomstruken (Ctrl+5)",
+ "pad.toolbar.ol.title": "Numrerad lista (Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "Onumrerad lista (Ctrl+Shift+L)",
"pad.toolbar.indent.title": "Öka indrag (TABB)",
"pad.toolbar.unindent.title": "Minska indrag (Shift+TABB)",
"pad.toolbar.undo.title": "Ångra (Ctrl-Z)",
@@ -52,7 +52,7 @@
"pad.importExport.exportpdf": "PDF",
"pad.importExport.exportopen": "ODF (Open Document Format)",
"pad.importExport.exportdokuwiki": "DokuWiki",
- "pad.importExport.abiword.innerHTML": "Du kan endast importera från oformaterad text eller html-format. För mer avancerade importeringsfunktioner, var god <a href=\"https://github.com/ether/etherpad-lite/wiki/How-to-enable-importing-and-exporting-different-file-formats-in-Ubuntu-or-OpenSuse-or-SLES-with-AbiWord\">installera abiword</a>.",
+ "pad.importExport.abiword.innerHTML": "Du kan endast importera från oformaterad text eller HTML-format. För mer avancerade importeringsfunktioner, var god <a href=\"https://github.com/ether/etherpad-lite/wiki/How-to-enable-importing-and-exporting-different-file-formats-in-Ubuntu-or-OpenSuse-or-SLES-with-AbiWord\">installera abiword</a>.",
"pad.modals.connected": "Ansluten.",
"pad.modals.reconnecting": "Återansluter till ditt block...",
"pad.modals.forcereconnect": "Tvinga återanslutning",
@@ -60,7 +60,7 @@
"pad.modals.userdup.explanation": "Detta block verkar vara öppet i mer än ett fönster på denna dator.",
"pad.modals.userdup.advice": "Återanslut för att använda detta fönster istället.",
"pad.modals.unauth": "Inte godkänd",
- "pad.modals.unauth.explanation": "Din behörighet ändrades medan du visar denna sida. Försök att återansluta.",
+ "pad.modals.unauth.explanation": "Din behörighet ändrades medan du visade denna sida. Försök att återansluta.",
"pad.modals.looping.explanation": "Kommunikationsproblem med synkroniseringsservern har uppstått.",
"pad.modals.looping.cause": "Kanske du är ansluten via en inkompatibel brandvägg eller proxy.",
"pad.modals.initsocketfail": "Servern kan inte nås.",
@@ -69,7 +69,7 @@
"pad.modals.slowcommit.explanation": "Servern svarar inte.",
"pad.modals.slowcommit.cause": "Detta kan bero på problem med nätverksanslutningen.",
"pad.modals.badChangeset.explanation": "En redigering som du gjort klassificerades som otillåten av synkroniseringsservern.",
- "pad.modals.badChangeset.cause": "Detta kan bero på en felaktig konfiguration av servern eller något annat oväntad beteende. Var god kontakta tjänstadministratören om du anser att detta är ett fel. Försök ansluta igen för att fortsätta redigera.",
+ "pad.modals.badChangeset.cause": "Detta kan bero på en felaktig konfiguration av servern eller något annat oväntad beteende. Var god kontakta tjänsteadministratören om du upplever att detta är ett fel. Försök att ansluta igen för att fortsätta redigera.",
"pad.modals.corruptPad.explanation": "Blocket du försöker komma åt är skadat.",
"pad.modals.corruptPad.cause": "Detta kan bero på en felaktig konfiguration av servern eller något annat oväntad beteende. Var god kontakta tjänstadministratören.",
"pad.modals.deleted": "Raderad.",
@@ -84,7 +84,7 @@
"pad.chat": "Chatt",
"pad.chat.title": "Öppna chatten för detta block.",
"pad.chat.loadmessages": "Läs in fler meddelanden",
- "timeslider.pageTitle": "Tidsreglage för {{appTitle}}",
+ "timeslider.pageTitle": "{{appTitle}} tidsreglage",
"timeslider.toolbar.returnbutton": "Återvänd till blocket",
"timeslider.toolbar.authors": "Författare:",
"timeslider.toolbar.authorsList": "Inga författare",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 608e9645..3d5cb66d 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -3,7 +3,8 @@
"authors": [
"Baonguyen21022003",
"Minh Nguyen",
- "Tuankiet65"
+ "Tuankiet65",
+ "Max20091"
]
},
"index.newPad": "Tạo một Pad mới",
@@ -11,9 +12,9 @@
"pad.toolbar.bold.title": "In đậm (Ctrl-B)",
"pad.toolbar.italic.title": "In nghiêng (Ctrl-I)",
"pad.toolbar.underline.title": "Gạch chân (Ctrl-U)",
- "pad.toolbar.strikethrough.title": "Gạch ngang",
- "pad.toolbar.ol.title": "Danh sách Có Đánh số",
- "pad.toolbar.ul.title": "Danh sách Không Đánh số",
+ "pad.toolbar.strikethrough.title": "Gạch ngang (Ctrl+5)",
+ "pad.toolbar.ol.title": "Danh sách Có Đánh số (Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "Danh sách Không Đánh số (Ctrl+Shift+L)",
"pad.toolbar.indent.title": "Tăng lề (TAB)",
"pad.toolbar.unindent.title": "Giảm lề (Shift+TAB)",
"pad.toolbar.undo.title": "Hoàn tác (Ctrl-Z)",
diff --git a/src/locales/zh-hant.json b/src/locales/zh-hant.json
index 0707648a..3b084e3d 100644
--- a/src/locales/zh-hant.json
+++ b/src/locales/zh-hant.json
@@ -14,9 +14,9 @@
"pad.toolbar.bold.title": "粗體(Ctrl-B)",
"pad.toolbar.italic.title": "斜體(Ctrl-I)",
"pad.toolbar.underline.title": "底線(Ctrl-U)",
- "pad.toolbar.strikethrough.title": "刪除線",
- "pad.toolbar.ol.title": "有序清單",
- "pad.toolbar.ul.title": "無序清單",
+ "pad.toolbar.strikethrough.title": "刪除線(Ctrl+5)",
+ "pad.toolbar.ol.title": "有序清單(Ctrl+Shift+N)",
+ "pad.toolbar.ul.title": "無序清單(Ctrl+Shift+L)",
"pad.toolbar.indent.title": "縮排(TAB)",
"pad.toolbar.unindent.title": "凸排(Shift+TAB)",
"pad.toolbar.undo.title": "撤銷(Ctrl-Z)",
@@ -94,7 +94,7 @@
"timeslider.toolbar.exportlink.title": "匯出",
"timeslider.exportCurrent": "匯出當前版本為:",
"timeslider.version": "版本{{version}}",
- "timeslider.saved": "{{year}}年{{month}}月{{day}}日儲存",
+ "timeslider.saved": "{{year}}年{{month}}{{day}}日儲存",
"timeslider.dateformat": "{{year}}年{{month}}月{{day}}日 {{hours}}:{{minutes}}:{{seconds}}",
"timeslider.month.january": "1月",
"timeslider.month.february": "2月",
diff --git a/src/node/db/API.js b/src/node/db/API.js
index 4a912368..07d3703c 100644
--- a/src/node/db/API.js
+++ b/src/node/db/API.js
@@ -575,6 +575,117 @@ exports.deletePad = function(padID, callback)
pad.remove(callback);
});
}
+/**
+ restoreRevision(padID, [rev]) Restores revision from past as new changeset
+
+ Example returns:
+
+ {code:0, message:"ok", data:null}
+ {code: 1, message:"padID does not exist", data: null}
+ */
+exports.restoreRevision = function (padID, rev, callback)
+{
+ var Changeset = require("ep_etherpad-lite/static/js/Changeset");
+ var padMessage = require("ep_etherpad-lite/node/handler/PadMessageHandler.js");
+
+ //check if rev is a number
+ if (rev !== undefined && typeof rev != "number")
+ {
+ //try to parse the number
+ if (!isNaN(parseInt(rev)))
+ {
+ rev = parseInt(rev);
+ }
+ else
+ {
+ callback(new customError("rev is not a number", "apierror"));
+ return;
+ }
+ }
+
+ //ensure this is not a negativ number
+ if (rev !== undefined && rev < 0)
+ {
+ callback(new customError("rev is a negativ number", "apierror"));
+ return;
+ }
+
+ //ensure this is not a float value
+ if (rev !== undefined && !is_int(rev))
+ {
+ callback(new customError("rev is a float value", "apierror"));
+ return;
+ }
+
+ //get the pad
+ getPadSafe(padID, true, function (err, pad)
+ {
+ if (ERR(err, callback)) return;
+
+
+ //check if this is a valid revision
+ if (rev > pad.getHeadRevisionNumber())
+ {
+ callback(new customError("rev is higher than the head revision of the pad", "apierror"));
+ return;
+ }
+
+ pad.getInternalRevisionAText(rev, function (err, atext)
+ {
+ if (ERR(err, callback)) return;
+
+ var oldText = pad.text();
+ atext.text += "\n";
+ function eachAttribRun(attribs, func)
+ {
+ var attribsIter = Changeset.opIterator(attribs);
+ var textIndex = 0;
+ var newTextStart = 0;
+ var newTextEnd = atext.text.length;
+ while (attribsIter.hasNext())
+ {
+ var op = attribsIter.next();
+ var nextIndex = textIndex + op.chars;
+ if (!(nextIndex <= newTextStart || textIndex >= newTextEnd))
+ {
+ func(Math.max(newTextStart, textIndex), Math.min(newTextEnd, nextIndex), op.attribs);
+ }
+ textIndex = nextIndex;
+ }
+ }
+
+ // create a new changeset with a helper builder object
+ var builder = Changeset.builder(oldText.length);
+
+ // assemble each line into the builder
+ eachAttribRun(atext.attribs, function (start, end, attribs)
+ {
+ builder.insert(atext.text.substring(start, end), attribs);
+ });
+
+ var lastNewlinePos = oldText.lastIndexOf('\n');
+ if (lastNewlinePos < 0)
+ {
+ builder.remove(oldText.length - 1, 0);
+ } else
+ {
+ builder.remove(lastNewlinePos, oldText.match(/\n/g).length - 1);
+ builder.remove(oldText.length - lastNewlinePos - 1, 0);
+ }
+
+ var changeset = builder.toString();
+
+ //append the changeset
+ pad.appendRevision(changeset);
+ //
+ padMessage.updatePadClients(pad, function ()
+ {
+ });
+ callback(null, null);
+ });
+
+ });
+};
/**
copyPad(sourceID, destinationID[, force=false]) copies a pad. If force is true,
diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js
index 273a58a6..9adc2418 100644
--- a/src/node/handler/APIHandler.js
+++ b/src/node/handler/APIHandler.js
@@ -345,10 +345,56 @@ var version =
, "getChatHistory" : ["padID", "start", "end"]
, "getChatHead" : ["padID"]
}
+, "1.2.11":
+ { "createGroup" : []
+ , "createGroupIfNotExistsFor" : ["groupMapper"]
+ , "deleteGroup" : ["groupID"]
+ , "listPads" : ["groupID"]
+ , "listAllPads" : []
+ , "createDiffHTML" : ["padID", "startRev", "endRev"]
+ , "createPad" : ["padID", "text"]
+ , "createGroupPad" : ["groupID", "padName", "text"]
+ , "createAuthor" : ["name"]
+ , "createAuthorIfNotExistsFor": ["authorMapper" , "name"]
+ , "listPadsOfAuthor" : ["authorID"]
+ , "createSession" : ["groupID", "authorID", "validUntil"]
+ , "deleteSession" : ["sessionID"]
+ , "getSessionInfo" : ["sessionID"]
+ , "listSessionsOfGroup" : ["groupID"]
+ , "listSessionsOfAuthor" : ["authorID"]
+ , "getText" : ["padID", "rev"]
+ , "setText" : ["padID", "text"]
+ , "getHTML" : ["padID", "rev"]
+ , "setHTML" : ["padID", "html"]
+ , "getAttributePool" : ["padID"]
+ , "getRevisionsCount" : ["padID"]
+ , "getRevisionChangeset" : ["padID", "rev"]
+ , "getLastEdited" : ["padID"]
+ , "deletePad" : ["padID"]
+ , "copyPad" : ["sourceID", "destinationID", "force"]
+ , "movePad" : ["sourceID", "destinationID", "force"]
+ , "getReadOnlyID" : ["padID"]
+ , "getPadID" : ["roID"]
+ , "setPublicStatus" : ["padID", "publicStatus"]
+ , "getPublicStatus" : ["padID"]
+ , "setPassword" : ["padID", "password"]
+ , "isPasswordProtected" : ["padID"]
+ , "listAuthorsOfPad" : ["padID"]
+ , "padUsersCount" : ["padID"]
+ , "getAuthorName" : ["authorID"]
+ , "padUsers" : ["padID"]
+ , "sendClientsMessage" : ["padID", "msg"]
+ , "listAllGroups" : []
+ , "checkToken" : []
+ , "getChatHistory" : ["padID"]
+ , "getChatHistory" : ["padID", "start", "end"]
+ , "getChatHead" : ["padID"]
+ , "restoreRevision" : ["padID", "rev"]
+ }
};
// set the latest available API version here
-exports.latestApiVersion = '1.2.10';
+exports.latestApiVersion = '1.2.11';
// exports the versions so it can be used by the new Swagger endpoint
exports.version = version;
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js
index e1ac994e..36da4842 100644
--- a/src/node/handler/PadMessageHandler.js
+++ b/src/node/handler/PadMessageHandler.js
@@ -37,6 +37,7 @@ var _ = require('underscore');
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js");
var channels = require("channels");
var stats = require('../stats');
+var remoteAddress = require("../utils/RemoteAddress").remoteAddress;
/**
* A associative array that saves informations about a session
@@ -115,14 +116,16 @@ exports.handleDisconnect = function(client)
//if this connection was already etablished with a handshake, send a disconnect message to the others
if(session && session.author)
{
- client.get('remoteAddress', function(er, ip) {
- //Anonymize the IP address if IP logging is disabled
- if(settings.disableIPlogging) {
- ip = 'ANONYMOUS';
- }
- accessLogger.info('[LEAVE] Pad "'+session.padId+'": Author "'+session.author+'" on client '+client.id+' with IP "'+ip+'" left the pad')
- })
+ // Get the IP address from our persistant object
+ var ip = remoteAddress[client.id];
+
+ // Anonymize the IP address if IP logging is disabled
+ if(settings.disableIPlogging) {
+ ip = 'ANONYMOUS';
+ }
+
+ accessLogger.info('[LEAVE] Pad "'+session.padId+'": Author "'+session.author+'" on client '+client.id+' with IP "'+ip+'" left the pad')
//get the author color out of the db
authorManager.getAuthorColorId(session.author, function(err, color)
@@ -753,7 +756,13 @@ function handleUserChanges(data, cb)
exports.updatePadClients = function(pad, callback)
{
//skip this step if noone is on this pad
- var roomClients = socketio.sockets.clients(pad.id);
+ var roomClients = [], room = socketio.sockets.adapter.rooms[pad.id];
+ if (room) {
+ for (var id in room) {
+ roomClients.push(socketio.sockets.adapter.nsp.connected[id]);
+ }
+ }
+
if(roomClients.length==0)
return callback();
@@ -766,10 +775,8 @@ exports.updatePadClients = function(pad, callback)
var revCache = {};
//go trough all sessions on this pad
- async.forEach(roomClients, function(client, callback)
- {
+ async.forEach(roomClients, function(client, callback){
var sid = client.id;
-
//https://github.com/caolan/async#whilst
//send them all new changesets
async.whilst(
@@ -1015,7 +1022,13 @@ function handleClientReady(client, message)
return callback();
//Check if this author is already on the pad, if yes, kick the other sessions!
- var roomClients = socketio.sockets.clients(padIds.padId);
+ var roomClients = [], room = socketio.sockets.adapter.rooms[pad.id];
+ if (room) {
+ for (var id in room) {
+ roomClients.push(socketio.sockets.adapter.nsp.connected[id]);
+ }
+ }
+
for(var i = 0; i < roomClients.length; i++) {
var sinfo = sessioninfos[roomClients[i].id];
if(sinfo && sinfo.author == author) {
@@ -1032,19 +1045,19 @@ function handleClientReady(client, message)
sessioninfos[client.id].readonly = padIds.readonly;
//Log creation/(re-)entering of a pad
- client.get('remoteAddress', function(er, ip) {
- //Anonymize the IP address if IP logging is disabled
- if(settings.disableIPlogging) {
- ip = 'ANONYMOUS';
- }
+ var ip = remoteAddress[client.id];
- if(pad.head > 0) {
- accessLogger.info('[ENTER] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" entered the pad');
- }
- else if(pad.head == 0) {
- accessLogger.info('[CREATE] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" created the pad');
- }
- })
+ //Anonymize the IP address if IP logging is disabled
+ if(settings.disableIPlogging) {
+ ip = 'ANONYMOUS';
+ }
+
+ if(pad.head > 0) {
+ accessLogger.info('[ENTER] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" entered the pad');
+ }
+ else if(pad.head == 0) {
+ accessLogger.info('[CREATE] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" created the pad');
+ }
//If this is a reconnect, we don't have to send the client the ClientVars again
if(message.reconnect == true)
@@ -1165,7 +1178,14 @@ function handleClientReady(client, message)
client.broadcast.to(padIds.padId).json.send(messageToTheOtherUsers);
//Run trough all sessions of this pad
- async.forEach(socketio.sockets.clients(padIds.padId), function(roomClient, callback)
+ var roomClients = [], room = socketio.sockets.adapter.rooms[pad.id];
+ if (room) {
+ for (var id in room) {
+ roomClients.push(socketio.sockets.adapter.nsp.connected[id]);
+ }
+ }
+
+ async.forEach(roomClients, function(roomClient, callback)
{
var author;
diff --git a/src/node/handler/SocketIORouter.js b/src/node/handler/SocketIORouter.js
index b3e046d2..0a7361f4 100644
--- a/src/node/handler/SocketIORouter.js
+++ b/src/node/handler/SocketIORouter.js
@@ -24,6 +24,7 @@ var log4js = require('log4js');
var messageLogger = log4js.getLogger("message");
var securityManager = require("../db/SecurityManager");
var readOnlyManager = require("../db/ReadOnlyManager");
+var remoteAddress = require("../utils/RemoteAddress").remoteAddress;
var settings = require('../utils/Settings');
/**
@@ -56,11 +57,15 @@ exports.setSocketIO = function(_socket) {
socket.sockets.on('connection', function(client)
{
+
+ // Broken: See http://stackoverflow.com/questions/4647348/send-message-to-specific-client-with-socket-io-and-node-js
+ // Fixed by having a persistant object, ideally this would actually be in the database layer
+ // TODO move to database layer
if(settings.trustProxy && client.handshake.headers['x-forwarded-for'] !== undefined){
- client.set('remoteAddress', client.handshake.headers['x-forwarded-for']);
+ remoteAddress[client.id] = client.handshake.headers['x-forwarded-for'];
}
else{
- client.set('remoteAddress', client.handshake.address.address);
+ remoteAddress[client.id] = client.handshake.address;
}
var clientAuthorized = false;
diff --git a/src/node/hooks/express/socketio.js b/src/node/hooks/express/socketio.js
index 524bab3d..e88a3f4c 100644
--- a/src/node/hooks/express/socketio.js
+++ b/src/node/hooks/express/socketio.js
@@ -1,10 +1,17 @@
var log4js = require('log4js');
-var socketio = require('socket.io');
var settings = require('../../utils/Settings');
var socketIORouter = require("../../handler/SocketIORouter");
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
var webaccess = require("ep_etherpad-lite/node/hooks/express/webaccess");
+// there shouldn't be a browser that isn't compatible to all
+// transports in this list at once
+// e.g. XHR is disabled in IE by default, so in IE it should use jsonp-polling
+
+var socketio = require('socket.io')({
+ transports: settings.socketTransportProtocols
+});
+
var padMessageHandler = require("../../handler/PadMessageHandler");
var connect = require('connect');
@@ -16,7 +23,9 @@ exports.expressCreateServer = function (hook_name, args, cb) {
/* Require an express session cookie to be present, and load the
* session. See http://www.danielbaulig.de/socket-ioexpress for more
* info */
- io.set('authorization', function (data, accept) {
+
+ io.use(function(socket, accept) {
+ var data = socket.request;
if (!data.headers.cookie) return accept('No session cookie transmitted.', false);
// Use connect's cookie parser, because it knows how to parse signed cookies
@@ -36,35 +45,17 @@ exports.expressCreateServer = function (hook_name, args, cb) {
});
});
- // there shouldn't be a browser that isn't compatible to all
- // transports in this list at once
- // e.g. XHR is disabled in IE by default, so in IE it should use jsonp-polling
- io.set('transports', settings.socketTransportProtocols );
-
- var socketIOLogger = log4js.getLogger("socket.io");
- io.set('logger', {
- debug: function (str)
- {
- socketIOLogger.debug.apply(socketIOLogger, arguments);
- },
- info: function (str)
- {
- socketIOLogger.info.apply(socketIOLogger, arguments);
- },
- warn: function (str)
- {
- socketIOLogger.warn.apply(socketIOLogger, arguments);
- },
- error: function (str)
- {
- socketIOLogger.error.apply(socketIOLogger, arguments);
- },
- });
+ // var socketIOLogger = log4js.getLogger("socket.io");
+ // Debug logging now has to be set at an environment level, this is stupid.
+ // https://github.com/Automattic/socket.io/wiki/Migrating-to-1.0
+ // This debug logging environment is set in Settings.js
//minify socket.io javascript
- if(settings.minify)
- io.enable('browser client minification');
-
+ // Due to a shitty decision by the SocketIO team minification is
+ // no longer available, details available at:
+ // http://stackoverflow.com/questions/23981741/minify-socket-io-socket-io-js-with-1-0
+ // if(settings.minify) io.enable('browser client minification');
+
//Initalize the Socket.IO Router
socketIORouter.setSocketIO(io);
socketIORouter.addComponent("pad", padMessageHandler);
diff --git a/src/node/utils/RemoteAddress.js b/src/node/utils/RemoteAddress.js
new file mode 100644
index 00000000..86a4a5b2
--- /dev/null
+++ b/src/node/utils/RemoteAddress.js
@@ -0,0 +1 @@
+exports.remoteAddress = {};
diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js
index c455617b..1f22ccfd 100644
--- a/src/node/utils/Settings.js
+++ b/src/node/utils/Settings.js
@@ -228,6 +228,7 @@ exports.reloadSettings = function reloadSettings() {
log4js.configure(exports.logconfig);//Configure the logging appenders
log4js.setGlobalLogLevel(exports.loglevel);//set loglevel
+ process.env['DEBUG'] = 'socket.io:' + exports.loglevel; // Used by SocketIO for Debug
log4js.replaceConsole();
if(!exports.sessionKey){ // If the secretKey isn't set we also create yet another unique value here
diff --git a/src/package.json b/src/package.json
index bb136989..9c4851a9 100644
--- a/src/package.json
+++ b/src/package.json
@@ -15,9 +15,9 @@
"request" : "2.9.100",
"require-kernel" : "1.0.5",
"resolve" : ">=1.0.0",
- "socket.io" : "0.9.x",
- "ueberDB" : ">=0.2.8",
- "express" : "3.1.0",
+ "socket.io" : ">=1.2.0",
+ "ueberDB" : ">=0.2.9",
+ "express" : ">3.1.0 <3.9.0",
"async" : "0.1.x",
"connect" : "2.7.x",
"clean-css" : "0.3.2",
diff --git a/src/static/css/pad.css b/src/static/css/pad.css
index 599b9fd4..91c97c5e 100644
--- a/src/static/css/pad.css
+++ b/src/static/css/pad.css
@@ -59,7 +59,7 @@ a img {
height: 32px;
}
.toolbar ul {
- position: relative;
+ position: absolute;
list-style: none;
padding-right: 3px;
padding-left: 1px;
@@ -67,9 +67,6 @@ a img {
overflow: hidden;
float: left
}
-.toolbar ul.menu_right {
- float: right
-}
.toolbar ul li {
float: left;
margin-left: 2px;
@@ -84,6 +81,7 @@ a img {
visibility: hidden;
width: 0px;
padding: 5px;
+ height:20px;
}
.toolbar ul li a:hover {
text-decoration: none;
@@ -164,6 +162,15 @@ a img {
border: 1px solid #ccc;
outline: none;
}
+.toolbar ul.menu_left {
+ left:0px;
+ right:250px;
+}
+
+.toolbar ul.menu_right {
+ right:0px;
+}
+
li[data-key=showusers] > a {
min-width: 30px;
text-align: left;
@@ -175,6 +182,9 @@ li[data-key=showusers] > a #online_count {
top: 2px;
padding-left: 2px;
}
+#editbar{
+ display:none;
+}
#editorcontainer {
position: absolute;
top: 37px; /* + 1px border */
@@ -843,12 +853,16 @@ input[type=checkbox] {
width: 185px !important;
}
@media screen and (max-width: 600px) {
- .toolbar ul li.separator {
- display: none;
- }
- .toolbar ul li a {
- padding: 4px 1px
- }
+ .toolbar ul li.separator {
+ display: none;
+ }
+ .toolbar ul li a {
+ padding: 4px 1px
+ }
+ .toolbar ul.menu_left {
+ left:0px;
+ right:150px;
+ }
}
@media all and (max-width: 400px){
#gritter-notice-wrapper{
@@ -894,9 +908,13 @@ input[type=checkbox] {
#editbar {
height: 62px;
}
+ .toolbar ul.menu_left {
+ left:0px;
+ right:100px;
+ }
+
.toolbar ul.menu_right {
- float: left;
- margin-top:2px;
+ right:0px;
}
.popup {
width:100%;
@@ -917,6 +935,9 @@ input[type=checkbox] {
#editorcontainer {
margin-bottom: 33px
}
+ .toolbar ul.menu_left {
+ right:0px;
+ }
.toolbar ul.menu_right {
background: #f7f7f7;
background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%);
@@ -1076,4 +1097,4 @@ input[type=checkbox] {
text-shadow: none;
}
-/* End of gritter stuff */ \ No newline at end of file
+/* End of gritter stuff */
diff --git a/src/static/css/timeslider.css b/src/static/css/timeslider.css
index f478c895..6608df3e 100644
--- a/src/static/css/timeslider.css
+++ b/src/static/css/timeslider.css
@@ -173,6 +173,7 @@
#import_export {
top: 115px;
width: 185px;
+ position: fixed;
}
.timeslider-bar {
background: #f7f7f7;
diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js
index fb6dd080..59c58b19 100644
--- a/src/static/js/ace2_inner.js
+++ b/src/static/js/ace2_inner.js
@@ -152,7 +152,6 @@ function Ace2Inner(){
var dmesg = noop;
window.dmesg = noop;
-
var scheduler = parent; // hack for opera required
var textFace = 'monospace';
@@ -597,6 +596,13 @@ function Ace2Inner(){
fixView();
});
}, 0);
+
+ // Chrome can't handle the truth.. If CSS rule white-space:pre-wrap
+ // is true then any paste event will insert two lines..
+ if(browser.chrome){
+ $("#innerdocbody").css({"white-space":"normal"});
+ }
+
}
function setStyled(newVal)
@@ -3757,7 +3763,7 @@ function Ace2Inner(){
doInsertUnorderedList()
specialHandled = true;
}
- if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which).toLowerCase() == "n" && (evt.metaKey || evt.ctrlKey) && evt.shiftKey)
+ if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which).toLowerCase() == "n" && (evt.metaKey || evt.ctrlKey) && evt.shiftKey)
{
// cmd-shift-N (orderedlist)
fastIncorp(9);
@@ -3765,6 +3771,12 @@ function Ace2Inner(){
doInsertOrderedList()
specialHandled = true;
}
+ if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which).toLowerCase() == "c" && (evt.metaKey || evt.ctrlKey) && evt.shiftKey) {
+ // cmd-shift-C (clearauthorship)
+ fastIncorp(9);
+ evt.preventDefault();
+ CMDS.clearauthorship();
+ }
if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which).toLowerCase() == "h" && (evt.ctrlKey))
{
// cmd-H (backspace)
@@ -3816,7 +3828,7 @@ function Ace2Inner(){
}
updateBrowserSelectionFromRep();
var myselection = document.getSelection(); // get the current caret selection, can't use rep. here because that only gives us the start position not the current
- var caretOffsetTop = myselection.focusNode.parentNode.offsetTop | myselection.focusNode.offsetTop; // get the carets selection offset in px IE 214
+ var caretOffsetTop = myselection.focusNode.parentNode.offsetTop || myselection.focusNode.offsetTop; // get the carets selection offset in px IE 214
// top.console.log(caretOffsetTop);
setScrollY(caretOffsetTop); // set the scrollY offset of the viewport on the document
diff --git a/src/static/js/pad.js b/src/static/js/pad.js
index 73fcd3d6..649d8c82 100644
--- a/src/static/js/pad.js
+++ b/src/static/js/pad.js
@@ -937,4 +937,3 @@ exports.handshake = handshake;
exports.pad = pad;
exports.init = init;
exports.alertBar = alertBar;
-
diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js
index 6352b129..d39bfecd 100644
--- a/src/static/js/pad_editbar.js
+++ b/src/static/js/pad_editbar.js
@@ -140,7 +140,12 @@ var padeditbar = (function()
init: function() {
var self = this;
self.dropdowns = [];
-
+ // Listen for resize events (sucks but needed as iFrame ace_inner has to be position absolute
+ // A CSS fix for this would be nice but I'm not sure how we'd do it.
+ $(window).resize(function(){
+ self.redrawHeight();
+ });
+
$("#editbar .editbarbutton").attr("unselectable", "on"); // for IE
$("#editbar").removeClass("disabledtoolbar").addClass("enabledtoolbar");
$("#editbar [data-key]").each(function () {
@@ -149,6 +154,10 @@ var padeditbar = (function()
});
});
+ $('#editbar').show();
+
+ this.redrawHeight();
+
registerDefaultCommands(self);
hooks.callAll("postToolbarInit", {
@@ -170,6 +179,12 @@ var padeditbar = (function()
this.commands[cmd] = callback;
return this;
},
+ redrawHeight: function(){
+ var editbarHeight = $('.menu_left').height() + 2 + "px";
+ var containerTop = $('.menu_left').height() + 5 + "px";
+ $('#editbar').css("height", editbarHeight);
+ $('#editorcontainer').css("top", containerTop);
+ },
registerDropdownCommand: function (cmd, dropdown) {
dropdown = dropdown || cmd;
self.dropdowns.push(dropdown)