Files
TorrServerJellyfin/web/.eslintcache
2021-05-17 15:13:52 +03:00

1 line
39 KiB
Plaintext

[{"/home/yourok/MEGAWork/go/TorrServer/web/src/index.js":"1","/home/yourok/MEGAWork/go/TorrServer/web/src/App.js":"2","/home/yourok/MEGAWork/go/TorrServer/web/src/components/Appbar.js":"3","/home/yourok/MEGAWork/go/TorrServer/web/src/components/RemoveAll.js":"4","/home/yourok/MEGAWork/go/TorrServer/web/src/components/TorrentList.js":"5","/home/yourok/MEGAWork/go/TorrServer/web/src/components/Add.js":"6","/home/yourok/MEGAWork/go/TorrServer/web/src/components/Upload.js":"7","/home/yourok/MEGAWork/go/TorrServer/web/src/components/About.js":"8","/home/yourok/MEGAWork/go/TorrServer/web/src/components/Donate.js":"9","/home/yourok/MEGAWork/go/TorrServer/web/src/utils/Hosts.js":"10","/home/yourok/MEGAWork/go/TorrServer/web/src/components/Settings.js":"11","/home/yourok/MEGAWork/go/TorrServer/web/src/components/Torrent.js":"12","/home/yourok/MEGAWork/go/TorrServer/web/src/components/DialogCacheInfo.js":"13","/home/yourok/MEGAWork/go/TorrServer/web/src/components/DialogTorrentInfo.js":"14","/home/yourok/MEGAWork/go/TorrServer/web/src/utils/Utils.js":"15","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/index.js":"16","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/App.js":"17","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Appbar.js":"18","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Add.js":"19","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/RemoveAll.js":"20","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/TorrentList.js":"21","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Settings.js":"22","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/About.js":"23","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Donate.js":"24","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Upload.js":"25","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/utils/Hosts.js":"26","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Torrent.js":"27","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/DialogCacheInfo.js":"28","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/DialogTorrentInfo.js":"29","/home/yourok/MEGAWork/go/TorrServer_NE/web/src/utils/Utils.js":"30"},{"size":224,"mtime":1607328766846,"results":"31","hashOfConfig":"32"},{"size":840,"mtime":1607329513826,"results":"33","hashOfConfig":"32"},{"size":6552,"mtime":1614236662454,"results":"34","hashOfConfig":"32"},{"size":1416,"mtime":1607335705443,"results":"35","hashOfConfig":"32"},{"size":1568,"mtime":1607340137621,"results":"36","hashOfConfig":"32"},{"size":3345,"mtime":1607335694784,"results":"37","hashOfConfig":"32"},{"size":1348,"mtime":1607335733737,"results":"38","hashOfConfig":"32"},{"size":2278,"mtime":1608810011199,"results":"39","hashOfConfig":"32"},{"size":3634,"mtime":1615288639227,"results":"40","hashOfConfig":"32"},{"size":796,"mtime":1614236974272,"results":"41","hashOfConfig":"32"},{"size":9039,"mtime":1621236854096,"results":"42","hashOfConfig":"32"},{"size":5999,"mtime":1615533039159,"results":"43","hashOfConfig":"32"},{"size":6709,"mtime":1621240898456,"results":"44","hashOfConfig":"32"},{"size":7486,"mtime":1617970930041,"results":"45","hashOfConfig":"32"},{"size":419,"mtime":1614236662474,"results":"46","hashOfConfig":"32"},{"size":224,"mtime":1607328766846,"results":"47","hashOfConfig":"48"},{"size":840,"mtime":1607329513826,"results":"49","hashOfConfig":"48"},{"size":6552,"mtime":1614236662454,"results":"50","hashOfConfig":"48"},{"size":3345,"mtime":1607335694784,"results":"51","hashOfConfig":"48"},{"size":1416,"mtime":1607335705443,"results":"52","hashOfConfig":"48"},{"size":1568,"mtime":1607340137621,"results":"53","hashOfConfig":"48"},{"size":9039,"mtime":1621236854096,"results":"54","hashOfConfig":"48"},{"size":2278,"mtime":1608810011199,"results":"55","hashOfConfig":"48"},{"size":3634,"mtime":1615288639227,"results":"56","hashOfConfig":"48"},{"size":1348,"mtime":1607335733737,"results":"57","hashOfConfig":"48"},{"size":796,"mtime":1614236974272,"results":"58","hashOfConfig":"48"},{"size":5999,"mtime":1615533039159,"results":"59","hashOfConfig":"48"},{"size":6709,"mtime":1621240898456,"results":"60","hashOfConfig":"48"},{"size":7486,"mtime":1617970930041,"results":"61","hashOfConfig":"48"},{"size":419,"mtime":1614236662474,"results":"62","hashOfConfig":"48"},{"filePath":"63","messages":"64","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},"1btbc6o",{"filePath":"66","messages":"67","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"68","messages":"69","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"70","messages":"71","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"72","messages":"73","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"74","messages":"75","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"76","messages":"77","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"78","messages":"79","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"80","messages":"81","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"82","messages":"83","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"84","messages":"85","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"86","usedDeprecatedRules":"65"},{"filePath":"87","messages":"88","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"65"},{"filePath":"89","messages":"90","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":"91","usedDeprecatedRules":"65"},{"filePath":"92","messages":"93","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":"94","usedDeprecatedRules":"65"},{"filePath":"95","messages":"96","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"97"},{"filePath":"98","messages":"99","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"zht9eg",{"filePath":"100","messages":"101","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"102","messages":"103","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"104","messages":"105","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"106","messages":"107","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"108","messages":"109","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"110","messages":"111","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"112","messages":"113","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"114","messages":"115","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"116","messages":"117","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"118","messages":"119","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"120","messages":"121","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"122","messages":"123","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"124","messages":"125","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"126","messages":"127","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/yourok/MEGAWork/go/TorrServer/web/src/index.js",[],["128","129"],"/home/yourok/MEGAWork/go/TorrServer/web/src/App.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/Appbar.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/RemoveAll.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/TorrentList.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/Add.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/Upload.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/About.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/Donate.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/utils/Hosts.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/Settings.js",["130"],"import ListItem from '@material-ui/core/ListItem'\nimport ListItemIcon from '@material-ui/core/ListItemIcon'\nimport ListItemText from '@material-ui/core/ListItemText'\nimport React, { useEffect } from 'react'\nimport SettingsIcon from '@material-ui/icons/Settings'\nimport Dialog from '@material-ui/core/Dialog'\nimport DialogTitle from '@material-ui/core/DialogTitle'\nimport DialogContent from '@material-ui/core/DialogContent'\nimport TextField from '@material-ui/core/TextField'\nimport DialogActions from '@material-ui/core/DialogActions'\nimport Button from '@material-ui/core/Button'\nimport { FormControlLabel, InputLabel, Select, Switch } from '@material-ui/core'\nimport { settingsHost, setTorrServerHost, torrserverHost } from '../utils/Hosts'\n\nexport default function SettingsDialog() {\n const [open, setOpen] = React.useState(false)\n const [settings, setSets] = React.useState({})\n const [show, setShow] = React.useState(false)\n const [tsHost, setTSHost] = React.useState(torrserverHost ? torrserverHost : window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : ''))\n\n const handleClickOpen = () => {\n setOpen(true)\n }\n const handleClose = () => {\n setOpen(false)\n }\n const handleCloseSave = () => {\n setOpen(false)\n let sets = JSON.parse(JSON.stringify(settings))\n sets.CacheSize *= 1024 * 1024\n sets.PreloadBufferSize *= 1024 * 1024\n fetch(settingsHost(), {\n method: 'post',\n body: JSON.stringify({ action: 'set', sets: sets }),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n },\n })\n }\n\n useEffect(() => {\n fetch(settingsHost(), {\n method: 'post',\n body: JSON.stringify({ action: 'get' }),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n },\n })\n .then((res) => res.json())\n .then(\n (json) => {\n json.CacheSize /= 1024 * 1024\n json.PreloadBufferSize /= 1024 * 1024\n setSets(json)\n setShow(true)\n },\n (error) => {\n setShow(false)\n console.log(error)\n }\n )\n .catch((e) => {\n setShow(false)\n console.log(e)\n })\n }, [tsHost])\n\n const onInputHost = (event) => {\n let host = event.target.value\n setTorrServerHost(host)\n setTSHost(host)\n }\n\n const inputForm = (event) => {\n let sets = JSON.parse(JSON.stringify(settings))\n if (event.target.type === 'number' || event.target.type === 'select-one') {\n sets[event.target.id] = Number(event.target.value)\n } else if (event.target.type === 'checkbox') {\n sets[event.target.id] = Boolean(event.target.checked)\n } else if (event.target.type === 'url') {\n sets[event.target.id] = event.target.value\n }\n setSets(sets)\n }\n\n return (\n <div>\n <ListItem button key=\"Settings\" onClick={handleClickOpen}>\n <ListItemIcon>\n <SettingsIcon />\n </ListItemIcon>\n <ListItemText primary=\"Settings\" />\n </ListItem>\n <Dialog open={open} onClose={handleClose} aria-labelledby=\"form-dialog-title\" fullWidth={true}>\n <DialogTitle id=\"form-dialog-title\">Settings</DialogTitle>\n <DialogContent>\n <TextField onChange={onInputHost} margin=\"dense\" id=\"TorrServerHost\" label=\"Host\" value={tsHost} type=\"url\" fullWidth />\n {show && (\n <>\n <TextField onChange={inputForm} margin=\"dense\" id=\"CacheSize\" label=\"Cache size\" value={settings.CacheSize} type=\"number\" fullWidth />\n <FormControlLabel control={<Switch checked={settings.PreloadBuffer} onChange={inputForm} id=\"PreloadBuffer\" color=\"primary\" />} label=\"Preload buffer\" />\n <TextField onChange={inputForm} margin=\"dense\" id=\"ReaderReadAHead\" label=\"Reader readahead\" value={settings.ReaderReadAHead} type=\"number\" fullWidth />\n <h1 />\n <InputLabel htmlFor=\"RetrackersMode\">Retracker mode</InputLabel>\n <Select onChange={inputForm} type=\"number\" native=\"true\" id=\"RetrackersMode\" value={settings.RetrackersMode}>\n <option value={0}>Don't add retrackers</option>\n <option value={1}>Add retrackers</option>\n <option value={2}>Remove retrackers</option>\n <option value={3}>Replace retrackers</option>\n </Select>\n <TextField\n onChange={inputForm}\n margin=\"dense\"\n id=\"TorrentDisconnectTimeout\"\n label=\"Torrent disconnect timeout\"\n value={settings.TorrentDisconnectTimeout}\n type=\"number\"\n fullWidth\n />\n <FormControlLabel control={<Switch checked={settings.EnableIPv6} onChange={inputForm} id=\"EnableIPv6\" color=\"primary\" />} label=\"Enable IPv6\" />\n <br />\n <FormControlLabel control={<Switch checked={settings.ForceEncrypt} onChange={inputForm} id=\"ForceEncrypt\" color=\"primary\" />} label=\"Force encrypt\" />\n <br />\n <FormControlLabel control={<Switch checked={settings.DisableTCP} onChange={inputForm} id=\"DisableTCP\" color=\"primary\" />} label=\"Disable TCP\" />\n <br />\n <FormControlLabel control={<Switch checked={settings.DisableUTP} onChange={inputForm} id=\"DisableUTP\" color=\"primary\" />} label=\"Disable UTP\" />\n <br />\n <FormControlLabel control={<Switch checked={settings.DisableUPNP} onChange={inputForm} id=\"DisableUPNP\" color=\"primary\" />} label=\"Disable UPNP\" />\n <br />\n <FormControlLabel control={<Switch checked={settings.DisableDHT} onChange={inputForm} id=\"DisableDHT\" color=\"primary\" />} label=\"Disable DHT\" />\n <br />\n <FormControlLabel control={<Switch checked={settings.DisablePEX} onChange={inputForm} id=\"DisablePEX\" color=\"primary\" />} label=\"Disable PEX\" />\n <br />\n <FormControlLabel control={<Switch checked={settings.DisableUpload} onChange={inputForm} id=\"DisableUpload\" color=\"primary\" />} label=\"Disable upload\" />\n <br />\n <TextField onChange={inputForm} margin=\"dense\" id=\"DownloadRateLimit\" label=\"Download rate limit\" value={settings.DownloadRateLimit} type=\"number\" fullWidth />\n <TextField onChange={inputForm} margin=\"dense\" id=\"UploadRateLimit\" label=\"Upload rate limit\" value={settings.UploadRateLimit} type=\"number\" fullWidth />\n <TextField onChange={inputForm} margin=\"dense\" id=\"ConnectionsLimit\" label=\"Connections limit\" value={settings.ConnectionsLimit} type=\"number\" fullWidth />\n <TextField onChange={inputForm} margin=\"dense\" id=\"DhtConnectionLimit\" label=\"Dht connection limit\" value={settings.DhtConnectionLimit} type=\"number\" fullWidth />\n <TextField onChange={inputForm} margin=\"dense\" id=\"PeersListenPort\" label=\"Peers listen port\" value={settings.PeersListenPort} type=\"number\" fullWidth />\n <br />\n <FormControlLabel control={<Switch checked={settings.UseDisk} onChange={inputForm} id=\"UseDisk\" color=\"primary\" />} label=\"Use disk\" />\n <br />\n <TextField onChange={inputForm} margin=\"dense\" id=\"TorrentsSavePath\" label=\"Torrents save path\" value={settings.TorrentsSavePath} type=\"url\" fullWidth />\n </>\n )}\n </DialogContent>\n <DialogActions>\n <Button onClick={handleClose} color=\"primary\" variant=\"outlined\">\n Cancel\n </Button>\n <Button onClick={handleCloseSave} color=\"primary\" variant=\"outlined\">\n Save\n </Button>\n </DialogActions>\n </Dialog>\n </div>\n )\n}\n\n","/home/yourok/MEGAWork/go/TorrServer/web/src/components/Torrent.js",[],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/DialogCacheInfo.js",["131","132","133","134","135"],"import React, { useEffect, useRef } from 'react'\nimport Typography from '@material-ui/core/Typography'\n\nimport { getPeerString, humanizeSize } from '../utils/Utils'\nimport DialogTitle from '@material-ui/core/DialogTitle'\nimport DialogContent from '@material-ui/core/DialogContent'\nimport { cacheHost } from '../utils/Hosts'\n\nconst style = {\n cache: {\n paddingLeft: \"6px\",\n paddingRight: \"2px\",\n lineHeight: \"11px\",\n },\n piece: {\n width: \"12px\",\n height: \"12px\",\n backgroundColor: \"#eef2f4\",\n border: \"1px solid #eef2f4\",\n display: \"inline-block\",\n marginRight: \"1px\",\n },\n pieceComplete: {\n backgroundColor: \"#3fb57a\",\n borderColor: \"#3fb57a\",\n },\n pieceLoading: {\n backgroundColor: \"#00d0d0\",\n borderColor: \"#00d0d0\",\n },\n readerRange: {\n borderColor: \"#9a9aff !important\",\n },\n pieceReader: {\n borderColor: \"#000000 !important\",\n },\n pieceProgress: {\n position: \"relative\",\n zIndex: \"1\",\n backgroundColor: \"#009090\",\n\n left: \"-1px\",\n top: \"-1px\",\n width: \"12px\",\n },\n}\n\nexport default function DialogCacheInfo(props) {\n const [hash] = React.useState(props.hash)\n const [cache, setCache] = React.useState({})\n const timerID = useRef(-1)\n const [pMap, setPMap] = React.useState([])\n\n useEffect(() => {\n if (hash)\n timerID.current = setInterval(() => {\n getCache(hash, (cache) => {\n setCache(cache)\n })\n }, 100)\n else clearInterval(timerID.current)\n\n return () => {\n clearInterval(timerID.current)\n }\n }, [hash, props.open])\n\n useEffect(()=>{\n if (cache && cache.PiecesCount && cache.Pieces){\n var map = [];\n for (let i = 0; i < cache.PiecesCount; i++) {\n var reader = 0\n var cls = \"piece\"\n var prc = 0\n if (cache.Pieces[i]) {\n if (cache.Pieces[i].Completed && cache.Pieces[i].Size >= cache.Pieces[i].Length)\n cls += \" piece-complete\"\n else\n cls += \" piece-loading\"\n prc = (cache.Pieces[i].Size / cache.Pieces[i].Length * 100).toFixed(2)\n }\n\n cache.Readers.forEach((r, k) => {\n if (i >= r.Start && i <= r.End && i !== r.Reader)\n cls += \" reader-range\"\n if (i === r.Reader) {\n cls += \" piece-reader\"\n }\n })\n map.push({\n prc: prc,\n class: cls,\n info: i,\n reader: reader,\n })\n }\n setPMap(map)\n }\n },[cache.Pieces])\n\n return (\n <div>\n <DialogTitle id=\"form-dialog-title\">\n <Typography fullWidth>\n <b>Hash </b> {cache.Hash}\n <br />\n <b>Capacity </b> {humanizeSize(cache.Capacity)}\n <br />\n <b>Filled </b> {humanizeSize(cache.Filled)}\n <br />\n <b>Torrent size </b> {cache.Torrent && cache.Torrent.torrent_size && humanizeSize(cache.Torrent.torrent_size)}\n <br />\n <b>Pieces length </b> {humanizeSize(cache.PiecesLength)}\n <br />\n <b>Pieces count </b> {cache.PiecesCount}\n <br />\n <b>Peers: </b> {getPeerString(cache.Torrent)}\n <br />\n <b>Download speed </b> {cache.Torrent && cache.Torrent.download_speed ? humanizeSize(cache.Torrent.download_speed) + '/sec' : ''}\n <br />\n <b>Upload speed </b> {cache.Torrent && cache.Torrent.upload_speed ? humanizeSize(cache.Torrent.upload_speed) + '/sec' : ''}\n <br />\n <b>Status </b> {cache.Torrent && cache.Torrent.stat_string && cache.Torrent.stat_string}\n </Typography>\n </DialogTitle>\n <DialogContent>\n <div className=\"cache\">\n {pMap.map((itm) => <span className={itm.class} title={itm.info}>{itm.prc>0 && itm.prc<100 && (<div className=\"piece-progress\" style={{height: itm.prc/100*12+\"px\"}}></div>)}</span>)}\n </div>\n </DialogContent>\n </div>\n )\n}\n\nfunction getCacheMap(cache) {\n if (!cache || !cache.PiecesCount) return ''\n var html = ''\n for (let i = 0; i < cache.PiecesCount; i++) {\n html += \"<span class='piece\"\n let info = i\n var prcDiv = \"\"\n if (cache.Pieces && cache.Pieces[i]) {\n let prc = (cache.Pieces[i].Size/cache.Pieces[i].Length*100).toFixed(2)\n let piece = cache.Pieces[i]\n if (piece.Completed && piece.Size >= piece.Length) {\n html += ' piece-complete'\n info += ' 100%'\n }else {\n html += ' piece-loading'\n info += ' ' + prc + '%'\n prcDiv = \"<div class='piece-progress' style='height: \"+prc+\"%;'></div>\"\n }\n }\n cache.Readers.forEach((r,k)=> {\n if (i >= r.Start && i <= r.End && i !== r.Reader)\n html += ' reader-range'\n if (i === r.Reader) {\n html += ' piece-reader'\n info += ' reader'\n }\n })\n html += \"' title='\" + info + \"'>\"\n html += prcDiv\n html += \"</span>\"\n }\n return html\n}\n\nfunction getCache(hash, callback) {\n try {\n fetch(cacheHost(), {\n method: 'post',\n body: JSON.stringify({ action: 'get', hash: hash }),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n },\n })\n .then((res) => res.json())\n .then(\n (json) => {\n callback(json)\n },\n (error) => {\n callback({})\n console.error(error)\n }\n )\n } catch (e) {\n console.error(e)\n callback({})\n }\n}\n/*\n{\n\t\"Hash\": \"41e36c8de915d80db83fc134bee4e7e2d292657e\",\n\t\"Capacity\": 209715200,\n\t\"Filled\": 2914808,\n\t\"PiecesLength\": 4194304,\n\t\"PiecesCount\": 2065,\n\t\"DownloadSpeed\": 32770.860273455524,\n\t\"Pieces\": {\n\t\t\"2064\": {\n\t\t\t\"Id\": 2064,\n\t\t\t\"Length\": 2914808,\n\t\t\t\"Size\": 162296,\n\t\t\t\"Completed\": false\n\t\t}\n\t}\n}\n */\n","/home/yourok/MEGAWork/go/TorrServer/web/src/components/DialogTorrentInfo.js",["136","137","138","139","140"],"import React, { useEffect } from 'react'\nimport Typography from '@material-ui/core/Typography'\nimport { Button, ButtonGroup, Grid, List, ListItem } from '@material-ui/core'\nimport CachedIcon from '@material-ui/icons/Cached'\nimport LinearProgress from '@material-ui/core/LinearProgress';\n\nimport { getPeerString, humanizeSize } from '../utils/Utils'\nimport { playlistTorrHost, streamHost, viewedHost } from '../utils/Hosts'\nimport DialogTitle from '@material-ui/core/DialogTitle'\nimport DialogContent from '@material-ui/core/DialogContent'\n\nconst style = {\n width100: {\n width: '100%',\n },\n width80: {\n width: '80%',\n },\n poster: {\n display: 'flex',\n flexDirection: 'row',\n borderRadius: '5px',\n },\n}\n\nexport default function DialogTorrentInfo(props) {\n const [torrent, setTorrent] = React.useState(props.torrent)\n const [viewed, setViewed] = React.useState(null)\n const [progress, setProgress] = React.useState(-1)\n\n useEffect(() => {\n setTorrent(props.torrent)\n if(torrent.stat==2)\n setProgress(torrent.preloaded_bytes * 100 / torrent.preload_size)\n getViewed(props.torrent.hash,(list) => {\n if (list) {\n let lst = list.map((itm) => itm.file_index)\n setViewed(lst)\n }else\n setViewed(null)\n })\n }, [props.torrent, props.open])\n\n return (\n <div>\n <DialogTitle id=\"form-dialog-title\">\n <Grid container spacing={1}>\n <Grid item>{torrent.poster && <img alt=\"\" height=\"200\" align=\"left\" style={style.poster} src={torrent.poster} />}</Grid>\n <Grid style={style.width80} item>\n {torrent.title} {torrent.name && torrent.name !== torrent.title && ' | ' + torrent.name}\n <Typography>\n <b>Peers: </b> {getPeerString(torrent)}\n <br />\n <b>Loaded: </b> {getPreload(torrent)}\n <br />\n <b>Speed: </b> {humanizeSize(torrent.download_speed)}\n <br />\n <b>Status: </b> {torrent.stat_string}\n <br />\n </Typography>\n </Grid>\n </Grid>\n {torrent.stat==2 && <LinearProgress style={{marginTop:'10px'}} variant=\"determinate\" value={progress} />}\n </DialogTitle>\n <DialogContent>\n <List>\n <ListItem>\n <ButtonGroup style={style.width100} variant=\"contained\" color=\"primary\" aria-label=\"contained primary button group\">\n <Button style={style.width100} href={playlistTorrHost() + '/' + encodeURIComponent(torrent.name || torrent.title || 'file') + '.m3u?link=' + torrent.hash + '&m3u'}>\n Playlist\n </Button>\n <Button style={style.width100} href={playlistTorrHost() + '/' + encodeURIComponent(torrent.name || torrent.title || 'file') + '.m3u?link=' + torrent.hash + '&m3u&fromlast'}>\n Playlist after last view\n </Button>\n <Button style={style.width100} onClick={()=>{\n remViews(torrent.hash)\n setViewed(null)\n }} >\n Remove views\n </Button>\n </ButtonGroup>\n </ListItem>\n {getPlayableFile(torrent) &&\n getPlayableFile(torrent).map((file) => (\n <ButtonGroup style={style.width100} disableElevation variant=\"contained\" color=\"primary\">\n <Button\n style={style.width100}\n href={streamHost() + '/' + encodeURIComponent(file.path.split('\\\\').pop().split('/').pop()) + '?link=' + torrent.hash + '&index=' + file.id + '&play'}\n >\n <Typography>\n {file.path.split('\\\\').pop().split('/').pop()} | {humanizeSize(file.length)} {viewed && viewed.indexOf(file.id)!=-1 && \"| ✓\"}\n </Typography>\n </Button>\n <Button onClick={() => fetch(streamHost() + '?link=' + torrent.hash + '&index=' + file.id + '&preload')}>\n <CachedIcon />\n <Typography>Preload</Typography>\n </Button>\n </ButtonGroup>\n ))}\n </List>\n </DialogContent>\n </div>\n )\n}\n\nfunction remViews(hash){\n try {\n if (hash)\n fetch(viewedHost(), {\n method: 'post',\n body: JSON.stringify({ action: 'rem', hash: hash, file_index:-1 }),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n },\n })\n } catch (e) {\n console.error(e)\n }\n}\n\nfunction getViewed(hash, callback) {\n try {\n fetch(viewedHost(), {\n method: 'post',\n body: JSON.stringify({ action: 'list', hash: hash }),\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n },\n })\n .then((res) => res.json())\n .then(\n (json) => {\n callback(json)\n },\n (error) => {\n callback(null)\n }\n )\n } catch (e) {\n console.error(e)\n }\n}\n\nfunction getPlayableFile(torrent){\n if (!torrent || !torrent.file_stats)\n return null\n return torrent.file_stats.filter(file => extPlayable.includes(getExt(file.path)))\n}\n\nfunction getExt(filename){\n const ext = filename.split('.').pop()\n if (ext == filename)\n return ''\n return ext.toLowerCase()\n}\n\nfunction getPreload(torrent) {\n if (torrent.preloaded_bytes > 0 && torrent.preload_size > 0 && torrent.preloaded_bytes < torrent.preload_size) {\n let progress = ((torrent.preloaded_bytes * 100) / torrent.preload_size).toFixed(2)\n return humanizeSize(torrent.preloaded_bytes) + ' / ' + humanizeSize(torrent.preload_size) + ' ' + progress + '%'\n }\n\n if (!torrent.preloaded_bytes) return humanizeSize(0)\n\n return humanizeSize(torrent.preloaded_bytes)\n}\n\nconst extPlayable = [\n// video\n \"3g2\",\n \"3gp\",\n \"aaf\",\n \"asf\",\n \"avchd\",\n \"avi\",\n \"drc\",\n \"flv\",\n \"iso\",\n \"m2v\",\n \"m2ts\",\n \"m4p\",\n \"m4v\",\n \"mkv\",\n \"mng\",\n \"mov\",\n \"mp2\",\n \"mp4\",\n \"mpe\",\n \"mpeg\",\n \"mpg\",\n \"mpv\",\n \"mxf\",\n \"nsv\",\n \"ogg\",\n \"ogv\",\n \"ts\",\n \"qt\",\n \"rm\",\n \"rmvb\",\n \"roq\",\n \"svi\",\n \"vob\",\n \"webm\",\n \"wmv\",\n \"yuv\",\n// audio\n \"aac\",\n \"aiff\",\n \"ape\",\n \"au\",\n \"flac\",\n \"gsm\",\n \"it\",\n \"m3u\",\n \"m4a\",\n \"mid\",\n \"mod\",\n \"mp3\",\n \"mpa\",\n \"pls\",\n \"ra\",\n \"s3m\",\n \"sid\",\n \"wav\",\n \"wma\",\n \"xm\"\n]\n","/home/yourok/MEGAWork/go/TorrServer/web/src/utils/Utils.js",[],["141","142"],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/index.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/App.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Appbar.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Add.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/RemoveAll.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/TorrentList.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Settings.js",["143"],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/About.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Donate.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Upload.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/utils/Hosts.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/Torrent.js",[],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/DialogCacheInfo.js",["144","145","146","147","148"],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/components/DialogTorrentInfo.js",["149","150","151","152","153"],"/home/yourok/MEGAWork/go/TorrServer_NE/web/src/utils/Utils.js",[],{"ruleId":"154","replacedBy":"155"},{"ruleId":"156","replacedBy":"157"},{"ruleId":"158","severity":1,"message":"159","line":105,"column":29,"nodeType":"160","endLine":105,"endColumn":35},{"ruleId":"161","severity":1,"message":"162","line":9,"column":7,"nodeType":"163","messageId":"164","endLine":9,"endColumn":12},{"ruleId":"165","severity":1,"message":"166","line":83,"column":39,"nodeType":"167","messageId":"168","endLine":89,"endColumn":18},{"ruleId":"169","severity":1,"message":"170","line":99,"column":7,"nodeType":"171","endLine":99,"endColumn":21,"suggestions":"172"},{"ruleId":"161","severity":1,"message":"173","line":135,"column":10,"nodeType":"163","messageId":"164","endLine":135,"endColumn":21},{"ruleId":"165","severity":1,"message":"174","line":154,"column":31,"nodeType":"167","messageId":"168","endLine":161,"endColumn":10},{"ruleId":"175","severity":1,"message":"176","line":33,"column":24,"nodeType":"177","messageId":"178","endLine":33,"endColumn":26},{"ruleId":"169","severity":1,"message":"179","line":42,"column":8,"nodeType":"171","endLine":42,"endColumn":35,"suggestions":"180"},{"ruleId":"175","severity":1,"message":"176","line":63,"column":30,"nodeType":"177","messageId":"178","endLine":63,"endColumn":32},{"ruleId":"175","severity":1,"message":"181","line":91,"column":152,"nodeType":"177","messageId":"178","endLine":91,"endColumn":154},{"ruleId":"175","severity":1,"message":"176","line":154,"column":13,"nodeType":"177","messageId":"178","endLine":154,"endColumn":15},{"ruleId":"154","replacedBy":"182"},{"ruleId":"156","replacedBy":"183"},{"ruleId":"158","severity":1,"message":"159","line":105,"column":29,"nodeType":"160","endLine":105,"endColumn":35},{"ruleId":"161","severity":1,"message":"162","line":9,"column":7,"nodeType":"163","messageId":"164","endLine":9,"endColumn":12},{"ruleId":"165","severity":1,"message":"166","line":83,"column":39,"nodeType":"167","messageId":"168","endLine":89,"endColumn":18},{"ruleId":"169","severity":1,"message":"170","line":99,"column":7,"nodeType":"171","endLine":99,"endColumn":21,"suggestions":"184"},{"ruleId":"161","severity":1,"message":"173","line":135,"column":10,"nodeType":"163","messageId":"164","endLine":135,"endColumn":21},{"ruleId":"165","severity":1,"message":"174","line":154,"column":31,"nodeType":"167","messageId":"168","endLine":161,"endColumn":10},{"ruleId":"175","severity":1,"message":"176","line":33,"column":24,"nodeType":"177","messageId":"178","endLine":33,"endColumn":26},{"ruleId":"169","severity":1,"message":"179","line":42,"column":8,"nodeType":"171","endLine":42,"endColumn":35,"suggestions":"185"},{"ruleId":"175","severity":1,"message":"176","line":63,"column":30,"nodeType":"177","messageId":"178","endLine":63,"endColumn":32},{"ruleId":"175","severity":1,"message":"181","line":91,"column":152,"nodeType":"177","messageId":"178","endLine":91,"endColumn":154},{"ruleId":"175","severity":1,"message":"176","line":154,"column":13,"nodeType":"177","messageId":"178","endLine":154,"endColumn":15},"no-native-reassign",["186"],"no-negated-in-lhs",["187"],"jsx-a11y/heading-has-content","Headings must have content and the content must be accessible by a screen reader.","JSXOpeningElement","no-unused-vars","'style' is assigned a value but never used.","Identifier","unusedVar","no-loop-func","Function declared in a loop contains unsafe references to variable(s) 'cls', 'cls'.","ArrowFunctionExpression","unsafeRefs","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'cache'. Either include it or remove the dependency array.","ArrayExpression",["188"],"'getCacheMap' is defined but never used.","Function declared in a loop contains unsafe references to variable(s) 'html', 'html'.","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","React Hook useEffect has missing dependencies: 'torrent.preload_size', 'torrent.preloaded_bytes', and 'torrent.stat'. Either include them or remove the dependency array. You can also replace multiple useState variables with useReducer if 'setProgress' needs the current value of 'torrent.preloaded_bytes'.",["189"],"Expected '!==' and instead saw '!='.",["186"],["187"],["190"],["191"],"no-global-assign","no-unsafe-negation",{"desc":"192","fix":"193"},{"desc":"194","fix":"195"},{"desc":"192","fix":"196"},{"desc":"194","fix":"197"},"Update the dependencies array to be: [cache, cache.Pieces]",{"range":"198","text":"199"},"Update the dependencies array to be: [props.torrent, props.open, torrent.stat, torrent.preloaded_bytes, torrent.preload_size]",{"range":"200","text":"201"},{"range":"202","text":"199"},{"range":"203","text":"201"},[2893,2907],"[cache, cache.Pieces]",[1372,1399],"[props.torrent, props.open, torrent.stat, torrent.preloaded_bytes, torrent.preload_size]",[2893,2907],[1372,1399]]