Fixed: Copy to clipboard not working with calendar feed (#3495)

* Replace flash clipboard implementation with document.execute("copy")

Fixes #3486

* Replace flash clipboard implementation with document.execCommand("copy")

Resolves Radarr/Radarr#3486
pull/3515/head
Michael Poutre 6 years ago committed by Leonardo Galli
parent c79578e99f
commit da012eb6b5

3
.gitignore vendored

@ -177,3 +177,6 @@ packages.config.md5sum
**/.idea/**/*.iml
**/.idea/**/contentModel.xml
**/.idea/**/modules.xml
# ignore node_modules symlink
node_modules
node_modules.nosync

102
package-lock.json generated

@ -318,6 +318,7 @@
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
"optional": true,
"requires": {
"hoek": "2.x.x"
}
@ -495,6 +496,7 @@
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz",
"integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=",
"optional": true,
"requires": {
"delayed-stream": "~1.0.0"
}
@ -638,7 +640,8 @@
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
"optional": true
},
"depd": {
"version": "0.4.5",
@ -875,7 +878,8 @@
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
"optional": true
},
"fancy-log": {
"version": "1.3.0",
@ -1061,7 +1065,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.1.1",
@ -1104,7 +1109,8 @@
},
"balanced-match": {
"version": "0.4.2",
"bundled": true
"bundled": true,
"optional": true
},
"bcrypt-pbkdf": {
"version": "1.0.1",
@ -1117,6 +1123,7 @@
"block-stream": {
"version": "0.0.9",
"bundled": true,
"optional": true,
"requires": {
"inherits": "~2.0.0"
}
@ -1124,6 +1131,7 @@
"boom": {
"version": "2.10.1",
"bundled": true,
"optional": true,
"requires": {
"hoek": "2.x.x"
}
@ -1131,6 +1139,7 @@
"brace-expansion": {
"version": "1.1.7",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^0.4.1",
"concat-map": "0.0.1"
@ -1138,7 +1147,8 @@
},
"buffer-shims": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"caseless": {
"version": "0.12.0",
@ -1152,30 +1162,36 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"combined-stream": {
"version": "1.0.5",
"bundled": true,
"optional": true,
"requires": {
"delayed-stream": "~1.0.0"
}
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"cryptiles": {
"version": "2.0.5",
"bundled": true,
"optional": true,
"requires": {
"boom": "2.x.x"
}
@ -1210,7 +1226,8 @@
},
"delayed-stream": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"delegates": {
"version": "1.0.0",
@ -1237,7 +1254,8 @@
},
"extsprintf": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"forever-agent": {
"version": "0.6.1",
@ -1256,11 +1274,13 @@
},
"fs.realpath": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"fstream": {
"version": "1.0.11",
"bundled": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"inherits": "~2.0.0",
@ -1311,6 +1331,7 @@
"glob": {
"version": "7.1.2",
"bundled": true,
"optional": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@ -1322,7 +1343,8 @@
},
"graceful-fs": {
"version": "4.1.11",
"bundled": true
"bundled": true,
"optional": true
},
"har-schema": {
"version": "1.0.5",
@ -1346,6 +1368,7 @@
"hawk": {
"version": "3.1.3",
"bundled": true,
"optional": true,
"requires": {
"boom": "2.x.x",
"cryptiles": "2.x.x",
@ -1355,7 +1378,8 @@
},
"hoek": {
"version": "2.16.3",
"bundled": true
"bundled": true,
"optional": true
},
"http-signature": {
"version": "1.1.1",
@ -1370,6 +1394,7 @@
"inflight": {
"version": "1.0.6",
"bundled": true,
"optional": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
@ -1377,7 +1402,8 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true
"bundled": true,
"optional": true
},
"ini": {
"version": "1.3.4",
@ -1387,6 +1413,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -1398,7 +1425,8 @@
},
"isarray": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"isstream": {
"version": "0.1.2",
@ -1461,11 +1489,13 @@
},
"mime-db": {
"version": "1.27.0",
"bundled": true
"bundled": true,
"optional": true
},
"mime-types": {
"version": "2.1.15",
"bundled": true,
"optional": true,
"requires": {
"mime-db": "~1.27.0"
}
@ -1473,17 +1503,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"bundled": true,
"optional": true
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -1533,7 +1566,8 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"oauth-sign": {
"version": "0.8.2",
@ -1548,6 +1582,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -1573,7 +1608,8 @@
},
"path-is-absolute": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"performance-now": {
"version": "0.2.0",
@ -1582,7 +1618,8 @@
},
"process-nextick-args": {
"version": "1.0.7",
"bundled": true
"bundled": true,
"optional": true
},
"punycode": {
"version": "1.4.1",
@ -1615,6 +1652,7 @@
"readable-stream": {
"version": "2.2.9",
"bundled": true,
"optional": true,
"requires": {
"buffer-shims": "~1.0.0",
"core-util-is": "~1.0.0",
@ -1657,13 +1695,15 @@
"rimraf": {
"version": "2.6.1",
"bundled": true,
"optional": true,
"requires": {
"glob": "^7.0.5"
}
},
"safe-buffer": {
"version": "5.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"semver": {
"version": "5.3.0",
@ -1683,6 +1723,7 @@
"sntp": {
"version": "1.0.9",
"bundled": true,
"optional": true,
"requires": {
"hoek": "2.x.x"
}
@ -1713,6 +1754,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -1722,6 +1764,7 @@
"string_decoder": {
"version": "1.0.1",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.0.1"
}
@ -1734,6 +1777,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -1746,6 +1790,7 @@
"tar": {
"version": "2.2.1",
"bundled": true,
"optional": true,
"requires": {
"block-stream": "*",
"fstream": "^1.0.2",
@ -1795,7 +1840,8 @@
},
"util-deprecate": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"uuid": {
"version": "3.0.1",
@ -1820,7 +1866,8 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
}
}
},
@ -2760,7 +2807,8 @@
"hoek": {
"version": "2.16.3",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0="
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
"optional": true
},
"homedir-polyfill": {
"version": "1.0.1",
@ -3522,12 +3570,14 @@
"mime-db": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz",
"integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg="
"integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=",
"optional": true
},
"mime-types": {
"version": "2.1.16",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz",
"integrity": "sha1-K4WKUuXs1RbbiXrCvodIeDBpjiM=",
"optional": true,
"requires": {
"mime-db": "~1.29.0"
}

@ -1,6 +1,5 @@
var Marionette = require('marionette');
var StatusModel = require('../System/StatusModel');
require('../Mixins/CopyToClipboard');
require('../Mixins/TagInput');
module.exports = Marionette.Layout.extend({
@ -18,16 +17,21 @@ module.exports = Marionette.Layout.extend({
events : {
'click .x-includeUnmonitored' : '_updateUrl',
'click .x-premiersOnly' : '_updateUrl',
'click .x-ical-copy' : '_copyIcalToClipboard',
'itemAdded .x-tags' : '_updateUrl',
'itemRemoved .x-tags' : '_updateUrl'
},
onShow : function() {
this._updateUrl();
this.ui.icalCopy.copyToClipboard(this.ui.icalUrl);
this.ui.tags.tagInput({ allowNew: false });
},
_copyIcalToClipboard: function () {
this.ui.icalUrl.select();
document.execCommand("copy");
},
_updateUrl : function() {
var icalUrl = window.location.host + StatusModel.get('urlBase') + '/feed/calendar/Radarr.ics?';

@ -1,22 +0,0 @@
var $ = require('jquery');
var StatusModel = require('../System/StatusModel');
var ZeroClipboard = require('zero.clipboard');
var Messenger = require('../Shared/Messenger');
$.fn.copyToClipboard = function(input) {
ZeroClipboard.config({
swfPath : StatusModel.get('urlBase') + '/Content/zero.clipboard.swf'
});
var client = new ZeroClipboard(this);
client.on('ready', function(e) {
client.on('copy', function(e) {
e.clipboardData.setData("text/plain", input.val());
});
client.on('aftercopy', function() {
Messenger.show({ message : 'Copied text to clipboard' });
});
});
};

@ -4,8 +4,6 @@ var CommandController = require('../../Commands/CommandController');
var AsModelBoundView = require('../../Mixins/AsModelBoundView');
var AsValidatedView = require('../../Mixins/AsValidatedView');
require('../../Mixins/CopyToClipboard');
var view = Marionette.ItemView.extend({
template : 'Settings/General/GeneralViewTemplate',
@ -14,6 +12,7 @@ var view = Marionette.ItemView.extend({
'change .x-proxy' : '_setProxyOptionsVisibility',
'change .x-ssl' : '_setSslOptionsVisibility',
'click .x-reset-api-key' : '_resetApiKey',
'click .x-copy-api-key' : '_copyApiKeyToClipboard',
'change .x-update-mechanism' : '_setScriptGroupVisibility'
},
@ -60,8 +59,9 @@ var view = Marionette.ItemView.extend({
});
},
onShow : function() {
this.ui.copyApiKey.copyToClipboard(this.ui.apiKeyInput);
_copyApiKeyToClipboard : function() {
this.ui.apiKeyInput.select();
document.execCommand("copy");
},
_setAuthOptionsVisibility : function() {

@ -29,7 +29,6 @@ require.config({
'messenger' : 'JsLibraries/messenger',
'jquery' : 'JsLibraries/jquery',
'typeahead' : 'JsLibraries/typeahead',
'zero.clipboard' : 'JsLibraries/zero.clipboard',
'libs' : 'JsLibraries/'
},

@ -11,7 +11,6 @@ require('jquery.knob');
require('jquery.easypiechart');
require('jquery.dotdotdot');
require('typeahead');
require('zero.clipboard');
/*Bootstrap*/
require('bootstrap');

Loading…
Cancel
Save