mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge branch 'master' into 230-torrents-category
This commit is contained in:
@@ -85,13 +85,16 @@ export default function AboutDialog() {
|
||||
<LinkComponent name='tw1cker' link='https://github.com/Nemiroff' />
|
||||
<LinkComponent name='SpAwN_LMG' link='https://github.com/spawnlmg' />
|
||||
<LinkComponent name='damiva' link='https://github.com/damiva' />
|
||||
<LinkComponent name='Vladlenas' link='https://github.com/vladlenas' />
|
||||
<LinkComponent name='Anton Potekhin' link='https://github.com/Anton111111' />
|
||||
<LinkComponent name='FaintGhost' link='https://github.com/FaintGhost' />
|
||||
<LinkComponent name='TopperBG' link='https://github.com/TopperBG' />
|
||||
<LinkComponent name='FaintGhost' link='https://github.com/FaintGhost' />
|
||||
<LinkComponent name='lieranderl' link='https://github.com/lieranderl' />
|
||||
<LinkComponent name='Evgeni' link='https://github.com/lieranderl' />
|
||||
<LinkComponent name='cocool97' link='https://github.com/cocool97' />
|
||||
<LinkComponent name='shadeov' link='https://github.com/shadeov' />
|
||||
<LinkComponent name='Pavel' link='https://github.com/butaford' />
|
||||
<LinkComponent name='Alexey Filimonov' link='https://github.com/filimonic' />
|
||||
<LinkComponent name='Viacheslav Evseev' link='https://github.com/leporel' />
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,11 @@ export default function LeftSideComponent({
|
||||
}
|
||||
|
||||
const [isTorrentSourceActive, setIsTorrentSourceActive] = useState(false)
|
||||
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop: handleCapture, accept: '.torrent' })
|
||||
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
||||
onDrop: handleCapture,
|
||||
accept: '.torrent',
|
||||
multiple: false,
|
||||
})
|
||||
|
||||
const handleTorrentSourceChange = ({ target: { value } }) => setTorrentSource(value)
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { useState } from 'react'
|
||||
import { Button, DialogActions, DialogTitle, ListItemIcon, ListItemText } from '@material-ui/core'
|
||||
import { StyledDialog, StyledMenuButtonWrapper } from 'style/CustomMaterialUiStyles'
|
||||
import { PowerSettingsNew as PowerSettingsNewIcon } from '@material-ui/icons'
|
||||
import { PowerSettingsNew as PowerSettingsNewIcon, PowerOff as PowerOffIcon } from '@material-ui/icons'
|
||||
import { shutdownHost } from 'utils/Hosts'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { isStandaloneApp } from 'utils/Utils'
|
||||
import useOnStandaloneAppOutsideClick from 'utils/useOnStandaloneAppOutsideClick'
|
||||
|
||||
import UnsafeButton from './UnsafeButton'
|
||||
|
||||
export default function CloseServer({ isOffline, isLoading }) {
|
||||
const { t } = useTranslation()
|
||||
const [open, setOpen] = useState(false)
|
||||
@@ -41,7 +43,9 @@ export default function CloseServer({ isOffline, isLoading }) {
|
||||
{t('Cancel')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
<UnsafeButton
|
||||
timeout={5}
|
||||
startIcon={<PowerOffIcon />}
|
||||
variant='contained'
|
||||
onClick={() => {
|
||||
fetch(shutdownHost())
|
||||
@@ -51,7 +55,7 @@ export default function CloseServer({ isOffline, isLoading }) {
|
||||
autoFocus
|
||||
>
|
||||
{t('TurnOff')}
|
||||
</Button>
|
||||
</UnsafeButton>
|
||||
</DialogActions>
|
||||
</StyledDialog>
|
||||
</>
|
||||
|
||||
@@ -12,6 +12,7 @@ const playableExtList = [
|
||||
'avchd',
|
||||
'avi',
|
||||
'drc',
|
||||
'dv',
|
||||
'flv',
|
||||
'iso',
|
||||
'm2v',
|
||||
@@ -27,9 +28,9 @@ const playableExtList = [
|
||||
'mpeg',
|
||||
'mpg',
|
||||
'mpv',
|
||||
'mts',
|
||||
'mxf',
|
||||
'nsv',
|
||||
'ogg',
|
||||
'ogv',
|
||||
'ts',
|
||||
'qt',
|
||||
@@ -46,6 +47,9 @@ const playableExtList = [
|
||||
'aiff',
|
||||
'ape',
|
||||
'au',
|
||||
'dsd',
|
||||
'dff',
|
||||
'dsf',
|
||||
'flac',
|
||||
'gsm',
|
||||
'it',
|
||||
@@ -55,11 +59,15 @@ const playableExtList = [
|
||||
'mod',
|
||||
'mp3',
|
||||
'mpa',
|
||||
'oga',
|
||||
'ogg',
|
||||
'opus',
|
||||
'pls',
|
||||
'ra',
|
||||
's3m',
|
||||
'sid',
|
||||
'wav',
|
||||
'weba',
|
||||
'wma',
|
||||
'xm',
|
||||
]
|
||||
|
||||
@@ -52,7 +52,7 @@ export const PeersWidget = ({ data }) => {
|
||||
return (
|
||||
<StatisticsField
|
||||
title={t('Peers')}
|
||||
value={getPeerString(data) || '0 · 0 / 0'}
|
||||
value={getPeerString(data) || '0 / 0 · 0'}
|
||||
iconBg={iconBGColor}
|
||||
valueBg={valueBGColor}
|
||||
icon={SwapVerticalCircleIcon}
|
||||
|
||||
@@ -7,28 +7,17 @@ import { useState } from 'react'
|
||||
import { torrentsHost } from 'utils/Hosts'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import UnsafeButton from './UnsafeButton'
|
||||
|
||||
const fnRemoveAll = () => {
|
||||
fetch(torrentsHost(), {
|
||||
method: 'post',
|
||||
body: JSON.stringify({ action: 'list' }),
|
||||
body: JSON.stringify({ action: 'wipe' }),
|
||||
headers: {
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
json.forEach(torr => {
|
||||
fetch(torrentsHost(), {
|
||||
method: 'post',
|
||||
body: JSON.stringify({ action: 'rem', hash: torr.hash }),
|
||||
headers: {
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default function RemoveAll({ isOffline, isLoading }) {
|
||||
@@ -54,7 +43,9 @@ export default function RemoveAll({ isOffline, isLoading }) {
|
||||
{t('Cancel')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
<UnsafeButton
|
||||
timeout={5}
|
||||
startIcon={<DeleteIcon />}
|
||||
variant='contained'
|
||||
onClick={() => {
|
||||
fnRemoveAll()
|
||||
@@ -64,7 +55,7 @@ export default function RemoveAll({ isOffline, isLoading }) {
|
||||
autoFocus
|
||||
>
|
||||
{t('OK')}
|
||||
</Button>
|
||||
</UnsafeButton>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</>
|
||||
|
||||
@@ -16,10 +16,11 @@ export default function AddFirstTorrent() {
|
||||
<>
|
||||
<IconWrapper onClick={() => handleClickOpen(true)} isButton>
|
||||
<lord-icon
|
||||
src='https://cdn.lordicon.com/bbnkwdur.json'
|
||||
src='https://cdn.lordicon.com/jkzgajyr.json'
|
||||
trigger='loop'
|
||||
colors={`primary:#121331,secondary:${primary}`}
|
||||
stroke='26'
|
||||
delay='2000'
|
||||
colors={`primary:#575757,secondary:${primary}`}
|
||||
stroke='light'
|
||||
scale='60'
|
||||
/>
|
||||
<div className='icon-label'>{t('NoTorrentsAdded')}</div>
|
||||
|
||||
29
web/src/components/UnsafeButton.jsx
Normal file
29
web/src/components/UnsafeButton.jsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Button } from '@material-ui/core'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
export default function UnsafeButton({ timeout, children, disabled, ...props }) {
|
||||
const [timeLeft, setTimeLeft] = useState(timeout || 7)
|
||||
const [buttonDisabled, setButtonDisabled] = useState(disabled || timeLeft > 0)
|
||||
const handleTimerTick = () => {
|
||||
const newTimeLeft = timeLeft - 1
|
||||
setTimeLeft(newTimeLeft)
|
||||
if (newTimeLeft <= 0) {
|
||||
setButtonDisabled(disabled)
|
||||
}
|
||||
}
|
||||
const getTimerText = () => (!disabled && timeLeft > 0 ? ` (${timeLeft})` : '')
|
||||
useEffect(() => {
|
||||
if (disabled || !timeLeft) {
|
||||
return
|
||||
}
|
||||
const intervalId = setInterval(handleTimerTick, 1000)
|
||||
return () => clearInterval(intervalId)
|
||||
// eslint-disable-next-line
|
||||
}, [timeLeft])
|
||||
|
||||
return (
|
||||
<Button disabled={buttonDisabled} {...props}>
|
||||
{children} {getTimerText()}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
@@ -72,7 +72,7 @@
|
||||
"Offline": "Извън линия",
|
||||
"OK": "OK",
|
||||
"OpenLink": "Отвори линк",
|
||||
"Peers": "Пиъри",
|
||||
"Peers": "Пиъри·Сийдъри",
|
||||
"PiecesCount": "Брой парчета",
|
||||
"PiecesLength": "Дължина на парчетата",
|
||||
"Playlist": "Плейлист",
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
"Offline": "Offline",
|
||||
"OK": "OK",
|
||||
"OpenLink": "Open link",
|
||||
"Peers": "Peers",
|
||||
"Peers": "Peers·Seeds",
|
||||
"PiecesCount": "Pieces count",
|
||||
"PiecesLength": "Pieces length",
|
||||
"Playlist": "Playlist",
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
"Offline": "Сервер недоступен",
|
||||
"OK": "OK",
|
||||
"OpenLink": "Открыть",
|
||||
"Peers": "Пиры",
|
||||
"Peers": "Пиры·Сиды",
|
||||
"PiecesCount": "Кол-во блоков",
|
||||
"PiecesLength": "Размер блока",
|
||||
"Playlist": "Плейлист",
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
"Offline": "Сервер не доступний",
|
||||
"OK": "OK",
|
||||
"OpenLink": "Відкрити",
|
||||
"Peers": "Піри",
|
||||
"Peers": "Піри·Сіди",
|
||||
"PiecesCount": "К-сть блоків",
|
||||
"PiecesLength": "Розмір блоку",
|
||||
"Playlist": "Плейлист",
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
"Offline": "离线",
|
||||
"OK": "确定",
|
||||
"OpenLink": "打开链接",
|
||||
"Peers": "Peers",
|
||||
"Peers": "Peers·Seeds",
|
||||
"PiecesCount": "块数量",
|
||||
"PiecesLength": "块长度",
|
||||
"Playlist": "播放列表",
|
||||
|
||||
@@ -20,8 +20,9 @@ export function humanizeSpeed(speed) {
|
||||
}
|
||||
|
||||
export function getPeerString(torrent) {
|
||||
if (!torrent || !torrent.connected_seeders) return null
|
||||
return `${torrent.connected_seeders} · ${torrent.active_peers} / ${torrent.total_peers}`
|
||||
if (!torrent || !torrent.active_peers) return null
|
||||
const seeders = typeof torrent.connected_seeders !== 'undefined' ? torrent.connected_seeders : 0
|
||||
return `${torrent.active_peers} / ${torrent.total_peers} · ${seeders}`
|
||||
}
|
||||
|
||||
export const shortenText = (text, sympolAmount) =>
|
||||
|
||||
Reference in New Issue
Block a user