mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
add react web project
This commit is contained in:
16
web/src/utils/Hosts.js
Normal file
16
web/src/utils/Hosts.js
Normal file
@@ -0,0 +1,16 @@
|
||||
export var torrserverHost = ''
|
||||
// export var torrserverHost = 'http://127.0.0.1:8090'
|
||||
|
||||
export const torrentsHost = () => torrserverHost + '/torrents'
|
||||
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
|
||||
}
|
||||
10
web/src/utils/Utils.js
Normal file
10
web/src/utils/Utils.js
Normal file
@@ -0,0 +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]
|
||||
}
|
||||
|
||||
export function getPeerString(torrent) {
|
||||
if (!torrent || !torrent.connected_seeders) return '[0] 0 / 0'
|
||||
return '[' + torrent.connected_seeders + '] ' + torrent.active_peers + ' / ' + torrent.total_peers
|
||||
}
|
||||
Reference in New Issue
Block a user