Removed shared Imgur client id

* Users must enter their own Imgur client id now
This commit is contained in:
JonnyWong16 2016-05-08 15:50:10 -07:00
parent e1b61214b7
commit 21fcbd85d8
4 changed files with 36 additions and 3 deletions

View file

@ -832,7 +832,7 @@
<div role="tabpanel" class="tab-pane" id="tabs-9">
<div class="padded-header">
<h3>Global Notification Toggles</h3>
<h3>Global Notification Settings</h3>
</div>
<div class="checkbox">
<label>
@ -861,6 +861,18 @@
</label>
<p class="help-block">Enable to upload Plex posters to Imgur for notifications. Disable if posters are not being used to save bandwidth.</p>
</div>
<div id="imgur_upload_options">
<div class="form-group">
<label for="imgur_client_id">Imgur Client ID</label>
<div class="row">
<div class="col-md-6">
<input type="text" class="form-control" id="imgur_client_id" name="imgur_client_id" value="${config['imgur_client_id']}" data-parsley-trigger="change">
</div>
</div>
<p class="help-block">Enter your Imgur API client ID in order to upload posters.
You can register a new anonymous usage application <a href="${anon_url('https://api.imgur.com/oauth2/addclient')}" target="_blank">here</a>.
</div>
</div>
<div class="padded-header">
<h3>Current Activity Notifications</h3>
@ -2148,6 +2160,20 @@ $(document).ready(function() {
}
});
if ($("#notify_upload_posters").is(":checked")) {
$("#imgur_upload_options").show();
} else {
$("#imgur_upload_options").hide();
}
$("#notify_upload_posters").click(function(){
if ($("#notify_upload_posters").is(":checked")) {
$("#imgur_upload_options").slideDown();
} else {
$("#imgur_upload_options").slideUp();
}
});
$( ".http-settings" ).change(function() {
httpChanged = true;
});

View file

@ -203,6 +203,7 @@ _CONFIG_DEFINITIONS = {
'IFTTT_ON_EXTUP': (int, 'IFTTT', 0),
'IFTTT_ON_INTUP': (int, 'IFTTT', 0),
'IFTTT_ON_PMSUPDATE': (int, 'IFTTT', 0),
'IMGUR_CLIENT_ID': (str, 'Monitoring', ''),
'JOURNAL_MODE': (str, 'Advanced', 'wal'),
'LAUNCH_BROWSER': (int, 'General', 1),
'LOG_BLACKLIST': (int, 'General', 1),

View file

@ -525,9 +525,14 @@ def anon_url(*url):
return '' if None in url else '%s%s' % (plexpy.CONFIG.ANON_REDIRECT, ''.join(str(s) for s in url))
def uploadToImgur(imgPath, imgTitle=''):
client_id = '743b1a443ccd2b0'
""" Uploads an image to Imgur """
client_id = plexpy.CONFIG.IMGUR_CLIENT_ID
img_url = ''
if not client_id:
logger.error(u"PlexPy Helpers :: Cannot upload poster to Imgur. No client id specifiec in the settings.")
return img_url
try:
with open(imgPath, 'rb') as imgFile:
img = imgFile.read()

View file

@ -2237,7 +2237,8 @@ class WebInterface(object):
"buffer_threshold": plexpy.CONFIG.BUFFER_THRESHOLD,
"buffer_wait": plexpy.CONFIG.BUFFER_WAIT,
"group_history_tables": checked(plexpy.CONFIG.GROUP_HISTORY_TABLES),
"git_token": plexpy.CONFIG.GIT_TOKEN
"git_token": plexpy.CONFIG.GIT_TOKEN,
"imgur_client_id": plexpy.CONFIG.IMGUR_CLIENT_ID
}
return serve_template(templatename="settings.html", title="Settings", config=config)