eslint added. lots of refactor

This commit is contained in:
Daniel Shleifman
2021-05-25 16:22:22 +03:00
parent aa0f2dc7da
commit be561767ea
46 changed files with 2369 additions and 1825 deletions

View File

@@ -1,17 +1,17 @@
export var torrserverHost = ''
// export var torrserverHost = 'http://127.0.0.1:8090'
let torrserverHost = process.env.REACT_APP_SERVER_HOST || ''
export const torrentsHost = () => torrserverHost + '/torrents'
export const viewedHost = () => torrserverHost + '/viewed'
export const cacheHost = () => torrserverHost + '/cache'
export const torrentUploadHost = () => torrserverHost + '/torrent/upload'
export const settingsHost = () => torrserverHost + '/settings'
export const streamHost = () => torrserverHost + '/stream'
export const shutdownHost = () => torrserverHost + '/shutdown'
export const echoHost = () => torrserverHost + '/echo'
export const playlistAllHost = () => torrserverHost + '/playlistall/all.m3u'
export const playlistTorrHost = () => torrserverHost + '/stream'
export const torrentsHost = () => `${torrserverHost}/torrents`
export const viewedHost = () => `${torrserverHost}/viewed`
export const cacheHost = () => `${torrserverHost}/cache`
export const torrentUploadHost = () => `${torrserverHost}/torrent/upload`
export const settingsHost = () => `${torrserverHost}/settings`
export const streamHost = () => `${torrserverHost}/stream`
export const shutdownHost = () => `${torrserverHost}/shutdown`
export const echoHost = () => `${torrserverHost}/echo`
export const playlistAllHost = () => `${torrserverHost}/playlistall/all.m3u`
export const playlistTorrHost = () => `${torrserverHost}/stream`
export const setTorrServerHost = (host) => {
torrserverHost = host
export const getTorrServerHost = () => torrserverHost
export const setTorrServerHost = host => {
torrserverHost = host
}

View File

@@ -1,10 +1,10 @@
export function humanizeSize(size) {
if (!size) return ''
var i = Math.floor(Math.log(size) / Math.log(1024))
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]
if (!size) return ''
const i = Math.floor(Math.log(size) / Math.log(1024))
return `${(size / Math.pow(1024, i)).toFixed(2) * 1} ${['B', 'kB', 'MB', 'GB', 'TB'][i]}`
}
export function getPeerString(torrent) {
if (!torrent || !torrent.connected_seeders) return ''
return '[' + torrent.connected_seeders + '] ' + torrent.active_peers + ' / ' + torrent.total_peers
if (!torrent || !torrent.connected_seeders) return ''
return `[${torrent.connected_seeders}] ${torrent.active_peers} / ${torrent.total_peers}`
}