Changeset - 62822054a1e2
[Not reviewed]
default
0 4 0
Mads Kiilerich - 6 years ago 2019-08-11 14:14:48
mads@kiilerich.com
Grafted from: 36e7c9d416d5
admin: drop dead code for system update notifications

If we want it, we probably want to do it in a different way.
4 files changed with 1 insertions and 57 deletions:
0 comments (0 inline, 0 general)
kallithea/config/routing.py
Show inline comments
 
@@ -319,8 +319,6 @@ def make_map(config):
 
                  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,
kallithea/controllers/admin/settings.py
Show inline comments
 
@@ -422,7 +422,6 @@ class SettingsController(BaseController)
 

	
 
        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 @@ class SettingsController(BaseController)
 
            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'),
kallithea/lib/db_manage.py
Show inline comments
 
@@ -370,7 +370,6 @@ class DbManage(object):
 
            ('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_)
kallithea/templates/admin/settings/settings_system.html
Show inline comments
 
@@ -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>
0 comments (0 inline, 0 general)