- Fix bug where approxNumTorrents and other stats were not refreshed
when getting sent on 12 hour interval
- Lazy require modules
- Move setInterval into renderer/main.js
- Remove low-level https usage, use simple-get
By deferring more code in the renderer and loading state earlier, we
improve startup time by another 90ms!
Before: 507 unique requires (1270-1280ms)
After: 506 unique requires (1180-1190ms)
In Electron apps, the cost of large modules is very real.
fs-extra is very convenient, but removing it caused 50 fewer unique
files to be required(), resultin in 60ms faster startup!
Before: 557 unique requires (1330-1340ms)
After: 507 unique requires (1270-1280ms)
If the user accidentally pastes something that's not a torrent id, then
they get one "Invalid torrent Id" error for each line of the text.
Sure, this removes a "feature", but it's a pretty surprising one. When
I added it, I was being too clever, IMO.
The trim code can be removed, because that's handled in
controllers.torrentList.addTorrent().
Before this change, using the "Open Torrent Address" dialog to paste a
magnet link would fail with leading or trailing spaces.
Pasting on the torrent list page has always trimmed. So this PR just
makes it consistent.
Fixes two portable app bugs, to make the app fully "silent", not just
"portable". This means that not only are all data files stored in the
"Portable Settings" folder, but the app should leave no trace on the
host system.
- Disable Electron's single instance mode so no lock file is created in
"%APPDATA%\Roaming\WebTorrent".
- Put Electron crash files, and other electron files into the "Portable
Settings\Temp" folder instead of "%APPDATA%\Temp".
Fixes: #971
This is a perfect example of putting too many statements into a
try-catch block. My bad. I was trying to keep the code simple, but it
bit us here.
This happens because we were using IS_PRODUCTION, but the order of the
consts at the top are:
const IS_PORTABLE = isPortable()
const IS_PRODUCTION = isProduction()
So we're inside of isPortable() and referring to IS_PRODUCTION before
it's defined. This should have thrown an exception, since const does
not allow use-before-define, but we're transforming to ES5 with Babel.
Also, standard could have caught this, but we can't enable the
use-before-define rule until this bug is fixed:
https://github.com/feross/standard/issues/636
Basically, a perfect storm.