Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mynij
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mynij
mynij
Commits
ec253029
Commit
ec253029
authored
Feb 15, 2021
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_mynij_search: fix webtorrent client creation and progressbar during torrent download
parent
ddb879ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
17 deletions
+34
-17
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_mynij_webtorrent_html.html
...em/web_page_module/gadget_erp5_mynij_webtorrent_html.html
+1
-1
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_mynij_webtorrent_html.xml
...tem/web_page_module/gadget_erp5_mynij_webtorrent_html.xml
+2
-2
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_mynij_webtorrent_js.js
...teItem/web_page_module/gadget_erp5_mynij_webtorrent_js.js
+29
-12
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_mynij_webtorrent_js.xml
...eItem/web_page_module/gadget_erp5_mynij_webtorrent_js.xml
+2
-2
No files found.
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_mynij_webtorrent_html.html
View file @
ec253029
...
...
@@ -23,7 +23,7 @@
<
div
class
=
"
torrentBoddy {{#if is_seed}}is-seed{{/if}}
"
id
=
"
{{infohash}}
"
>
<
div
class
=
"
hero
"
>
<
div
class
=
"
output
"
>
<
div
class
=
"
progressBar
"
><
/div
>
<
div
class
=
"
progressBar
"
{{
#
if
is_seed
}}
style
=
"
width: 100%
"
{{
/if}}
></
div
>
<
/div
>
<
div
class
=
"
status
"
>
<
div
>
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_mynij_webtorrent_html.xml
View file @
ec253029
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
989.2729
2.54989.38297
</string>
</value>
<value>
<string>
989.2729
9.4752.580
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>
161
0966584.34
</float>
<float>
161
1306465.06
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_mynij_webtorrent_js.js
View file @
ec253029
...
...
@@ -37,19 +37,22 @@
remaining_html
=
element
.
querySelector
(
"
.remaining
"
),
remaining
,
downloadSpeed
=
element
.
querySelector
(
"
.downloadSpeed
"
),
uploadSpeed
=
element
.
querySelector
(
"
.uploadSpeed
"
);
uploadSpeed
=
element
.
querySelector
(
"
.uploadSpeed
"
),
percent
;
// Peers
num_peers
.
innerHTML
=
torrent
.
numPeers
+
(
torrent
.
numPeers
===
1
?
'
peer
'
:
'
peers
'
);
// Progress
var
percent
=
Math
.
round
(
torrent
.
progress
*
100
*
100
)
/
100
;
progressBar
.
style
.
width
=
percent
+
'
%
'
;
total
.
innerHTML
=
prettyBytes
(
torrent
.
length
);
if
(
!
downloaded
)
{
uploadSpeed
.
innerHTML
=
prettyBytes
(
torrent
.
uploadSpeed
)
+
'
/s
'
;
progressBar
.
style
.
width
=
'
100%
'
;
return
;
}
// Download progress
percent
=
Math
.
round
(
torrent
.
progress
*
100
*
100
)
/
100
;
progressBar
.
style
.
width
=
percent
+
'
%
'
;
downloaded
.
innerHTML
=
prettyBytes
(
torrent
.
downloaded
);
// Remaining time
...
...
@@ -74,6 +77,23 @@
return
element
;
}
function
createWebTorrent
()
{
return
new
WebTorrent
({
tracker
:
{
rtcConfig
:
{
// XXX - set configurable stun address
iceServers
:
[
{
urls
:
[
"
stun:turn.api.nexedi.net:3478
"
,
"
stun:stun.l.google.com:19302
"
,
"
stun:global.stun.twilio.com:3478
"
]}
]
}
}
});
}
gadget_klass
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
...
...
@@ -470,12 +490,9 @@
status
:
"
success
"
})
.
push
(
function
()
{
var
id
;
for
(
id
in
torrent_dict
)
{
if
(
torrent_dict
[
id
]
===
torrent
.
name
)
{
return
gadget
.
jio_get
(
id
);
}
}
return
gadget
.
state
.
model_gadget
.
updateIndexDoc
(
id
,
{
magnet_uri
:
torrent
.
magnetURI
});
});
};
...
...
@@ -560,7 +577,7 @@
});
}
gadget
.
state
.
client
=
new
WebTorrent
();
gadget
.
state
.
client
=
create
WebTorrent
();
return
seedTorrent
();
})
...
...
@@ -572,7 +589,7 @@
if
(
!
torrent_id
)
{
return
;
}
gadget
.
state
.
client
=
new
WebTorrent
();
gadget
.
state
.
client
=
create
WebTorrent
();
gadget
.
state
.
redirect
=
redirect
;
container
.
classList
.
remove
(
'
hidden
'
);
return
gadget
.
notifySubmitting
()
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_mynij_webtorrent_js.xml
View file @
ec253029
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
989.3
0650.55487.832
8
</string>
</value>
<value>
<string>
989.3
2134.13599.634
8
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
1611
221391.77
</float>
<float>
1611
306236.6
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment