diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html
index d7a597b8..8d8a51e8 100644
--- a/data/interfaces/default/index.html
+++ b/data/interfaces/default/index.html
@@ -67,6 +67,23 @@
% endif
% endfor
+% if _session['user_group'] == 'admin' and config['update_show_changelog']:
+
+% endif
%def>
<%def name="javascriptIncludes()">
@@ -411,4 +428,21 @@
});
% endif
+% if _session['user_group'] == 'admin' and config['update_show_changelog']:
+
+% endif
%def>
\ No newline at end of file
diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html
index a48d34c1..85057c94 100644
--- a/data/interfaces/default/settings.html
+++ b/data/interfaces/default/settings.html
@@ -4,7 +4,7 @@
import sys
import plexpy
- from plexpy import common, notifiers, versioncheck
+ from plexpy import common, notifiers
from plexpy.helpers import anon_url
available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['name'])
@@ -56,7 +56,7 @@
% if common.VERSION_NUMBER:
% endif
- ${versioncheck.read_changelog() | n}
@@ -2270,6 +2270,19 @@ $(document).ready(function() {
getConfigurationTable();
getSchedulerTable();
+ $('#changelog-modal-link').on('click', function (e) {
+ e.preventDefault();
+ $.ajax({
+ url: 'get_changelog',
+ cache: false,
+ async: true,
+ complete: function(xhr, status) {
+ $("#changelog-modal .modal-body").html(xhr.responseText);
+ $('#changelog-modal').modal();
+ }
+ });
+ });
+
$("#backup_config").click(function () {
var msg = 'Are you sure you want to create a backup of the PlexPy config?';
var url = 'backup_config';
diff --git a/plexpy/config.py b/plexpy/config.py
index 543cb2dc..7330ea1d 100644
--- a/plexpy/config.py
+++ b/plexpy/config.py
@@ -562,6 +562,7 @@ _CONFIG_DEFINITIONS = {
'TWITTER_ON_NEWDEVICE': (int, 'Twitter', 0),
'UPDATE_DB_INTERVAL': (int, 'General', 24),
'UPDATE_SECTION_IDS': (int, 'General', 1),
+ 'UPDATE_SHOW_CHANGELOG': (int, 'General', 1),
'UPDATE_LABELS': (int, 'General', 1),
'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1),
'VIDEO_LOGGING_ENABLE': (int, 'Monitoring', 1),
diff --git a/plexpy/versioncheck.py b/plexpy/versioncheck.py
index 30130b96..65f1cbbd 100644
--- a/plexpy/versioncheck.py
+++ b/plexpy/versioncheck.py
@@ -246,7 +246,7 @@ def update():
)
return
-def read_changelog():
+def read_changelog(latest_only=False):
changelog_file = os.path.join(plexpy.PROG_DIR, 'CHANGELOG.md')
@@ -260,11 +260,20 @@ def read_changelog():
output = ''
lines = logfile.readlines()
previous_line = ''
+ latest_version_found = False
+
for line in lines:
if line[:2] == '# ':
- output += '' + line[2:] + '
'
+ #output += '' + line[2:] + '
'
+ pass
elif line[:3] == '## ':
- output += '' + line[3:] + '
'
+ if latest_version_found:
+ break
+ elif latest_only:
+ output += 'PlexPy ' + line[3:] + '
'
+ latest_version_found = True
+ else:
+ output += '' + line[3:] + '
'
elif line[:2] == '* ' and previous_line.strip() == '':
output += '- ' + line[2:] + '
'
elif line[:2] == '* ' and previous_line[:4] == ' * ':
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index 4db3cb58..3bf6f234 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -175,7 +175,8 @@ class WebInterface(object):
"home_stats_cards": plexpy.CONFIG.HOME_STATS_CARDS,
"home_library_cards": plexpy.CONFIG.HOME_LIBRARY_CARDS,
"pms_identifier": plexpy.CONFIG.PMS_IDENTIFIER,
- "pms_name": plexpy.CONFIG.PMS_NAME
+ "pms_name": plexpy.CONFIG.PMS_NAME,
+ "update_show_changelog": plexpy.CONFIG.UPDATE_SHOW_CHANGELOG
}
return serve_template(templatename="index.html", title="Home", config=config)
@@ -3235,8 +3236,20 @@ class WebInterface(object):
@cherrypy.expose
@requireAuth(member_of("admin"))
def update(self, **kwargs):
+ # Show changelog after updating
+ plexpy.CONFIG.__setattr__('UPDATE_SHOW_CHANGELOG', 1)
+ plexpy.CONFIG.write()
return self.do_state_change('update', 'Updating', 120)
+ @cherrypy.expose
+ @requireAuth(member_of("admin"))
+ def get_changelog(self, latest_only=False, update_shown=False, **kwargs):
+ latest_only = True if latest_only == 'true' else False
+ # Set update changelog shown status
+ if update_shown == 'true':
+ plexpy.CONFIG.__setattr__('UPDATE_SHOW_CHANGELOG', 0)
+ plexpy.CONFIG.write()
+ return versioncheck.read_changelog(latest_only=latest_only)
##### Info #####