mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Add newsletter base URL setting
This commit is contained in:
parent
7e11af1fd0
commit
1cb5f0b635
5 changed files with 51 additions and 21 deletions
|
@ -469,6 +469,19 @@ fieldset[disabled] .btn-bright.active {
|
||||||
.btn-group select {
|
.btn-group select {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
.input-group-addon-form {
|
||||||
|
display: inline-block;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
color: #e5e5e5;
|
||||||
|
background-color: #3B3B3B;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-top-right-radius: 3px !important;
|
||||||
|
border-bottom-right-radius: 3px !important;
|
||||||
|
height: 32px;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 5px;
|
||||||
|
opacity: 0.65;
|
||||||
|
}
|
||||||
#user-selection label {
|
#user-selection label {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
<li role="presentation"><a href="#tabs-plex_media_server" aria-controls="tabs-plex_media_server" role="tab" data-toggle="tab">Plex Media Server</a></li>
|
<li role="presentation"><a href="#tabs-plex_media_server" aria-controls="tabs-plex_media_server" role="tab" data-toggle="tab">Plex Media Server</a></li>
|
||||||
<li role="presentation"><a href="#tabs-notifications" aria-controls="tabs-notifications" role="tab" data-toggle="tab">Notifications</a></li>
|
<li role="presentation"><a href="#tabs-notifications" aria-controls="tabs-notifications" role="tab" data-toggle="tab">Notifications</a></li>
|
||||||
<li role="presentation"><a href="#tabs-notification_agents" aria-controls="tabs-notification_agents" role="tab" data-toggle="tab">Notification Agents</a></li>
|
<li role="presentation"><a href="#tabs-notification_agents" aria-controls="tabs-notification_agents" role="tab" data-toggle="tab">Notification Agents</a></li>
|
||||||
|
<li role="presentation"><a href="#tabs-newsletters" aria-controls="tabs-newsletters" role="tab" data-toggle="tab">Newsletters</a></li>
|
||||||
<li role="presentation"><a href="#tabs-newsletter_agents" aria-controls="tabs-newsletter_agents" role="tab" data-toggle="tab">Newsletter Agents</a></li>
|
<li role="presentation"><a href="#tabs-newsletter_agents" aria-controls="tabs-newsletter_agents" role="tab" data-toggle="tab">Newsletter Agents</a></li>
|
||||||
<li role="presentation"><a href="#tabs-import_backups" aria-controls="tabs-import_backups" role="tab" data-toggle="tab">Import & Backups</a></li>
|
<li role="presentation"><a href="#tabs-import_backups" aria-controls="tabs-import_backups" role="tab" data-toggle="tab">Import & Backups</a></li>
|
||||||
<li role="presentation"><a href="#tabs-android_app" aria-controls="tabs-android_app" role="tab" data-toggle="tab">Tautulli Remote Android App <sup><small>beta</small></sup></a></li>
|
<li role="presentation"><a href="#tabs-android_app" aria-controls="tabs-android_app" role="tab" data-toggle="tab">Tautulli Remote Android App <sup><small>beta</small></sup></a></li>
|
||||||
|
@ -692,7 +693,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="pms_web_url" name="pms_web_url" value="${config['pms_web_url']}" size="30" data-parsley-trigger="change" data-parsley-pattern="^https?:\/\/\S+$|^https:\/\/app.plex.tv\/desktop$" data-parsley-errors-container="#pms_web_url_error" data-parsley-error-message="Invalid Plex Web URL.">
|
<input type="text" class="form-control" id="pms_web_url" name="pms_web_url" value="${config['pms_web_url']}" size="30" data-parsley-trigger="change" data-parsley-pattern="^https?:\/\/\S+$|^https:\/\/app.plex.tv\/desktop$" data-parsley-errors-container="#pms_web_url_error" data-parsley-error-message="Invalid Plex Web URL">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-form" type="button" id="test_pms_web_button">Test URL</button>
|
<button class="btn btn-form" type="button" id="test_pms_web_button">Test URL</button>
|
||||||
</span>
|
</span>
|
||||||
|
@ -982,6 +983,32 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div role="tabpanel" class="tab-pane" id="tabs-newsletters">
|
||||||
|
|
||||||
|
<div class="padded-header">
|
||||||
|
<h3>Newsletters</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="newsletter_base_url">Newsletter Base URL</label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" id="newsletter_base_url" name="newsletter_base_url" value="${config['newsletter_base_url']}" placeholder="http://mydomain.com" data-parsley-trigger="change" data-parsley-pattern="^https?:\/\/\S+$" data-parsley-errors-container="#newsletter_base_url_error" data-parsley-error-message="Invalid URL">
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<span class="input-group-addon input-group-addon-form">/newsletter</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="newsletter_base_url_error" class="alert alert-danger settings-alert" role="alert"></div>
|
||||||
|
</div>
|
||||||
|
<p class="help-block">Set your Tautulli base URL for self-hosted newsletters. (e.g. http://mydomain.com)</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div role="tabpanel" class="tab-pane" id="tabs-newsletter_agents">
|
<div role="tabpanel" class="tab-pane" id="tabs-newsletter_agents">
|
||||||
|
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
|
|
|
@ -308,7 +308,8 @@ _CONFIG_DEFINITIONS = {
|
||||||
'MONITOR_REMOTE_ACCESS': (int, 'Monitoring', 0),
|
'MONITOR_REMOTE_ACCESS': (int, 'Monitoring', 0),
|
||||||
'MONITORING_INTERVAL': (int, 'Monitoring', 60),
|
'MONITORING_INTERVAL': (int, 'Monitoring', 60),
|
||||||
'MONITORING_USE_WEBSOCKET': (int, 'Monitoring', 0),
|
'MONITORING_USE_WEBSOCKET': (int, 'Monitoring', 0),
|
||||||
'NEWSLETTER_DIR': (str, 'General', ''),
|
'NEWSLETTER_DIR': (str, 'Newsletter', ''),
|
||||||
|
'NEWSLETTER_BASE_URL': (str, 'Newsletter', ''),
|
||||||
'NMA_APIKEY': (str, 'NMA', ''),
|
'NMA_APIKEY': (str, 'NMA', ''),
|
||||||
'NMA_ENABLED': (int, 'NMA', 0),
|
'NMA_ENABLED': (int, 'NMA', 0),
|
||||||
'NMA_PRIORITY': (int, 'NMA', 0),
|
'NMA_PRIORITY': (int, 'NMA', 0),
|
||||||
|
|
|
@ -341,8 +341,6 @@ class Newsletter(object):
|
||||||
self.is_preview = False
|
self.is_preview = False
|
||||||
|
|
||||||
def set_config(self, config=None, default=None):
|
def set_config(self, config=None, default=None):
|
||||||
self._add_config()
|
|
||||||
|
|
||||||
return self._validate_config(config=config, default=default)
|
return self._validate_config(config=config, default=default)
|
||||||
|
|
||||||
def _validate_config(self, config=None, default=None):
|
def _validate_config(self, config=None, default=None):
|
||||||
|
@ -353,14 +351,13 @@ class Newsletter(object):
|
||||||
for k, v in default.iteritems():
|
for k, v in default.iteritems():
|
||||||
if isinstance(v, int):
|
if isinstance(v, int):
|
||||||
new_config[k] = helpers.cast_to_int(config.get(k, v))
|
new_config[k] = helpers.cast_to_int(config.get(k, v))
|
||||||
|
elif isinstance(v, list):
|
||||||
|
new_config[k] = list(config.get(k, v))
|
||||||
else:
|
else:
|
||||||
new_config[k] = config.get(k, v)
|
new_config[k] = config.get(k, v)
|
||||||
|
|
||||||
return new_config
|
return new_config
|
||||||
|
|
||||||
def _add_config(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def retrieve_data(self):
|
def retrieve_data(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -448,12 +445,14 @@ class Newsletter(object):
|
||||||
def _build_params(self):
|
def _build_params(self):
|
||||||
date_format = helpers.momentjs_to_arrow(plexpy.CONFIG.DATE_FORMAT)
|
date_format = helpers.momentjs_to_arrow(plexpy.CONFIG.DATE_FORMAT)
|
||||||
|
|
||||||
|
base_url = plexpy.CONFIG.NEWSLETTER_BASE_URL or helpers.get_plexpy_url()
|
||||||
|
|
||||||
parameters = {
|
parameters = {
|
||||||
'server_name': plexpy.CONFIG.PMS_NAME,
|
'server_name': plexpy.CONFIG.PMS_NAME,
|
||||||
'start_date': self.start_date.format(date_format),
|
'start_date': self.start_date.format(date_format),
|
||||||
'end_date': self.end_date.format(date_format),
|
'end_date': self.end_date.format(date_format),
|
||||||
'newsletter_days': self.config['last_days'],
|
'newsletter_days': self.config['last_days'],
|
||||||
'newsletter_url': 'http://localhost:8181/dev'.rstrip('/') + '/newsletter/' + self.uuid,
|
'newsletter_url': base_url.rstrip('/') + '/newsletter/' + self.uuid,
|
||||||
'newsletter_uuid': self.uuid
|
'newsletter_uuid': self.uuid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,24 +499,13 @@ class RecentlyAdded(Newsletter):
|
||||||
"""
|
"""
|
||||||
NAME = 'Recently Added'
|
NAME = 'Recently Added'
|
||||||
_DEFAULT_CONFIG = {'last_days': 7,
|
_DEFAULT_CONFIG = {'last_days': 7,
|
||||||
'incl_libraries': None
|
'incl_libraries': []
|
||||||
}
|
}
|
||||||
_DEFAULT_SUBJECT = 'Recently Added to {server_name}! ({end_date})'
|
_DEFAULT_SUBJECT = 'Recently Added to {server_name}! ({end_date})'
|
||||||
_DEFAULT_BODY = 'View the newsletter here: {newsletter_url}'
|
_DEFAULT_BODY = 'View the newsletter here: {newsletter_url}'
|
||||||
_TEMPLATE_MASTER = 'recently_added_master.html'
|
_TEMPLATE_MASTER = 'recently_added_master.html'
|
||||||
_TEMPLATE = 'recently_added.html'
|
_TEMPLATE = 'recently_added.html'
|
||||||
|
|
||||||
def __init__(self, config=None, email_config=None, start_date=None, end_date=None, subject=None, body=None):
|
|
||||||
super(RecentlyAdded, self).__init__(config=config, email_config=email_config,
|
|
||||||
start_date=start_date, end_date=end_date,
|
|
||||||
subject=subject, body=body)
|
|
||||||
|
|
||||||
def _add_config(self):
|
|
||||||
if self.config['incl_libraries'] is None:
|
|
||||||
self.config['incl_libraries'] = []
|
|
||||||
elif not isinstance(self.config['incl_libraries'], list):
|
|
||||||
self.config['incl_libraries'] = [self.config['incl_libraries']]
|
|
||||||
|
|
||||||
def _get_recently_added(self, media_type=None):
|
def _get_recently_added(self, media_type=None):
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
pms_connect = pmsconnect.PmsConnect()
|
||||||
|
|
||||||
|
|
|
@ -2746,7 +2746,8 @@ class WebInterface(object):
|
||||||
"themoviedb_lookup": checked(plexpy.CONFIG.THEMOVIEDB_LOOKUP),
|
"themoviedb_lookup": checked(plexpy.CONFIG.THEMOVIEDB_LOOKUP),
|
||||||
"tvmaze_lookup": checked(plexpy.CONFIG.TVMAZE_LOOKUP),
|
"tvmaze_lookup": checked(plexpy.CONFIG.TVMAZE_LOOKUP),
|
||||||
"show_advanced_settings": plexpy.CONFIG.SHOW_ADVANCED_SETTINGS,
|
"show_advanced_settings": plexpy.CONFIG.SHOW_ADVANCED_SETTINGS,
|
||||||
"newsletter_dir": plexpy.CONFIG.NEWSLETTER_DIR
|
"newsletter_dir": plexpy.CONFIG.NEWSLETTER_DIR,
|
||||||
|
"newsletter_base_url": plexpy.CONFIG.NEWSLETTER_BASE_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
return serve_template(templatename="settings.html", title="Settings", config=config, kwargs=kwargs)
|
return serve_template(templatename="settings.html", title="Settings", config=config, kwargs=kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue