add remove views

This commit is contained in:
YouROK
2021-03-12 10:29:03 +03:00
parent e03206fee0
commit bd2fc49734
3 changed files with 24 additions and 2 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -72,6 +72,12 @@ export default function DialogTorrentInfo(props) {
<Button style={style.width100} href={playlistTorrHost() + '/' + encodeURIComponent(torrent.name || torrent.title || 'file') + '.m3u?link=' + torrent.hash + '&m3u&fromlast'}>
Playlist after last view
</Button>
<Button style={style.width100} onClick={()=>{
remViews(torrent.hash)
setViewed(null)
}} >
Remove views
</Button>
</ButtonGroup>
</ListItem>
{getPlayableFile(torrent) &&
@@ -97,6 +103,22 @@ export default function DialogTorrentInfo(props) {
)
}
function remViews(hash){
try {
if (hash)
fetch(viewedHost(), {
method: 'post',
body: JSON.stringify({ action: 'rem', hash: hash, file_index:-1 }),
headers: {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
},
})
} catch (e) {
console.error(e)
}
}
function getViewed(hash, callback) {
try {
fetch(viewedHost(), {