diff --git a/couchpotato/core/plugins/userscript/main.py b/couchpotato/core/plugins/userscript/main.py index e5999ab3..3ff7fb07 100644 --- a/couchpotato/core/plugins/userscript/main.py +++ b/couchpotato/core/plugins/userscript/main.py @@ -21,6 +21,7 @@ class Userscript(Plugin): addApiView('userscript.get//', self.getUserScript, static = True) addApiView('userscript', self.iFrame) addApiView('userscript.add_via_url', self.getViaUrl) + addApiView('userscript.includes', self.getIncludes) addApiView('userscript.bookmark', self.bookmark) addEvent('userscript.get_version', self.getVersion) @@ -35,6 +36,13 @@ class Userscript(Plugin): return self.renderTemplate(__file__, 'bookmark.js', **params) + def getIncludes(self): + + return jsonified({ + 'includes': fireEvent('userscript.get_includes', merge = True), + 'excludes': fireEvent('userscript.get_excludes', merge = True), + }) + def getUserScript(self, random = '', filename = ''): params = { diff --git a/couchpotato/templates/_desktop.html b/couchpotato/templates/_desktop.html index 77ace530..8689b666 100644 --- a/couchpotato/templates/_desktop.html +++ b/couchpotato/templates/_desktop.html @@ -55,6 +55,8 @@ 'is_remote': false }); + $(document.body).set('data-api', window.location.protocol + '//' + window.location.host + Api.createUrl().replace('/default/', '/')); + // Catch errors window.onerror = function(message, file, line){