parent
14b9d1b592
commit
45f7c94931
|
@ -44,3 +44,5 @@ ReactDOM.render(
|
||||||
navigator.registerProtocolHandler("magnet",
|
navigator.registerProtocolHandler("magnet",
|
||||||
window.location.origin + "/add-torrent/%s",
|
window.location.origin + "/add-torrent/%s",
|
||||||
"Open magnet link with receptor");
|
"Open magnet link with receptor");
|
||||||
|
|
||||||
|
Notification && Notification.requestPermission();
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
import { UPDATE_RESOURCES, RESOURCES_REMOVED } from '../actions/resources';
|
import { UPDATE_RESOURCES, RESOURCES_REMOVED } from '../actions/resources';
|
||||||
import { SOCKET_STATE, SOCKET_UPDATE } from '../actions/socket';
|
import { SOCKET_STATE, SOCKET_UPDATE } from '../actions/socket';
|
||||||
|
|
||||||
|
function hack(old, _new) {
|
||||||
|
if (old && old.type == "torrent") {
|
||||||
|
if (old.progress != 1 && _new.progress == 1) {
|
||||||
|
Notification && new Notification("Download complete: " + _new.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _new;
|
||||||
|
}
|
||||||
|
|
||||||
export default function resourceReducer(type) {
|
export default function resourceReducer(type) {
|
||||||
return (state = {}, action) => {
|
return (state = {}, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
@ -11,7 +20,7 @@ export default function resourceReducer(type) {
|
||||||
.filter(r => r.type === type)
|
.filter(r => r.type === type)
|
||||||
.reduce((s, r) => ({
|
.reduce((s, r) => ({
|
||||||
...s,
|
...s,
|
||||||
[r.id]: { ...state[r.id], ...r }
|
[r.id]: hack(state[r.id], { ...state[r.id], ...r })
|
||||||
}), {})
|
}), {})
|
||||||
};
|
};
|
||||||
case RESOURCES_REMOVED:
|
case RESOURCES_REMOVED:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user