2017-08-24 15:50:14 +02:00
|
|
|
import "babel-polyfill";
|
2017-08-07 00:23:54 +02:00
|
|
|
import React from 'react';
|
2017-08-25 03:46:55 +02:00
|
|
|
import ReactDOM from 'react-dom';
|
2017-08-20 17:57:57 +02:00
|
|
|
import { Provider } from 'react-redux';
|
2017-08-24 14:30:22 +02:00
|
|
|
import { ConnectedRouter } from 'react-router-redux';
|
2017-08-25 03:46:55 +02:00
|
|
|
import 'preact/devtools';
|
2017-08-26 01:41:34 +02:00
|
|
|
import './polyfills';
|
2017-08-20 17:57:57 +02:00
|
|
|
|
2017-09-08 06:55:47 +02:00
|
|
|
import store, { create, history } from './store';
|
2017-08-22 21:49:48 +02:00
|
|
|
import scss from '../scss/main.scss';
|
2017-08-22 00:10:52 +02:00
|
|
|
import { ws_init } from './socket';
|
|
|
|
import { filter_subscribe } from './actions/filter_subscribe';
|
2017-09-08 16:40:59 +02:00
|
|
|
import { socket_uri, socket_update, SOCKET_STATE } from './actions/socket';
|
2017-08-22 00:10:52 +02:00
|
|
|
|
2017-08-22 21:49:48 +02:00
|
|
|
import Nav from './ui/navigation';
|
|
|
|
import Main from './ui/main';
|
2017-08-26 01:34:04 +02:00
|
|
|
import Connection from './ui/connection';
|
|
|
|
|
2017-09-07 11:35:15 +02:00
|
|
|
export function initialize(uri) {
|
2017-09-08 16:40:59 +02:00
|
|
|
store.dispatch(socket_uri(uri));
|
2017-09-08 06:55:47 +02:00
|
|
|
store.dispatch(socket_update(SOCKET_STATE.CONNECTING));
|
2017-09-07 11:35:15 +02:00
|
|
|
ws_init(uri, () => {
|
2017-09-08 06:55:47 +02:00
|
|
|
store.dispatch(socket_update(SOCKET_STATE.CONNECTED));
|
2017-09-07 11:35:15 +02:00
|
|
|
store.dispatch(filter_subscribe());
|
|
|
|
store.dispatch(filter_subscribe('server'));
|
2017-09-08 06:55:47 +02:00
|
|
|
}, () => {
|
|
|
|
store.dispatch(socket_update(SOCKET_STATE.DISCONNECTED,
|
|
|
|
"You were disconnected."));
|
2017-09-07 11:35:15 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<Provider store={store}>
|
|
|
|
<ConnectedRouter history={history}>
|
|
|
|
<div>
|
|
|
|
<Nav />
|
2017-09-12 16:53:39 +02:00
|
|
|
<div className="container-fluid">
|
2017-09-07 11:35:15 +02:00
|
|
|
<Main />
|
2017-08-24 14:30:22 +02:00
|
|
|
</div>
|
2017-09-07 11:35:15 +02:00
|
|
|
</div>
|
|
|
|
</ConnectedRouter>
|
2017-09-08 04:06:49 +02:00
|
|
|
</Provider>, document.getElementById('root'));
|
2017-09-07 10:37:11 +02:00
|
|
|
|
|
|
|
navigator.registerProtocolHandler("magnet",
|
|
|
|
window.location.origin + "/add-torrent/%s",
|
|
|
|
"Open magnet link with receptor");
|