Files
TorrServerJellyfin/web/.eslintcache
2021-04-22 13:11:35 +03:00

1 line
24 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"},{"size":224,"mtime":1607328766846,"results":"16","hashOfConfig":"17"},{"size":840,"mtime":1607329513826,"results":"18","hashOfConfig":"17"},{"size":6552,"mtime":1614236662454,"results":"19","hashOfConfig":"17"},{"size":1416,"mtime":1607335705443,"results":"20","hashOfConfig":"17"},{"size":1568,"mtime":1607340137621,"results":"21","hashOfConfig":"17"},{"size":3345,"mtime":1607335694784,"results":"22","hashOfConfig":"17"},{"size":1348,"mtime":1607335733737,"results":"23","hashOfConfig":"17"},{"size":2278,"mtime":1608810011199,"results":"24","hashOfConfig":"17"},{"size":3634,"mtime":1615288639227,"results":"25","hashOfConfig":"17"},{"size":796,"mtime":1614236974272,"results":"26","hashOfConfig":"17"},{"size":8518,"mtime":1613802993837,"results":"27","hashOfConfig":"17"},{"size":5999,"mtime":1615533039159,"results":"28","hashOfConfig":"17"},{"size":6538,"mtime":1619086011439,"results":"29","hashOfConfig":"17"},{"size":7486,"mtime":1617970930041,"results":"30","hashOfConfig":"17"},{"size":419,"mtime":1614236662474,"results":"31","hashOfConfig":"17"},{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},"17eruzz",{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"43","messages":"44","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"47","messages":"48","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"49","messages":"50","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"51","messages":"52","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"53","messages":"54","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"55","usedDeprecatedRules":"34"},{"filePath":"56","messages":"57","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"58","messages":"59","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"60","messages":"61","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":"62","usedDeprecatedRules":"34"},{"filePath":"63","messages":"64","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},"/home/yourok/MEGAWork/go/TorrServer/web/src/index.js",[],["65","66"],"/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",["67"],"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 }\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 </>\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",["68","69","70","71","72"],"/home/yourok/MEGAWork/go/TorrServer/web/src/components/DialogTorrentInfo.js",["73","74","75","76","77"],"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",[],{"ruleId":"78","replacedBy":"79"},{"ruleId":"80","replacedBy":"81"},{"ruleId":"82","severity":1,"message":"83","line":103,"column":29,"nodeType":"84","endLine":103,"endColumn":35},{"ruleId":"85","severity":1,"message":"86","line":9,"column":7,"nodeType":"87","messageId":"88","endLine":9,"endColumn":12},{"ruleId":"89","severity":1,"message":"90","line":83,"column":39,"nodeType":"91","messageId":"92","endLine":89,"endColumn":18},{"ruleId":"93","severity":1,"message":"94","line":99,"column":7,"nodeType":"95","endLine":99,"endColumn":21,"suggestions":"96"},{"ruleId":"85","severity":1,"message":"97","line":133,"column":10,"nodeType":"87","messageId":"88","endLine":133,"endColumn":21},{"ruleId":"89","severity":1,"message":"98","line":152,"column":31,"nodeType":"91","messageId":"92","endLine":159,"endColumn":10},{"ruleId":"99","severity":1,"message":"100","line":33,"column":24,"nodeType":"101","messageId":"102","endLine":33,"endColumn":26},{"ruleId":"93","severity":1,"message":"103","line":42,"column":8,"nodeType":"95","endLine":42,"endColumn":35,"suggestions":"104"},{"ruleId":"99","severity":1,"message":"100","line":63,"column":30,"nodeType":"101","messageId":"102","endLine":63,"endColumn":32},{"ruleId":"99","severity":1,"message":"105","line":91,"column":152,"nodeType":"101","messageId":"102","endLine":91,"endColumn":154},{"ruleId":"99","severity":1,"message":"100","line":154,"column":13,"nodeType":"101","messageId":"102","endLine":154,"endColumn":15},"no-native-reassign",["106"],"no-negated-in-lhs",["107"],"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",["108"],"'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'.",["109"],"Expected '!==' and instead saw '!='.","no-global-assign","no-unsafe-negation",{"desc":"110","fix":"111"},{"desc":"112","fix":"113"},"Update the dependencies array to be: [cache, cache.Pieces]",{"range":"114","text":"115"},"Update the dependencies array to be: [props.torrent, props.open, torrent.stat, torrent.preloaded_bytes, torrent.preload_size]",{"range":"116","text":"117"},[2893,2907],"[cache, cache.Pieces]",[1371,1398],"[props.torrent, props.open, torrent.stat, torrent.preloaded_bytes, torrent.preload_size]"]