aboutsummaryrefslogtreecommitdiffstats
path: root/etherpad
diff options
context:
space:
mode:
authoralexanders@b2ef00c0-3703-41da-baef-cfe82387ac0c <none@none>2010-02-03 11:24:06 +0000
committeralexanders@b2ef00c0-3703-41da-baef-cfe82387ac0c <none@none>2010-02-03 11:24:06 +0000
commita9ce606cc30d351070036c8a5c0f1a7aaeeb2c10 (patch)
treed9b39c76d289e6e4df3ba79592a7cc294c1b3a7f /etherpad
parentf7f86e56488e4cb9e5d4e42f637b71041ab7d9cb (diff)
downloadetherpad-a9ce606cc30d351070036c8a5c0f1a7aaeeb2c10.tar.gz
etherpad-a9ce606cc30d351070036c8a5c0f1a7aaeeb2c10.tar.xz
etherpad-a9ce606cc30d351070036c8a5c0f1a7aaeeb2c10.zip
fixed handling of superdomains
--HG-- extra : convert_revision : svn%3Ab2ef00c0-3703-41da-baef-cfe82387ac0c/trunk%4015
Diffstat (limited to 'etherpad')
-rw-r--r--etherpad/src/etherpad/control/pro_help_control.js60
-rw-r--r--etherpad/src/etherpad/globals.js6
-rw-r--r--etherpad/src/etherpad/pro/pro_utils.js11
-rw-r--r--etherpad/src/etherpad/sessions.js20
-rw-r--r--etherpad/src/main.js2
-rw-r--r--etherpad/src/static/css/pro-help.css19
6 files changed, 20 insertions, 98 deletions
diff --git a/etherpad/src/etherpad/control/pro_help_control.js b/etherpad/src/etherpad/control/pro_help_control.js
deleted file mode 100644
index 675e976..0000000
--- a/etherpad/src/etherpad/control/pro_help_control.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS-IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import("etherpad.utils.*");
-import("etherpad.globals.*");
-import("etherpad.billing.team_billing");
-
-var _helpTopics = [
-/* ['essentials', "EtherPad Essentials"], */
- ['billing', "Account Quotas and Billing"],
-/* ['guests', "Collaborating with Teammates and Guests"] */
-];
-
-function onRequest() {
- var pageId = request.path.split('/')[3];
- if (!pageId) {
- _renderPage('main');
- return true;
- }
- for (var i = 0; i < _helpTopics.length; i++) {
- var t = _helpTopics[i];
- if (t[0] == pageId) {
- _renderPage(pageId);
- return true;
- }
- }
-
- response.redirect('/ep/pro-help/');
-}
-
-function _renderPage(pageId) {
- function renderContent() {
- return renderTemplateAsString('pro-help/'+pageId+'.ejs', {
- helpTopics: _helpTopics,
- numFreeAccounts: PRO_FREE_ACCOUNTS,
- pricePerAccount: team_billing.COST_PER_USER
- });
- }
-
- renderFramed('pro-help/pro-help-template.ejs', {
- renderContent: renderContent
- });
-}
-
-
-
-
diff --git a/etherpad/src/etherpad/globals.js b/etherpad/src/etherpad/globals.js
index e279e1a..2bae776 100644
--- a/etherpad/src/etherpad/globals.js
+++ b/etherpad/src/etherpad/globals.js
@@ -28,9 +28,9 @@ function isProduction() {
var SUPERDOMAINS = {
'localhost': true,
- 'spline.inf.fu-berlin.de': true,
- 'spline.de': true,
- 'spline.nomad': true
+ 'pad.spline.inf.fu-berlin.de': true,
+ 'pad.spline.de': true,
+ 'pad.spline.nomad': true
};
var PNE_RELEASE_VERSION = "1.1.3";
diff --git a/etherpad/src/etherpad/pro/pro_utils.js b/etherpad/src/etherpad/pro/pro_utils.js
index 39a9193..17487b8 100644
--- a/etherpad/src/etherpad/pro/pro_utils.js
+++ b/etherpad/src/etherpad/pro/pro_utils.js
@@ -46,11 +46,14 @@ function getProRequestSubdomain() {
function getRequestSuperdomain() {
var parts = request.domain.split('.');
- parts.reverse();
- if (parts[0] == ".") {
- parts.shift();
+ parts.pop(); // Remove one level
+ while (parts.length > 0) {
+ var domain = parts.join('.');
+ if (SUPERDOMAINS[domain]) {
+ return domain;
+ }
+ parts.pop(); // Remove next level
}
- return [parts[1], parts[0]].join('.');
}
function isProDomainRequest() {
diff --git a/etherpad/src/etherpad/sessions.js b/etherpad/src/etherpad/sessions.js
index 633bf0b..c635e41 100644
--- a/etherpad/src/etherpad/sessions.js
+++ b/etherpad/src/etherpad/sessions.js
@@ -52,18 +52,16 @@ function _updateInitialReferrer(data) {
}
function _getScopedDomain(subDomain) {
- var d = request.domain;
- if (d.indexOf(".") == -1) {
- // special case for "localhost". For some reason, firefox does not like cookie domains
- // to be ".localhost".
- return undefined;
- }
- if (subDomain) {
- d = subDomain + "." + d;
- }
- return "." + d;
+ var parts = request.domain.split('.');
+ parts.pop(); // Remove one level
+ while (parts.length > 0) {
+ var domain = parts.join('.');
+ if (SUPERDOMAINS[domain]) {
+ return domain;
+ }
+ parts.pop(); // Remove next level
+ }
}
-
//--------------------------------------------------------------------------------
// pass in subDomain to get the session data for a particular subdomain --
diff --git a/etherpad/src/main.js b/etherpad/src/main.js
index ff46fb1..6c9e959 100644
--- a/etherpad/src/main.js
+++ b/etherpad/src/main.js
@@ -269,7 +269,7 @@ function checkHost() {
}
// redirect to etherpad.com
- var newurl = "http://pad.spline.inf.fu-berlin.de"+request.path;
+ var newurl = "http://pad.spline.inf.fu-berlin.de/"+request.path;
if (request.query) { newurl += "?"+request.query; }
response.redirect(newurl);
}
diff --git a/etherpad/src/static/css/pro-help.css b/etherpad/src/static/css/pro-help.css
deleted file mode 100644
index 9237b62..0000000
--- a/etherpad/src/static/css/pro-help.css
+++ /dev/null
@@ -1,19 +0,0 @@
-
-h1 {
- font-size: 1.33em;
- color: #555;
- border-bottom: 1px solid #888;
-}
-
-h2 {
- font-size: 1.1em;
- color: #333;
- border-bottom: 1px solid #888;
-}
-
-div.pro-help {
- font-size: 88%;
- width: 66%;
-}
-
-