translate sizes and show speeds in bps

This commit is contained in:
nikk gitanes
2021-07-17 08:35:38 +03:00
parent b850e4b6aa
commit 3b33ace04f
18 changed files with 119 additions and 88 deletions

View File

@@ -49,24 +49,24 @@ var Mstile150x150png []byte
var Sitewebmanifest []byte var Sitewebmanifest []byte
//go:embed pages/static/js/2.65f701bf.chunk.js //go:embed pages/static/js/2.9044ecaa.chunk.js
var Staticjs265f701bfchunkjs []byte var Staticjs29044ecaachunkjs []byte
//go:embed pages/static/js/2.65f701bf.chunk.js.LICENSE.txt //go:embed pages/static/js/2.9044ecaa.chunk.js.LICENSE.txt
var Staticjs265f701bfchunkjsLICENSEtxt []byte var Staticjs29044ecaachunkjsLICENSEtxt []byte
//go:embed pages/static/js/2.65f701bf.chunk.js.map //go:embed pages/static/js/2.9044ecaa.chunk.js.map
var Staticjs265f701bfchunkjsmap []byte var Staticjs29044ecaachunkjsmap []byte
//go:embed pages/static/js/main.afca476d.chunk.js //go:embed pages/static/js/main.be1cb8cf.chunk.js
var Staticjsmainafca476dchunkjs []byte var Staticjsmainbe1cb8cfchunkjs []byte
//go:embed pages/static/js/main.afca476d.chunk.js.map //go:embed pages/static/js/main.be1cb8cf.chunk.js.map
var Staticjsmainafca476dchunkjsmap []byte var Staticjsmainbe1cb8cfchunkjsmap []byte
//go:embed pages/static/js/runtime-main.8bda5920.js //go:embed pages/static/js/runtime-main.8bda5920.js

View File

@@ -1,17 +1,17 @@
{ {
"files": { "files": {
"main.js": "/static/js/main.afca476d.chunk.js", "main.js": "/static/js/main.be1cb8cf.chunk.js",
"main.js.map": "/static/js/main.afca476d.chunk.js.map", "main.js.map": "/static/js/main.be1cb8cf.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.8bda5920.js", "runtime-main.js": "/static/js/runtime-main.8bda5920.js",
"runtime-main.js.map": "/static/js/runtime-main.8bda5920.js.map", "runtime-main.js.map": "/static/js/runtime-main.8bda5920.js.map",
"static/js/2.65f701bf.chunk.js": "/static/js/2.65f701bf.chunk.js", "static/js/2.9044ecaa.chunk.js": "/static/js/2.9044ecaa.chunk.js",
"static/js/2.65f701bf.chunk.js.map": "/static/js/2.65f701bf.chunk.js.map", "static/js/2.9044ecaa.chunk.js.map": "/static/js/2.9044ecaa.chunk.js.map",
"index.html": "/index.html", "index.html": "/index.html",
"static/js/2.65f701bf.chunk.js.LICENSE.txt": "/static/js/2.65f701bf.chunk.js.LICENSE.txt" "static/js/2.9044ecaa.chunk.js.LICENSE.txt": "/static/js/2.9044ecaa.chunk.js.LICENSE.txt"
}, },
"entrypoints": [ "entrypoints": [
"static/js/runtime-main.8bda5920.js", "static/js/runtime-main.8bda5920.js",
"static/js/2.65f701bf.chunk.js", "static/js/2.9044ecaa.chunk.js",
"static/js/main.afca476d.chunk.js" "static/js/main.be1cb8cf.chunk.js"
] ]
} }

View File

