Skip to content
Browse files

Enable multi-level domains to be recognized

This fixes the hardcoded [domain, tld] requirement for hosted instances
  • Loading branch information...
1 parent 19c3aa9 commit 47865ceeac991a3e91b62abdbb4b00daff58a7ee @mattsta committed Feb 2, 2010
Showing with 8 additions and 4 deletions.
  1. +8 −4 etherpad/src/etherpad/pro/pro_utils.js
View
12 etherpad/src/etherpad/pro/pro_utils.js
@@ -45,12 +45,16 @@ function getProRequestSubdomain() {
}
function getRequestSuperdomain() {
+ var SUPERDOMAINS = get_superdomains();
var parts = request.domain.split('.');
- parts.reverse();
- if (parts[0] == ".") {
- parts.shift();
+ /* Loop through the domain until a superdomain is found. */
+ while (parts.length > 0) {
+ var domain = parts.join('.');
+ if (SUPERDOMAINS[domain]) {
+ return domain;
+ }
+ parts.shift(); // remove next level
}
- return [parts[1], parts[0]].join('.');
}
function isProDomainRequest() {

0 comments on commit 47865ce

Please sign in to comment.
Something went wrong with that request. Please try again.