From: Calin Crisan Date: Sun, 22 Nov 2015 10:33:25 +0000 (+0200) Subject: added UI for the upload media files feature X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=847e834c16540f550cbf580f79dc0b07dbcd8352;p=motioneye-debian added UI for the upload media files feature --- diff --git a/motioneye/handlers.py b/motioneye/handlers.py index edfb390..3dc1f33 100644 --- a/motioneye/handlers.py +++ b/motioneye/handlers.py @@ -211,7 +211,13 @@ class ConfigHandler(BaseHandler): elif op == 'backup': self.backup() - + + elif op == 'test': + self.test() + + elif op == 'authorize': + self.authorize() + else: raise HTTPError(400, 'unknown operation') @@ -725,6 +731,14 @@ class ConfigHandler(BaseHandler): else: self.finish_json({'ok': False}) + + @BaseHandler.auth(admin=True) + def test(self): + pass + + @BaseHandler.auth(admin=True) + def authorize(self): + pass class PictureHandler(BaseHandler): diff --git a/motioneye/server.py b/motioneye/server.py index 96e0350..8a8b8d2 100644 --- a/motioneye/server.py +++ b/motioneye/server.py @@ -169,7 +169,7 @@ handler_mapping = [ (r'^/$', handlers.MainHandler), (r'^/config/main/(?Pset|get)/?$', handlers.ConfigHandler), (r'^/config/(?P\d+)/(?Pget|set|rem|set_preview)/?$', handlers.ConfigHandler), - (r'^/config/(?Padd|list|backup|restore)/?$', handlers.ConfigHandler), + (r'^/config/(?Padd|list|backup|restore|test|authorize)/?$', handlers.ConfigHandler), (r'^/picture/(?P\d+)/(?Pcurrent|list|frame)/?$', handlers.PictureHandler), (r'^/picture/(?P\d+)/(?Pdownload|preview|delete)/(?P.+?)/?$', handlers.PictureHandler), (r'^/picture/(?P\d+)/(?Pzipped|timelapse|delete_all)/(?P.*?)/?$', handlers.PictureHandler), diff --git a/motioneye/static/js/main.js b/motioneye/static/js/main.js index c34b5a2..2a43652 100644 --- a/motioneye/static/js/main.js +++ b/motioneye/static/js/main.js @@ -1040,7 +1040,9 @@ function updateConfigUI() { } } else { /* comparison */ - var equal = parts[parts.length - 1] == val; + var reqVal = parts[parts.length - 1]; + var reqRegex = new RegExp('^' + reqVal + '$'); + var equal = reqRegex.test(val); if (equal == neg) { conditionOk = false; return false; diff --git a/motioneye/templates/main.html b/motioneye/templates/main.html index 47b8677..0c07200 100644 --- a/motioneye/templates/main.html +++ b/motioneye/templates/main.html @@ -38,7 +38,7 @@ {% endfor %} {% elif config['type'] == 'html' %} -
+
{% endif %} {% if config.get('description') %}?{% endif %} @@ -332,6 +332,77 @@ ? + +
+ + + Upload Media Files + + ? + + + Upload Service + + + + ? + + + Server Address + + ? + + + Server Port + + ? + + + Location + + ? + + + Method + + + + ? + + + Username + + ? + + + Password + + ? + + + Authorization Key + + ? + + + + + + + ? + {% for config in camera_sections.get('storage', {}).get('configs', []) %} {{config_item(config)}} {% endfor %}