Commit fdec656c authored by Alain Takoudjou's avatar Alain Takoudjou

erp5_web_mynij_search: minor changes

add magnet_uri to souce form
add new tracker URL
destroy torrent when download is finished (to prevent client to automatically start to seed the torrent)
parent 9ba7ef01
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
.push(function (model) { .push(function (model) {
return gadget.changeState({ return gadget.changeState({
model_gadget: model, model_gadget: model,
client: new WebTorrent(), client: null,
seed_index: {} seed_index: {}
}); });
}); });
...@@ -302,6 +302,12 @@ ...@@ -302,6 +302,12 @@
}) })
}) })
.push(function () { .push(function () {
// stop seeding the torrent
gadget.state.client.destroy(function (err) {
if (err) {
console.error(err.stack || err.message || err);
}
});
if (gadget.state.redirect) { if (gadget.state.redirect) {
return gadget.redirect({command: 'display', options: { return gadget.redirect({command: 'display', options: {
page: gadget.state.redirect page: gadget.state.redirect
...@@ -320,7 +326,11 @@ ...@@ -320,7 +326,11 @@
key_list = []; key_list = [];
if (!container) if (!container)
return; return;
info = container.querySelector('h2.info')
key_list = Object.keys(gadget.state.seed_index); key_list = Object.keys(gadget.state.seed_index);
if (!key_list.length) {
info.innerText = "There is no torrent peer seeding!";
}
for (i = 0; i < key_list.length; i += 1) { for (i = 0; i < key_list.length; i += 1) {
let torrent = gadget.state.seed_index[key_list[i]]; let torrent = gadget.state.seed_index[key_list[i]];
if (!torrent.ready) { if (!torrent.ready) {
...@@ -330,7 +340,6 @@ ...@@ -330,7 +340,6 @@
// already present // already present
continue; continue;
} }
info = container.querySelector('h2.info')
if (info) { if (info) {
info.remove(); info.remove();
} }
...@@ -434,7 +443,8 @@ ...@@ -434,7 +443,8 @@
announceList: [ announceList: [
['wss://tracker.fastcast.nz'], ['wss://tracker.fastcast.nz'],
['wss://tracker.openwebtorrent.com'], ['wss://tracker.openwebtorrent.com'],
['wss://tracker.btorrent.xyz'] ['wss://tracker.btorrent.xyz'],
['wss://softinst140244.host.vifib.net']
], ],
comment: index_doc.title comment: index_doc.title
}, },
...@@ -474,6 +484,7 @@ ...@@ -474,6 +484,7 @@
}); });
} }
gadget.state.client = new WebTorrent();
return seedTorrent(); return seedTorrent();
}) })
...@@ -485,6 +496,7 @@ ...@@ -485,6 +496,7 @@
if (!torrent_id) { if (!torrent_id) {
return; return;
} }
gadget.state.client = new WebTorrent();
gadget.state.redirect = redirect; gadget.state.redirect = redirect;
container.classList.remove('hidden'); container.classList.remove('hidden');
return gadget.notifySubmitting() return gadget.notifySubmitting()
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.62605.47794.56695</string> </value> <value> <string>989.18558.11562.17885</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1609936717.76</float> <float>1610442308.5</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -62,12 +62,15 @@ ...@@ -62,12 +62,15 @@
continue; continue;
if (entry.status && !build_dict[key].status) if (entry.status && !build_dict[key].status)
entry = build_dict[key]; entry = build_dict[key];
else if (entry.status === "built" && else if ((entry.status === "built" ||
build_dict[key].status !== "built") entry.status === "built failed") &&
(build_dict[key].status !== "built" &&
build_dict[key].status !== "built failed"))
entry = build_dict[key]; entry = build_dict[key];
} }
} }
if (entry && entry.status === 'built') if (entry && (entry.status === 'built' ||
entry.status === "built failed"))
return; return;
return entry; return entry;
}); });
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.8577.12361.41625</string> </value> <value> <string>989.8588.57452.32853</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1609843972.59</float> <float>1610530616.84</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
} }
.torrent-seed .info, .torrent-download .info { .torrent-seed .info, .torrent-download .info {
font-size: 1.1em;
color: #ff6a00; color: #ff6a00;
padding-bottom: 10px;
font-size: .9em;
} }
\ No newline at end of file
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.48444.33021.4471</string> </value> <value> <string>989.8572.38390.65228</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1609842995.14</float> <float>1610441747.87</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</item> </item>
<item> <item>
<key> <string>configuration_content_security_policy</string> </key> <key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'self\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' https://content.dropboxapi.com https://api.dropboxapi.com wss://tracker.fastcast.nz wss://tracker.openwebtorrent.com wss://tracker.btorrent.xyz data: *.host.vifib.net *.node.vifib.com *.erp5.net https://cors-anywhere.herokuapp.com/; script-src \'self\' \'unsafe-eval\' \'unsafe-inline\'; font-src \'self\'; style-src \'self\' \'unsafe-inline\' data:; frame-src \'self\' data:</string> </value> <value> <string>default-src \'self\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' https://content.dropboxapi.com https://api.dropboxapi.com wss://tracker.fastcast.nz wss://tracker.openwebtorrent.com wss://tracker.btorrent.xyz wss://softinst140244.host.vifib.net data: *.host.vifib.net *.node.vifib.com *.erp5.net https://cors-anywhere.herokuapp.com/; script-src \'self\' \'unsafe-eval\' \'unsafe-inline\'; font-src \'self\'; style-src \'self\' \'unsafe-inline\' data:; frame-src \'self\' data:</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_default_jio_document_page_gadget_url</string> </key> <key> <string>configuration_default_jio_document_page_gadget_url</string> </key>
...@@ -514,7 +514,7 @@ WebSection_getMynijSearchPrecacheManifestList</string> </value> ...@@ -514,7 +514,7 @@ WebSection_getMynijSearchPrecacheManifestList</string> </value>
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>987.37947.26336.35635</string> </value> <value> <string>988.15217.51476.33467</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -532,7 +532,7 @@ WebSection_getMynijSearchPrecacheManifestList</string> </value> ...@@ -532,7 +532,7 @@ WebSection_getMynijSearchPrecacheManifestList</string> </value>
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1606395947.12</float> <float>1610378353.26</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Confirm import</string> </value> <value> <string>Import index from .zip file</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Confirm import Sources</string> </value> <value> <string>Load Sources from .json file</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
<string>my_title</string> <string>my_title</string>
<string>my_links</string> <string>my_links</string>
<string>my_seed</string> <string>my_seed</string>
<string>my_magnet_uri</string>
<string>my_status</string> <string>my_status</string>
</list> </list>
</value> </value>
......
...@@ -32,7 +32,8 @@ url_list = [ ...@@ -32,7 +32,8 @@ url_list = [
"flexsearch_en.js", "flexsearch_en.js",
"mynij_rss-parser.min.js", "mynij_rss-parser.min.js",
"rss-parser.min.js.map", "rss-parser.min.js.map",
"webtorrent.min.js" "webtorrent.min.js",
"jszip.min.js"
] ]
return url_list return url_list
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment