feat: torrent and dht port

feat: import and export settings
fix: exclude ember releases
This commit is contained in:
ThaUnknown 2023-07-18 18:01:14 +02:00
parent 0b92faf27e
commit 985af2a0df
5 changed files with 53 additions and 11 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "4.2.3",
"version": "4.2.4",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"description": "Stream anime torrents, real-time with no waiting for downloads.",
"main": "build/main.js",

View file

@ -11,7 +11,9 @@ class TorrentClient extends WebTorrent {
dht: !settings.torrentDHT,
maxConns: settings.maxConns,
downloadLimit: settings.torrentSpeed * 1048576 || 0,
uploadLimit: settings.torrentSpeed * 1572864 || 0 // :trolled:
uploadLimit: settings.torrentSpeed * 1572864 || 0, // :trolled:
torrentPort: settings.torrentPort || 0,
dhtPort: settings.dhtPort || 0
})
this.settings = settings

View file

@ -21,6 +21,7 @@
--gray-color-light: hsl(var(--gray-color-light-hsl));
--gray-color-light-hsl: var(--gray-color-base-hue), 10%, 28%;
--gray-color-base-hue: 216;
color-scheme: dark;
}
.btn-secondary {

View file

@ -5,7 +5,7 @@ import { add } from '@/modules/torrent.js'
import { resolveFileMedia, getEpisodeMetadataForMedia } from './anime.js'
import { hasNextPage } from '@/modules/sections.js'
export const exclusions = ['DTS']
export const exclusions = ['DTS', '[EMBER]']
const isDev = location.hostname === 'localhost'
const video = document.createElement('video')

View file

@ -14,6 +14,8 @@
torrentPersist: false,
torrentDHT: false,
torrentPeX: false,
torrentPort: 0,
dhtPort: 0,
missingFont: true,
maxConns: 20,
subtitleLanguage: 'eng',
@ -163,6 +165,17 @@
})
}
}
async function importSettings () {
localStorage.setItem('settings', await navigator.clipboard.readText())
location.reload()
}
function exportSettings () {
navigator.clipboard.writeText(localStorage.getItem('settings'))
toast('Copied to clipboard', {
description: 'Copied settings to clipboard',
duration: 5000
})
}
</script>
<Tabs>
@ -183,19 +196,25 @@
<button
use:click={() => window.IPC.emit('open', 'https://github.com/sponsors/ThaUnknown/')}
class='btn btn-primary mx-20 mt-auto'
type='button'
data-toggle='tooltip'
data-placement='top'
data-title='Opens The Donate Site'>
type='button'>
Donate
</button>
<button
use:click={importSettings}
class='btn btn-primary mx-20 mt-10'
type='button'>
Import Settings From Clipboard
</button>
<button
use:click={exportSettings}
class='btn btn-primary mx-20 mt-10'
type='button'>
Export Settings To Clipboard
</button>
<button
use:click={checkUpdate}
class='btn btn-primary mx-20 mt-10'
type='button'
data-toggle='tooltip'
data-placement='top'
data-title='Checks For Available Updates And Notifies The User'>
type='button'>
Check For Updates
</button>
<button
@ -449,6 +468,26 @@
</div>
<input type='number' bind:value={settings.maxConns} min='1' max='512' class='form-control text-right form-control-lg' />
</div>
<div
class='input-group w-300 form-control-lg mb-10'
data-toggle='tooltip'
data-placement='bottom'
data-title='Port Used For DHT Connections. 0 Is Automatic'>
<div class='input-group-prepend'>
<span class='input-group-text w-150 justify-content-center'>DHT Port</span>
</div>
<input type='number' bind:value={settings.dhtPort} min='0' max='65536' class='form-control text-right form-control-lg' />
</div>
<div
class='input-group w-300 form-control-lg mb-10'
data-toggle='tooltip'
data-placement='bottom'
data-title='Port Used For Torrent Connections. 0 Is Automatic'>
<div class='input-group-prepend'>
<span class='input-group-text w-150 justify-content-center'>Torrent Port</span>
</div>
<input type='number' bind:value={settings.torrentPort} min='0' max='65536' class='form-control text-right form-control-lg' />
</div>
<div
class='custom-switch mb-10 pl-10 font-size-16 w-300'
data-toggle='tooltip'