Make tracker configurable, add crypto donations

pull/114/head
Alex Kern 6 years ago
parent a693751502
commit c222770d8d

@ -62,7 +62,7 @@ export default class App extends React.Component {
</div>
<footer className="footer">
<p>
BTC Donations: <strong>1P7yFQAC3EmpvsB7K9s6bKPvXEP1LPoQnY</strong>
<strong>Like FilePizza?</strong> Support it&apos;s development with a <a href="https://commerce.coinbase.com/checkout/247b6ffe-fb4e-47a8-9a76-e6b7ef83ea22">donation in crypto</a>.
</p>
<p className="byline">

@ -42,6 +42,14 @@ app.use([
require("./middleware/react")
]);
const TRACKERS = process.env.WEBTORRENT_TRACKERS
? process.env.WEBTORRENT_TRACKERS.split(',').map(t => [t.trim()])
: [
["wss://tracker.openwebtorrent.com"],
["wss://tracker.btorrent.xyz"],
["wss://tracker.fastcast.nz"]
];
function bootServer(server) {
var io = socketIO(server);
io.set("transports", ["polling"]);
@ -61,9 +69,9 @@ function bootServer(server) {
});
});
socket.on("rtcConfig", function(_, res) {
socket.on("trackerConfig", function(_, res) {
ice.getICEServers().then(function(iceServers) {
res({ iceServers: iceServers });
res({ rtcConfig: { iceServers }, announce: TRACKERS });
});
});

@ -34,8 +34,8 @@ export default alt.createStore(class DownloadStore {
if (this.status !== 'ready') return
this.status = 'requesting'
getClient().then((client) => {
client.add(this.infoHash, (torrent) => {
getClient().then(client => {
client.add(this.infoHash, { announce: client.tracker.announce }, (torrent) => {
this.setState({ status: 'downloading' })
const updateSpeed = () => {

@ -3,14 +3,6 @@ import alt from "../alt";
import socket from "filepizza-socket";
import { getClient } from "../wt";
const TRACKERS = process.env.WEBTORRENT_TRACKERS
? process.env.WEBTORRENT_TRACKERS.split(',').map(t => t.trim())
: [
["wss://tracker.openwebtorrent.com"],
["wss://tracker.btorrent.xyz"],
["wss://tracker.fastcast.nz"]
];
const SPEED_REFRESH_TIME = 2000;
export default alt.createStore(
@ -34,7 +26,7 @@ export default alt.createStore(
this.status = "processing";
getClient().then(client => {
client.seed(file, { announce: TRACKERS }, torrent => {
client.seed(file, { announce: client.tracker.announce }, torrent => {
const updateSpeed = () => {
this.setState({
speedUp: torrent.uploadSpeed,

@ -2,9 +2,9 @@ import socket from 'filepizza-socket'
export function getClient() {
return new Promise((resolve, reject) => {
socket.emit('rtcConfig', {}, (rtcConfig) => {
socket.emit('trackerConfig', {}, (trackerConfig) => {
const client = new WebTorrent({
tracker: { rtcConfig }
tracker: trackerConfig
})
resolve(client)
})

Loading…
Cancel
Save