@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png"><link rel="manifest" href="/site.webmanifest"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><link rel="preconnect" href="https://fonts.gstatic.com"><link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&display=swap" rel="stylesheet"><meta name="viewport" content="width=device-width,shrink-to-fit=no"><meta name="description" content="TorrServer - torrent to http stream"/><title>TorrServer</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="https://cdn.lordicon.com/libs/frhvbuzj/lord-icon-2.0.2.js"></script><script src="https://www.gstatic.com/firebasejs/8.1.2/firebase-app.js"></script><script src="https://www.gstatic.com/firebasejs/8.1.2/firebase-analytics.js"></script><script>const firebaseConfig={apiKey:"AIzaSyDivIsadtzAmp3SIY4yArNcFugUmr63rvo",authDomain:"torrserve.firebaseapp.com",databaseURL:"https://torrserve.firebaseio.com",projectId:"torrserve",storageBucket:"torrserve.appspot.com",messagingSenderId:"400168070412",appId:"1:400168070412:web:82c8e43dd7fc8f807aed29",measurementId:"G-T4RC2BFRSF"};firebase.initializeApp(firebaseConfig),firebase.analytics()</script><script>!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var f=this.webpackJsonptorrserver_web=this.webpackJsonptorrserver_web||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([])</script><script src="/static/js/2.65f701bf.chunk.js"></script><script src="/static/js/main.afca476d.chunk.js"></script></body></html> <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png"><link rel="manifest" href="/site.webmanifest"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><link rel="preconnect" href="https://fonts.gstatic.com"><link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&display=swap" rel="stylesheet"><meta name="viewport" content="width=device-width,shrink-to-fit=no"><meta name="description" content="TorrServer - torrent to http stream"/><title>TorrServer</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="https://cdn.lordicon.com/libs/frhvbuzj/lord-icon-2.0.2.js"></script><script src="https://www.gstatic.com/firebasejs/8.1.2/firebase-app.js"></script><script src="https://www.gstatic.com/firebasejs/8.1.2/firebase-analytics.js"></script><script>const firebaseConfig={apiKey:"AIzaSyDivIsadtzAmp3SIY4yArNcFugUmr63rvo",authDomain:"torrserve.firebaseapp.com",databaseURL:"https://torrserve.firebaseio.com",projectId:"torrserve",storageBucket:"torrserve.appspot.com",messagingSenderId:"400168070412",appId:"1:400168070412:web:82c8e43dd7fc8f807aed29",measurementId:"G-T4RC2BFRSF"};firebase.initializeApp(firebaseConfig),firebase.analytics()</script><script>!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var f=this.webpackJsonptorrserver_web=this.webpackJsonptorrserver_web||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([])</script><script src="/static/js/2.9044ecaa.chunk.js"></script><script src="/static/js/main.be1cb8cf.chunk.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -9,8 +9,33 @@ func RouteWebPages(route *gin.RouterGroup) {
c.Data(200, "text/html; charset=utf-8", Indexhtml) c.Data(200, "text/html; charset=utf-8", Indexhtml)
}) })
route.GET("/apple-touch-icon.png", func(c *gin.Context) { route.GET("/asset-manifest.json", func(c *gin.Context) {
c.Data(200, "image/png", Appletouchiconpng) c.Data(200, "application/json", Assetmanifestjson)
})
route.GET("/index.html", func(c *gin.Context) {
c.Data(200, "text/html; charset=utf-8", Indexhtml)
})
route.GET("/static/js/2.9044ecaa.chunk.js", func(c *gin.Context) {
c.Data(200, "application/javascript", Staticjs29044ecaachunkjs)
})
route.GET("/static/js/2.9044ecaa.chunk.js.map", func(c *gin.Context) {
c.Data(200, "application/json", Staticjs29044ecaachunkjsmap)
})
route.GET("/android-chrome-192x192.png", func(c *gin.Context) {
c.Data(200, "image/png", Androidchrome192x192png)
})
route.GET("/browserconfig.xml", func(c *gin.Context) {
c.Data(200, "application/xml", Browserconfigxml)
}) })
@@ -19,13 +44,33 @@ func RouteWebPages(route *gin.RouterGroup) {
}) })
route.GET("/static/js/main.afca476d.chunk.js", func(c *gin.Context) { route.GET("/static/js/2.9044ecaa.chunk.js.LICENSE.txt", func(c *gin.Context) {
c.Data(200, "application/javascript", Staticjsmainafca476dchunkjs) c.Data(200, "text/plain; charset=utf-8", Staticjs29044ecaachunkjsLICENSEtxt)
}) })
route.GET("/static/js/runtime-main.8bda5920.js", func(c *gin.Context) { route.GET("/static/js/main.be1cb8cf.chunk.js", func(c *gin.Context) {
c.Data(200, "application/javascript", Staticjsruntimemain8bda5920js) c.Data(200, "application/javascript", Staticjsmainbe1cb8cfchunkjs)
})
route.GET("/apple-touch-icon.png", func(c *gin.Context) {
c.Data(200, "image/png", Appletouchiconpng)
})
route.GET("/mstile-150x150.png", func(c *gin.Context) {
c.Data(200, "image/png", Mstile150x150png)
})
route.GET("/site.webmanifest", func(c *gin.Context) {
c.Data(200, "application/manifest+json", Sitewebmanifest)
})
route.GET("/static/js/main.be1cb8cf.chunk.js.map", func(c *gin.Context) {
c.Data(200, "application/json", Staticjsmainbe1cb8cfchunkjsmap)
}) })
@@ -39,63 +84,18 @@ func RouteWebPages(route *gin.RouterGroup) {
}) })
route.GET("/browserconfig.xml", func(c *gin.Context) {
c.Data(200, "application/xml", Browserconfigxml)
})
route.GET("/favicon-16x16.png", func(c *gin.Context) { route.GET("/favicon-16x16.png", func(c *gin.Context) {
c.Data(200, "image/png", Favicon16x16png) c.Data(200, "image/png", Favicon16x16png)
}) })
route.GET("/static/js/2.65f701bf.chunk.js.LICENSE.txt", func(c *gin.Context) {
c.Data(200, "text/plain; charset=utf-8", Staticjs265f701bfchunkjsLICENSEtxt)
})
route.GET("/android-chrome-192x192.png", func(c *gin.Context) {
c.Data(200, "image/png", Androidchrome192x192png)
})
route.GET("/index.html", func(c *gin.Context) {
c.Data(200, "text/html; charset=utf-8", Indexhtml)
})
route.GET("/site.webmanifest", func(c *gin.Context) {
c.Data(200, "application/manifest+json", Sitewebmanifest)
})
route.GET("/static/js/2.65f701bf.chunk.js", func(c *gin.Context) {
c.Data(200, "application/javascript", Staticjs265f701bfchunkjs)
})
route.GET("/static/js/2.65f701bf.chunk.js.map", func(c *gin.Context) {
c.Data(200, "application/json", Staticjs265f701bfchunkjsmap)
})
route.GET("/static/js/main.afca476d.chunk.js.map", func(c *gin.Context) {
c.Data(200, "application/json", Staticjsmainafca476dchunkjsmap)
})
route.GET("/asset-manifest.json", func(c *gin.Context) {
c.Data(200, "application/json", Assetmanifestjson)
})
route.GET("/favicon.ico", func(c *gin.Context) { route.GET("/favicon.ico", func(c *gin.Context) {
c.Data(200, "image/x-icon", Faviconico) c.Data(200, "image/x-icon", Faviconico)
}) })
route.GET("/mstile-150x150.png", func(c *gin.Context) { route.GET("/static/js/runtime-main.8bda5920.js", func(c *gin.Context) {
c.Data(200, "image/png", Mstile150x150png) c.Data(200, "application/javascript", Staticjsruntimemain8bda5920js)
}) })
} }

