Mercurial > kallithea
changeset 7840:62822054a1e2
admin: drop dead code for system update notifications
If we want it, we probably want to do it in a different way.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 11 Aug 2019 14:14:48 +0200 |
parents | cb4a0de6ca8e |
children | d9e37f7fd35b |
files | kallithea/config/routing.py kallithea/controllers/admin/settings.py kallithea/lib/db_manage.py kallithea/templates/admin/settings/settings_system.html |
diffstat | 4 files changed, 1 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/config/routing.py Sun Aug 04 18:43:33 2019 +0200 +++ b/kallithea/config/routing.py Sun Aug 11 14:14:48 2019 +0200 @@ -319,8 +319,6 @@ action="settings_system", conditions=dict(method=["POST"])) m.connect("admin_settings_system", "/settings/system", action="settings_system", conditions=dict(method=["GET"])) - m.connect("admin_settings_system_update", "/settings/system/updates", - action="settings_system_update", conditions=dict(method=["GET"])) # ADMIN MY ACCOUNT with rmap.submapper(path_prefix=ADMIN_PREFIX,
--- a/kallithea/controllers/admin/settings.py Sun Aug 04 18:43:33 2019 +0200 +++ b/kallithea/controllers/admin/settings.py Sun Aug 11 14:14:48 2019 +0200 @@ -422,7 +422,6 @@ import kallithea c.ini = kallithea.CONFIG - c.update_url = defaults.get('update_url') server_info = Setting.get_server_info() for key, val in server_info.iteritems(): setattr(c, key, val) @@ -432,46 +431,3 @@ defaults=defaults, encoding="UTF-8", force_defaults=False) - - @HasPermissionAnyDecorator('hg.admin') - def settings_system_update(self): - import json - import urllib2 - from kallithea.lib.verlib import NormalizedVersion - from kallithea import __version__ - - defaults = Setting.get_app_settings() - defaults.update(self._get_hg_ui_settings()) - _update_url = defaults.get('update_url', '') - _update_url = "" # FIXME: disabled - - _err = lambda s: '<div class="alert alert-danger">%s</div>' % (s) - try: - import kallithea - ver = kallithea.__version__ - log.debug('Checking for upgrade on `%s` server', _update_url) - opener = urllib2.build_opener() - opener.addheaders = [('User-agent', 'Kallithea-SCM/%s' % ver)] - response = opener.open(_update_url) - response_data = response.read() - data = json.loads(response_data) - except urllib2.URLError as e: - log.error(traceback.format_exc()) - return _err('Failed to contact upgrade server: %r' % e) - except ValueError as e: - log.error(traceback.format_exc()) - return _err('Bad data sent from update server') - - latest = data['versions'][0] - - c.update_url = _update_url - c.latest_data = latest - c.latest_ver = latest['version'] - c.cur_ver = __version__ - c.should_upgrade = False - - if NormalizedVersion(c.latest_ver) > NormalizedVersion(c.cur_ver): - c.should_upgrade = True - c.important_notices = latest['general'] - - return render('admin/settings/settings_system_update.html'),
--- a/kallithea/lib/db_manage.py Sun Aug 04 18:43:33 2019 +0200 +++ b/kallithea/lib/db_manage.py Sun Aug 11 14:14:48 2019 +0200 @@ -370,7 +370,6 @@ ('gravatar_url', User.DEFAULT_GRAVATAR_URL, 'unicode'), ('clone_uri_tmpl', Repository.DEFAULT_CLONE_URI, 'unicode'), ('clone_ssh_tmpl', Repository.DEFAULT_CLONE_SSH, 'unicode'), - ('update_url', Setting.DEFAULT_UPDATE_URL, 'unicode'), ] for key, val, type_ in settings: sett = Setting(key, val, type_)
--- a/kallithea/templates/admin/settings/settings_system.html Sun Aug 04 18:43:33 2019 +0200 +++ b/kallithea/templates/admin/settings/settings_system.html Sun Aug 11 14:14:48 2019 +0200 @@ -4,13 +4,12 @@ <% elems = [ - (_('Kallithea version'), h.literal('%s <b><span id="check_for_update" style="display:none">%s</span></b>') % (c.kallithea_version, _('Check for updates')), ''), + (_('Kallithea version'), c.kallithea_version, ''), (_('Kallithea configuration file'), c.ini['__file__'], ''), (_('Python version'), c.py_version, ''), (_('Platform'), c.platform, ''), (_('Git version'), c.git_version, ''), (_('Git path'), c.ini.get('git_path'), ''), - (_('Upgrade info endpoint'), h.literal('%s <br/><span class="text-muted">%s.</span>') % (c.update_url, _('Note: please make sure this server can access this URL')), ''), ] %> <dl class="dl-horizontal"> @@ -31,11 +30,3 @@ %endfor </tbody> </table> - -<script> - $('#check_for_update').click(function(e){ - var $update_notice = $('#update_notice'); - $update_notice.show(); - asynchtml(${h.js(h.url('admin_settings_system_update'))}, $update_notice); - }); -</script>