Browse Source

replace getScript to ajax method by CSP update #354

twisterarmy
ghost 6 months ago
parent
commit
4f1b817869
  1. 15
      js/interface_home.js

15
js/interface_home.js

@ -344,7 +344,12 @@ function initWebTorrent() {
twister.torrentIds = $.localStorage.get('torrentIds'); twister.torrentIds = $.localStorage.get('torrentIds');
WEBTORRENT_ANNOUNCE = $.Options.WebTorrentTrackers.val.split(/[ ,]+/) WEBTORRENT_ANNOUNCE = $.Options.WebTorrentTrackers.val.split(/[ ,]+/)
$.getScript('js/webtorrent.min.js', function() {
jQuery.ajax({
crossDomain: true,
dataType: 'script',
url: 'js/webtorrent.min.js',
success: function() {
WebTorrentClient = new WebTorrent(); WebTorrentClient = new WebTorrent();
console.log("WebTorrent started") console.log("WebTorrent started")
WebTorrentClient.on('error', function (err) { WebTorrentClient.on('error', function (err) {
@ -354,7 +359,11 @@ function initWebTorrent() {
console.error('WARNING: ' + err.message); console.error('WARNING: ' + err.message);
}); });
$.getScript('js/localforage.min.js', function() { jQuery.ajax({
crossDomain: true,
dataType: 'script',
url: 'js/localforage.min.js',
success: function() {
localforage.setDriver([localforage.INDEXEDDB,localforage.WEBSQL]).then(function() { localforage.setDriver([localforage.INDEXEDDB,localforage.WEBSQL]).then(function() {
for (var torrentId in twister.torrentIds) { for (var torrentId in twister.torrentIds) {
if( twister.torrentIds[torrentId] ) { if( twister.torrentIds[torrentId] ) {
@ -416,7 +425,9 @@ function initWebTorrent() {
} }
}); });
}); });
}
}); });
}
}); });
} }

Loading…
Cancel
Save