summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/config/default.py3
-rw-r--r--module/web/ServerThread.py41
-rw-r--r--module/web/static/js/views/packageView.js6
-rw-r--r--module/web/static/js/views/settingsView.js2
4 files changed, 42 insertions, 10 deletions
diff --git a/module/config/default.py b/module/config/default.py
index e55ba6593..902d4a6ad 100644
--- a/module/config/default.py
+++ b/module/config/default.py
@@ -62,7 +62,8 @@ def make_config(config):
("template", "str", _("Template"), _("Tooltip"), "default"),
("activated", "bool", _("Activated"), _("Tooltip"), True),
("prefix", "str", _("Path Prefix"), _("Tooltip"), ""),
- ("server", "threaded;fastcgi;fallback;lightweight", _("Server"), _("Tooltip"), "threaded"),
+ ("server", "auto;threaded;fallback;fastcgi", _("Server"), _("Tooltip"), "auto"),
+ ("force_server", "str", _("Favor specific server"), _("Tooltip"), ""),
("host", "ip", _("IP"), _("Tooltip"), "0.0.0.0"),
("https", "bool", _("Use HTTPS"), _("Tooltip"), False),
("port", "int", _("Port"), _("Tooltip"), 8001),
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py
index dc30f4bc5..ffe5ae380 100644
--- a/module/web/ServerThread.py
+++ b/module/web/ServerThread.py
@@ -38,6 +38,8 @@ class WebServer(threading.Thread):
def run(self):
self.running = True
+ # TODO: clean this up
+
import webinterface
global webinterface
@@ -63,22 +65,51 @@ class WebServer(threading.Thread):
log.warning(_("Of course you need to be familiar with linux and know how to compile software"))
self.server = "builtin"
-
try:
if self.server == "fastcgi":
self.start_fcgi()
- elif self.server in ("threaded", "builtin"):
+ elif self.server == "threaded":
self.start_threaded()
- elif self.server == "lightweight":
- self.start_lightweight()
- else:
+ elif self.server == "fallback":
self.start_fallback()
+ else:
+ self.start_auto()
+
except Exception, e:
log.error(_("Failed starting webserver: " + e.message))
self.error = e
if core:
core.print_exc()
+ def start_auto(self):
+ # TODO: select server
+
+# server = "wsgiref"
+# server = "tornado"
+# server = "fapws3"
+# server = "meinheld"
+# server = "eventlet"
+# server = "bjoern"
+ server = "threaded"
+
+ if server == "threaded":
+ return self.start_threaded()
+ if server == "wsgiref":
+ return self.start_fallback()
+ if server == "bjoern":
+ return self.start_lightweight()
+ if server == "meinheld":
+ def noop(*args, **kwargs):
+ pass
+ from meinheld import server as sv
+ sv.set_access_logger(None)
+ sv.set_error_logger(None)
+
+ sv.kill_server = noop
+
+ log.info("AUTO server %s" % server)
+ webinterface.run_server(host=self.host, port=self.port, server=server)
+
def start_fallback(self):
if self.https:
log.warning(_("This server offers no SSL, please consider using threaded instead"))
diff --git a/module/web/static/js/views/packageView.js b/module/web/static/js/views/packageView.js
index 365f3a69f..5d8aa7738 100644
--- a/module/web/static/js/views/packageView.js
+++ b/module/web/static/js/views/packageView.js
@@ -53,13 +53,12 @@ define(['jquery', 'views/abstract/itemView', 'underscore', 'views/fileView'],
ul.append(new fileView({model: file}).render().el);
});
- this.$el.append(ul);
-
// TODO: additionally it could be placed out of viewport first
// The real height can only be retrieved when element is on DOM and display:true
ul.css('visibility', 'hidden');
+ this.$el.append(ul);
+
var height = ul.height();
- ul.css('visibility', '');
// Hide the element when not expanded
if (!this.expanded) {
@@ -67,6 +66,7 @@ define(['jquery', 'views/abstract/itemView', 'underscore', 'views/fileView'],
ul.height(0);
}
+ ul.css('visibility', '');
ul.data('height', height);
console.log(ul.data("height"));
diff --git a/module/web/static/js/views/settingsView.js b/module/web/static/js/views/settingsView.js
index aba16eb66..a322cdae7 100644
--- a/module/web/static/js/views/settingsView.js
+++ b/module/web/static/js/views/settingsView.js
@@ -1,7 +1,7 @@
define(['jquery', 'underscore', 'backbone'],
function($, _, Backbone) {
- // Renders a single package item
+ // Renders settings over view page
return Backbone.View.extend({
el: "#content",