From 38524e70af32a5321216d201091e4b697d34a673 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 27 Oct 2018 12:49:22 +0200 Subject: [PATCH] update repo action + fixes --- basic/srv/vm/mgr/pkgmgr.py | 1 + basic/srv/vm/mgr/wsgiapp.py | 12 ++++++++++++ basic/srv/vm/static/js/admin.js | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/basic/srv/vm/mgr/pkgmgr.py b/basic/srv/vm/mgr/pkgmgr.py index 8c79c09..452e048 100644 --- a/basic/srv/vm/mgr/pkgmgr.py +++ b/basic/srv/vm/mgr/pkgmgr.py @@ -29,6 +29,7 @@ class PackageManager: def fetch_online_packages(self): # Fetches and verifies online packages. Can raise InvalidSignature + self.online_packages = {} packages = self.get_repo_resource('packages').content packages_sig = self.get_repo_resource('packages.sig').content with open(PUB_FILE, 'rb') as f: diff --git a/basic/srv/vm/mgr/wsgiapp.py b/basic/srv/vm/mgr/wsgiapp.py index 8b06ba3..d8e91e3 100644 --- a/basic/srv/vm/mgr/wsgiapp.py +++ b/basic/srv/vm/mgr/wsgiapp.py @@ -75,6 +75,7 @@ class WSGIApp(object): Rule('/verify-http', endpoint='verify_http_action', defaults={'proto': 'http'}), Rule('/update-cert', endpoint='update_cert_action'), Rule('/update-common', endpoint='update_common_action'), + Rule('/update-repo', endpoint='update_repo_action'), Rule('/update-app-visibility', endpoint='update_app_visibility_action'), Rule('/update-app-autostart', endpoint='update_app_autostart_action'), Rule('/start-app', endpoint='start_app_action'), @@ -236,6 +237,17 @@ class WSGIApp(object): return self.render_json({'error': request.session.lang.malformed_request()}) return self.render_json({'ok': request.session.lang.common_updated()}) + def update_repo_action(self, request): + # Update repository URL and credentials + try: + self.conf['repo']['url'] = request.form['repourl'] + self.conf['repo']['user'] = request.form['repousername'] + self.conf['repo']['pwd'] = request.form['repopassword'] + self.conf.save() + except: + pass + return redirect('/setup-apps') + def update_app_visibility_action(self, request): # Update application visibility on portal page try: diff --git a/basic/srv/vm/static/js/admin.js b/basic/srv/vm/static/js/admin.js index f154dfc..f91ea51 100644 --- a/basic/srv/vm/static/js/admin.js +++ b/basic/srv/vm/static/js/admin.js @@ -167,7 +167,7 @@ function install_app(ev) { function uninstall_app(ev) { var app = $(ev.target).closest('tr').children().first().text() - if (confirm('Opravdu chcete tuto odinstalovat aplikaci '+app+'?')) { + if (confirm('Opravdu chcete odinstalovat aplikaci '+app+'?')) { return _do_app('uninstall', ev); } return false; @@ -184,7 +184,7 @@ function check_progress() { if (value < 100) { progress.text(parseInt(value)); } else { - td.text('Instaluje se') + td.html('Instaluje se') } } else { tr.replaceWith(data.ok);