Disable updated for Snap package

This commit is contained in:
JonnyWong16 2020-12-17 17:47:10 -08:00
parent da3bc127dc
commit a73c99fc64
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
5 changed files with 30 additions and 10 deletions

View file

@ -59,6 +59,8 @@
% endif
% if plexpy.INSTALL_TYPE == 'docker':
Update your Docker container or <a href="#" id="updateDismiss">Dismiss</a>
% elif plexpy.INSTALL_TYPE == 'snap':
Update your Snap package or <a href="#" id="updateDismiss">Dismiss</a>
% elif plexpy.INSTALL_TYPE in ('windows', 'macos'):
<a href="${anon_url('https://github.com/%s/%s/releases/tag/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.LATEST_RELEASE))}" target="_blank" rel="noreferrer">Download</a> and install the latest version or <a href="#" id="updateDismiss">Dismiss</a>
% else:
@ -337,6 +339,8 @@ ${next.modalIncludes()}
}
if (result.install_type === 'docker') {
msg += 'Update your Docker container or <a href="#" id="updateDismiss">Dismiss</a>';
} else if (result.install_type === 'snap') {
msg += 'Update your Snap package or <a href="#" id="updateDismiss">Dismiss</a>';
} else if (result.install_type === 'windows' || result.install_type === 'macos') {
msg += '<a href="' + result.release_url + '" target="_blank" rel="noreferrer">Download</a> and install the latest version or <a href="#" id="updateDismiss">Dismiss</a>'
} else {

View file

@ -220,7 +220,7 @@
<p class="help-block">Check for Tautulli updates periodically.</p>
</div>
<div id="git_update_options">
% if not plexpy.FROZEN:
% if not plexpy.SNAP and not plexpy.FROZEN:
<div class="checkbox">
<label>
<input type="checkbox" id="plexpy_auto_update" name="plexpy_auto_update" value="1" ${config['plexpy_auto_update']} ${docker_setting}> Update Automatically ${docker_msg | n}

View file

@ -257,7 +257,7 @@ def import_tautulli_config(config=None, backup=False):
# Remove keys that should not be imported
for key in _DO_NOT_IMPORT_KEYS:
delattr(imported_config, key)
if plexpy.DOCKER:
if plexpy.DOCKER or plexpy.SNAP:
for key in _DO_NOT_IMPORT_KEYS_DOCKER:
delattr(imported_config, key)
@ -540,3 +540,9 @@ class Config(object):
self.JWT_UPDATE_SECRET = True
self.CONFIG_VERSION = 16
if self.CONFIG_VERSION == 16:
if plexpy.SNAP:
self.PLEXPY_AUTO_UPDATE = 0
self.CONFIG_VERSION = 17

View file

@ -133,7 +133,13 @@ def get_version():
return cur_commit_hash, remote_name, branch_name
else:
plexpy.INSTALL_TYPE = 'docker' if plexpy.DOCKER else 'source'
if plexpy.DOCKER:
plexpy.INSTALL_TYPE = 'docker'
elif plexpy.SNAP:
plexpy.INSTALL_TYPE = 'snap'
else:
plexpy.INSTALL_TYPE = 'source'
current_version, current_branch = get_version_from_file()
return current_version, 'origin', current_branch
@ -162,10 +168,13 @@ def check_update(scheduler=False, notify=False, use_cache=False):
if not plexpy.CURRENT_VERSION:
plexpy.UPDATE_AVAILABLE = None
elif plexpy.COMMITS_BEHIND > 0 and (plexpy.common.BRANCH in ('master', 'beta') or plexpy.FROZEN) and \
elif plexpy.COMMITS_BEHIND > 0 and \
(plexpy.common.BRANCH in ('master', 'beta') or plexpy.SNAP or plexpy.FROZEN) and \
plexpy.common.RELEASE != plexpy.LATEST_RELEASE:
plexpy.UPDATE_AVAILABLE = 'release'
elif plexpy.COMMITS_BEHIND > 0 and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and not plexpy.FROZEN:
elif plexpy.COMMITS_BEHIND > 0 and \
not plexpy.SNAP and not plexpy.FROZEN and \
plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION:
plexpy.UPDATE_AVAILABLE = 'commit'
else:
plexpy.UPDATE_AVAILABLE = False
@ -265,7 +274,8 @@ def check_github(scheduler=False, notify=False, use_cache=False):
'plexpy_update_commit': plexpy.LATEST_VERSION,
'plexpy_update_behind': plexpy.COMMITS_BEHIND})
if scheduler and plexpy.CONFIG.PLEXPY_AUTO_UPDATE and not plexpy.DOCKER and not plexpy.FROZEN:
if scheduler and plexpy.CONFIG.PLEXPY_AUTO_UPDATE and \
not plexpy.DOCKER and not plexpy.SNAP and not plexpy.FROZEN:
logger.info('Running automatic update.')
plexpy.shutdown(restart=True, update=True)
@ -279,7 +289,7 @@ def update():
if not plexpy.UPDATE_AVAILABLE:
return
if plexpy.INSTALL_TYPE in ('docker', 'windows', 'macos'):
if plexpy.INSTALL_TYPE in ('docker', 'snap', 'windows', 'macos'):
return
elif plexpy.INSTALL_TYPE == 'git':

View file

@ -4309,7 +4309,7 @@ class WebInterface(object):
plexpy.CONFIG.GIT_REPO,
plexpy.CURRENT_VERSION,
plexpy.LATEST_VERSION))
}
}
else:
update = {'result': 'success',
@ -4317,7 +4317,7 @@ class WebInterface(object):
'message': 'Tautulli is up to date.'
}
if plexpy.DOCKER or plexpy.FROZEN:
if plexpy.DOCKER or plexpy.SNAP or plexpy.FROZEN:
update['install_type'] = plexpy.INSTALL_TYPE
return update
@ -4351,7 +4351,7 @@ class WebInterface(object):
@cherrypy.expose
@requireAuth(member_of("admin"))
def update(self, **kwargs):
if plexpy.DOCKER:
if plexpy.DOCKER or plexpy.SNAP:
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "home")
# Show changelog after updating