Frontend: proxy checkbox
This commit is contained in:
parent
9071017dbf
commit
312a688c89
2 changed files with 9 additions and 4 deletions
|
@ -15,11 +15,13 @@
|
|||
<div>
|
||||
<select id="site-select">
|
||||
<option value="youtube" selected>YouTube</option>
|
||||
<option value="yt_proxied">YT proxied</option>
|
||||
<option value="soundcloud">SoundCloud</option>
|
||||
<option value="yandex">Yandex Music</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="proxy-cb"><input type="checkbox" id="proxy-cb">Proxy</label>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" id="items-btn">Get playlist items</button>
|
||||
</div>
|
||||
|
|
|
@ -3,14 +3,15 @@ addEventListener('DOMContentLoaded', () => {
|
|||
const urlField = document.getElementById('url')
|
||||
/** @type{HTMLSelectElement} */
|
||||
const site = document.getElementById('site-select')
|
||||
/** @type{HTMLInputElement} */
|
||||
const proxyFlag = document.getElementById('proxy-cb')
|
||||
|
||||
document.getElementById('guess-site-btn').addEventListener('click', () => {
|
||||
const url = urlField.value
|
||||
if (url.includes('/watch?v=') || url.includes('/playlist?list=')) {
|
||||
if (site.value == 'yt_proxied') {
|
||||
return
|
||||
}
|
||||
site.value = 'youtube'
|
||||
} else if (url.includes('soundcloud.com/')) {
|
||||
site.value = 'soundcloud'
|
||||
} else if (url.includes('://music.yandex.')) {
|
||||
site.value = 'yandex'
|
||||
}
|
||||
|
@ -28,6 +29,7 @@ addEventListener('DOMContentLoaded', () => {
|
|||
action: 'list',
|
||||
site: site.value,
|
||||
url: urlField.value,
|
||||
proxy: proxyFlag.checked,
|
||||
}))
|
||||
logField.textContent = '' // clear
|
||||
})
|
||||
|
@ -37,6 +39,7 @@ addEventListener('DOMContentLoaded', () => {
|
|||
action: 'download',
|
||||
site: site.value,
|
||||
url: urlField.value,
|
||||
proxy: proxyFlag.checked,
|
||||
items: items,
|
||||
}))
|
||||
items = []
|
||||
|
|
Loading…
Reference in a new issue