session key is now ignored and also padOptions are available in settings

This commit is contained in:
John McLear 2015-04-11 21:22:00 +01:00
parent 43687f6e8b
commit 8ed12c7776
5 changed files with 48 additions and 1 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ node_modules
settings.json settings.json
!settings.json.template !settings.json.template
APIKEY.txt APIKEY.txt
SESSIONKEY.txt
bin/abiword.exe bin/abiword.exe
bin/node.exe bin/node.exe
etherpad-lite-win.zip etherpad-lite-win.zip

View File

@ -49,6 +49,21 @@
//the default text of a pad //the default text of a pad
"defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n", "defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n",
/* Default Pad behavior, users can override by changing */
"padOptions": {
"noColors": false,
"showControls": true,
"showChat": true,
"showLineNumbers": true,
"useMonospaceFont": false,
"userName": false,
"userColor": false,
"rtl": false,
"alwaysShowChat": false,
"chatAndUsers": false,
"lang": "en-gb"
},
/* Shoud we suppress errors from being visible in the default Pad Text? */ /* Shoud we suppress errors from being visible in the default Pad Text? */
"suppressErrorsInPadText" : false, "suppressErrorsInPadText" : false,

View File

@ -1182,6 +1182,7 @@ function handleClientReady(client, message)
"userIsGuest": true, "userIsGuest": true,
"userColor": authorColorId, "userColor": authorColorId,
"padId": message.padId, "padId": message.padId,
"padOptions": settings.padOptions,
"initialTitle": "Pad: " + message.padId, "initialTitle": "Pad: " + message.padId,
"opts": {}, "opts": {},
// tell the client the number of the latest chat-message, which will be // tell the client the number of the latest chat-message, which will be

View File

@ -84,6 +84,23 @@ exports.dbSettings = { "filename" : path.join(exports.root, "dirty.db") };
*/ */
exports.defaultPadText = "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nEtherpad on Github: http:\/\/j.mp/ep-lite\n"; exports.defaultPadText = "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nEtherpad on Github: http:\/\/j.mp/ep-lite\n";
/**
* The default Pad Settings for a user (Can be overridden by changing the setting
*/
exports.padOptions = {
"noColors": false,
"showControls": true,
"showChat": true,
"showLineNumbers": true,
"useMonospaceFont": false,
"userName": false,
"userColor": false,
"rtl": false,
"alwaysShowChat": false,
"chatAndUsers": false,
"lang": "en-gb"
}
/** /**
* The toolbar buttons and order. * The toolbar buttons and order.
*/ */

View File

@ -126,6 +126,18 @@ var getParameters = [
function getParams() function getParams()
{ {
// Tries server enforced options first..
for(var i = 0; i < getParameters.length; i++)
{
var setting = getParameters[i];
var value = clientVars.padOptions[setting.name];
if(value.toString() === setting.checkVal)
{
setting.callback(value);
}
}
// Then URL applied stuff
var params = getUrlVars() var params = getUrlVars()
for(var i = 0; i < getParameters.length; i++) for(var i = 0; i < getParameters.length; i++)
@ -475,7 +487,6 @@ var pad = {
{ {
// start the custom js // start the custom js
if (typeof customStart == "function") customStart(); if (typeof customStart == "function") customStart();
getParams();
handshake(); handshake();
// To use etherpad you have to allow cookies. // To use etherpad you have to allow cookies.
@ -495,6 +506,8 @@ var pad = {
//initialize the chat //initialize the chat
chat.init(this); chat.init(this);
getParams();
padcookie.init(); // initialize the cookies padcookie.init(); // initialize the cookies
pad.initTime = +(new Date()); pad.initTime = +(new Date());
pad.padOptions = clientVars.initialOptions; pad.padOptions = clientVars.initialOptions;