View File

@@ -205,7 +205,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
<LoadingProgress <LoadingProgress
value={Filled} value={Filled}
fullAmount={bufferSize} fullAmount={bufferSize}
label={`${humanizeSize(bufferSize)} / ${humanizeSize(Filled) || '0 B'}`} label={`${humanizeSize(bufferSize)} / ${humanizeSize(Filled) || `0 ${t('B')}`}`}
/> />
</SectionHeader> </SectionHeader>

View File

@@ -7,7 +7,7 @@ import {
PhotoSizeSelectSmall as PhotoSizeSelectSmallIcon, PhotoSizeSelectSmall as PhotoSizeSelectSmallIcon,
Build as BuildIcon, Build as BuildIcon,
} from '@material-ui/icons' } from '@material-ui/icons'
import { getPeerString, humanizeSize } from 'utils/Utils' import { getPeerString, humanizeSize, humanizeSpeed } from 'utils/Utils'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { GETTING_INFO, IN_DB, CLOSED, PRELOAD, WORKING } from 'torrentStates' import { GETTING_INFO, IN_DB, CLOSED, PRELOAD, WORKING } from 'torrentStates'
@@ -21,7 +21,7 @@ export const DownlodSpeedWidget = ({ data }) => {
return ( return (
<StatisticsField <StatisticsField
title={t('DownloadSpeed')} title={t('DownloadSpeed')}
value={humanizeSize(data) || '0 B'} value={humanizeSpeed(data) || `0 ${t('bps')}`}
iconBg={iconBGColor} iconBg={iconBGColor}
valueBg={valueBGColor} valueBg={valueBGColor}
icon={ArrowDownwardIcon} icon={ArrowDownwardIcon}
@@ -36,7 +36,7 @@ export const UploadSpeedWidget = ({ data }) => {
return ( return (
<StatisticsField <StatisticsField
title={t('UploadSpeed')} title={t('UploadSpeed')}
value={humanizeSize(data) || '0 B'} value={humanizeSpeed(data) || `0 ${t('bps')}`}
iconBg={iconBGColor} iconBg={iconBGColor}
valueBg={valueBGColor} valueBg={valueBGColor}
icon={ArrowUpwardIcon} icon={ArrowUpwardIcon}
@@ -51,7 +51,7 @@ export const PeersWidget = ({ data }) => {
return ( return (
<StatisticsField <StatisticsField
title={t('Peers')} title={t('Peers')}
value={getPeerString(data) || '[0] 0 / 0'} value={getPeerString(data) || '0 · 0 / 0'}
iconBg={iconBGColor} iconBg={iconBGColor}
valueBg={valueBGColor} valueBg={valueBGColor}
icon={SwapVerticalCircleIcon} icon={SwapVerticalCircleIcon}

View File

@@ -5,7 +5,7 @@ import {
Close as CloseIcon, Close as CloseIcon,
Delete as DeleteIcon, Delete as DeleteIcon,
} from '@material-ui/icons' } from '@material-ui/icons'
import { getPeerString, humanizeSize, removeRedundantCharacters } from 'utils/Utils' import { getPeerString, humanizeSize, humanizeSpeed, removeRedundantCharacters } from 'utils/Utils'
import { torrentsHost } from 'utils/Hosts' import { torrentsHost } from 'utils/Hosts'
import { NoImageIcon } from 'icons' import { NoImageIcon } from 'icons'
import DialogTorrentDetailsContent from 'components/DialogTorrentDetailsContent' import DialogTorrentDetailsContent from 'components/DialogTorrentDetailsContent'
@@ -103,7 +103,7 @@ const Torrent = ({ torrent }) => {
<div className='description-statistics-element-wrapper'> <div className='description-statistics-element-wrapper'>
<div className='description-section-name'>{t('Speed')}</div> <div className='description-section-name'>{t('Speed')}</div>
<div className='description-statistics-element-value'> <div className='description-statistics-element-value'>
{downloadSpeed > 0 ? humanizeSize(downloadSpeed) : '---'} {downloadSpeed > 0 ? humanizeSpeed(downloadSpeed) : '---'}
</div> </div>
</div> </div>

View File

@@ -20,6 +20,8 @@
}, },
"AddFromLink": "Add from Link", "AddFromLink": "Add from Link",
"AddNewTorrent": "Add new torrent", "AddNewTorrent": "Add new torrent",
"B": "B",
"bps": "bps",
"Buffer": "Preload Buffer / Cache", "Buffer": "Preload Buffer / Cache",
"BufferNote": "Set Preload Cache Before Play > 32 MB in settings to change preload size", "BufferNote": "Set Preload Cache Before Play > 32 MB in settings to change preload size",
"Cache": "Cache", "Cache": "Cache",
@@ -50,11 +52,17 @@
"Episode": "Episode", "Episode": "Episode",
"FromLatestFile": "From Latest File", "FromLatestFile": "From Latest File",
"Full": "Full", "Full": "Full",
"GB": "GB",
"Gbps": "Gbps",
"Host": "Host", "Host": "Host",
"Info": "Info", "Info": "Info",
"KB": "KB",
"kbps": "kbps",
"Kilobytes": "Kilobytes", "Kilobytes": "Kilobytes",
"LatestFilePlayed": "Latest file played:", "LatestFilePlayed": "Latest file played:",
"Links": "Links", "Links": "Links",
"MB": "MB",
"Mbps": "Mbps",
"Name": "Name", "Name": "Name",
"NoTorrentsAdded": "No torrents added", "NoTorrentsAdded": "No torrents added",
"Offline": "Offline", "Offline": "Offline",
@@ -72,6 +80,7 @@
"Save": "Save", "Save": "Save",
"ScrollDown": "scroll down", "ScrollDown": "scroll down",
"Season": "Season", "Season": "Season",
"Sec": "s",
"Seconds": "Seconds", "Seconds": "Seconds",
"SelectSeason": "Select Season", "SelectSeason": "Select Season",
"SettingsDialog": { "SettingsDialog": {
@@ -117,6 +126,8 @@
"SpecialThanks": "Special Thanks", "SpecialThanks": "Special Thanks",
"Speed": "Speed", "Speed": "Speed",
"Support": "Support", "Support": "Support",
"TB": "TB",
"Tbps": "Tbps",
"ThanksToEveryone": "Thanks to everyone who tested and helped.", "ThanksToEveryone": "Thanks to everyone who tested and helped.",
"TorrentAdded": "Added", "TorrentAdded": "Added",
"TorrentClosed": "Сlosed", "TorrentClosed": "Сlosed",

View File

@@ -20,6 +20,8 @@
}, },
"AddFromLink": "Добавить", "AddFromLink": "Добавить",
"AddNewTorrent": "Добавить новый торрент", "AddNewTorrent": "Добавить новый торрент",
"B": "Б",
"bps": "бит/c",
"Buffer": "Предзагрузка / Кеш", "Buffer": "Предзагрузка / Кеш",
"BufferNote": "Установите Буфер предзагрузки > 32 МБ в настройках для измененения размера предзагрузки", "BufferNote": "Установите Буфер предзагрузки > 32 МБ в настройках для измененения размера предзагрузки",
"Cache": "Кеш", "Cache": "Кеш",
@@ -50,12 +52,17 @@
"Episode": "Серия", "Episode": "Серия",
"FromLatestFile": "C последнего файла", "FromLatestFile": "C последнего файла",
"Full": "Полный", "Full": "Полный",
"GB": "ГБ",
"Gbps": "Гбит/c",
"Host": "Хост", "Host": "Хост",
"Info": "Инфо", "Info": "Инфо",
"KB": "КБ", "KB": "КБ",
"kbps": "кбит/с",
"Kilobytes": "Килобайты", "Kilobytes": "Килобайты",
"LatestFilePlayed": "Последний воспроизведенный файл:", "LatestFilePlayed": "Последний воспроизведенный файл:",
"Links": "Ссылки", "Links": "Ссылки",
"MB": "МБ",
"Mbps": "Мбит/c",
"Name": "Название", "Name": "Название",
"NoTorrentsAdded": "Нет торрентов", "NoTorrentsAdded": "Нет торрентов",
"Offline": "Сервер не доступен", "Offline": "Сервер не доступен",
@@ -73,7 +80,7 @@
"Save": "Сохранить", "Save": "Сохранить",
"ScrollDown": "прокрутить вниз", "ScrollDown": "прокрутить вниз",
"Season": "Сезон", "Season": "Сезон",
"Sec": "Cек.", "Sec": "c",
"Seconds": "Секунды", "Seconds": "Секунды",
"SelectSeason": "Выбор сезона", "SelectSeason": "Выбор сезона",
"SettingsDialog": { "SettingsDialog": {
@@ -119,6 +126,8 @@
"SpecialThanks": "Отдельное спасибо", "SpecialThanks": "Отдельное спасибо",
"Speed": "Скорость", "Speed": "Скорость",
"Support": "Поддержать", "Support": "Поддержать",
"TB": "ТБ",
"Tbps": "Тбит/с",
"ThanksToEveryone": "Спасибо всем, кто тестировал и помогал!", "ThanksToEveryone": "Спасибо всем, кто тестировал и помогал!",
"TorrentAdded": "Добавлен", "TorrentAdded": "Добавлен",
"TorrentClosed": "Закрыт", "TorrentClosed": "Закрыт",

View File

@@ -1,16 +1,27 @@
import axios from 'axios' import axios from 'axios'
import i18n from '../i18n'
import { torrentsHost } from './Hosts' import { torrentsHost } from './Hosts'
export function humanizeSize(size) { export function humanizeSize(size) {
if (!size) return '' if (!size) return ''
const i = Math.floor(Math.log(size) / Math.log(1024)) 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]}` return `${(size / Math.pow(1024, i)).toFixed(2) * 1} ${
[i18n.t('B'), i18n.t('KB'), i18n.t('MB'), i18n.t('GB'), i18n.t('TB')][i]
}`
}
export function humanizeSpeed(speed) {
if (!speed) return ''
const i = Math.floor(Math.log(speed * 8) / Math.log(1000))
return `${((speed * 8) / Math.pow(1000, i)).toFixed(0) * 1} ${
[i18n.t('bps'), i18n.t('kbps'), i18n.t('Mbps'), i18n.t('Gbps'), i18n.t('Tbps')][i]
}`
} }
export function getPeerString(torrent) { export function getPeerString(torrent) {
if (!torrent || !torrent.connected_seeders) return null if (!torrent || !torrent.connected_seeders) return null
return `[${torrent.connected_seeders}] ${torrent.active_peers} / ${torrent.total_peers}` return `${torrent.connected_seeders} · ${torrent.active_peers} / ${torrent.total_peers}`
} }
export const shortenText = (text, sympolAmount) => export const shortenText = (text, sympolAmount) =>