summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-11 16:59:39 -0500
committerEvan Prodromou <evan@status.net>2010-02-11 16:59:39 -0500
commitb96af33d978bddfa66aa893ff1d59f2d83903afa (patch)
tree68331224b792642757e4f5ba4801fd2dc6c31673
parentd6869cde7ba7e577d54f0c6ecab3599dc85f0f67 (diff)
put Javascript files under SSL
-rw-r--r--README11
-rw-r--r--lib/default.php3
-rw-r--r--lib/htmloutputter.php15
3 files changed, 26 insertions, 3 deletions
diff --git a/README b/README
index 9843ab89b..7531df997 100644
--- a/README
+++ b/README
@@ -1226,6 +1226,17 @@ path: Path part of theme URLs, before the theme name. Relative to the
ssl: Whether to use SSL for theme elements. Default is null, which means
guess based on site SSL settings.
+javascript
+----------
+
+server: You can speed up page loading by pointing the
+ theme file lookup to another server (virtual or real).
+ Defaults to NULL, meaning to use the site server.
+path: Path part of Javascript URLs. Defaults to null,
+ which means to use the site path + '/js/'.
+ssl: Whether to use SSL for JavaScript files. Default is null, which means
+ guess based on site SSL settings.
+
xmpp
----
diff --git a/lib/default.php b/lib/default.php
index d19e04036..8a21271b8 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -128,7 +128,8 @@ $default =
'ssl' => null),
'javascript' =>
array('server' => null,
- 'path'=> null),
+ 'path'=> null,
+ 'ssl' => null),
'throttle' =>
array('enabled' => false, // whether to throttle edits; false by default
'count' => 20, // number of allowed messages in timespan
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index 317f5ea61..47e56fc8f 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -376,9 +376,20 @@ class HTMLOutputter extends XMLOutputter
$server = common_config('site', 'server');
}
- // XXX: protocol
+ $ssl = common_config('javascript', 'ssl');
+
+ if (is_null($ssl)) { // null -> guess
+ if (common_config('site', 'ssl') == 'always' &&
+ !common_config('javascript', 'server')) {
+ $ssl = true;
+ } else {
+ $ssl = false;
+ }
+ }
+
+ $protocol = ($ssl) ? 'https' : 'http';
- $src = 'http://'.$server.$path.$src . '?version=' . STATUSNET_VERSION;
+ $src = $protocol.'://'.$server.$path.$src . '?version=' . STATUSNET_VERSION;
}
$this->element('script', array('type' => $type,