diff --git a/src/config.json b/src/config.json index 1537223b..646ed8e3 100644 --- a/src/config.json +++ b/src/config.json @@ -69,5 +69,6 @@ "copy": ["-c:a", "copy"], "audio": ["-ar", "48000", "-ac", "2", "-b:a", "320k"], "m4a": ["-movflags", "frag_keyframe+empty_moov"] - } + }, + "otherServers": ["default", "https://co.wuk.sh", "https://api.c0ba.lt", "https://co-api.blueb.me", "https://wukko.wolfdo.gg", "https://api.co.749.city", "https://cobalt-api.fluffy.tools", "https://capi.oak.li"] } diff --git a/src/front/cobalt.css b/src/front/cobalt.css index 3388456f..e9e11d39 100644 --- a/src/front/cobalt.css +++ b/src/front/cobalt.css @@ -681,6 +681,9 @@ button:active, .popup-tab-content[data-enabled="false"] { display: none; } +.popup-tab-content { + overflow-x: hidden!important; +} #popup-tabs { z-index: 999; bottom: 0; @@ -1147,4 +1150,22 @@ button:active, .popup-title { line-height: inherit; } +} + +.switches-vertical { + display: flex; + width: auto; + flex-direction: column; + flex-wrap: nowrap; + overflow-x: hidden!important; +} +.switch-vertical.first { + border-top-left-radius: 5px 6px!important; + border-top-right-radius: 5px 6px!important; + border-bottom-left-radius: 0px; +} +.switch-vertical.last { + border-bottom-left-radius: 5px 6px!important; + border-bottom-right-radius: 5px 6px!important; + border-top-right-radius: 0px; } \ No newline at end of file diff --git a/src/front/cobalt.js b/src/front/cobalt.js index 99301f46..aa4485ce 100644 --- a/src/front/cobalt.js +++ b/src/front/cobalt.js @@ -16,7 +16,8 @@ const switchers = { "aFormat": ["mp3", "best", "ogg", "wav", "opus"], "dubLang": ["original", "auto"], "vimeoDash": ["false", "true"], - "audioMode": ["false", "true"] + "audioMode": ["false", "true"], + "serverPicker": [getDefaultAPI(), "https://co.wuk.sh", "https://api.c0ba.lt", "https://wukko.wolfdo.gg", "https://api.co.749.city", "https://cobalt-api.fluffy.tools", "https://capi.oak.li"] }; const checkboxes = [ "disableTikTokWatermark", @@ -37,6 +38,9 @@ function changeAPI(url) { apiURL = url; return true } +function getDefaultAPI() { + return defaultApiURL; +} function eid(id) { return document.getElementById(id) } @@ -260,7 +264,14 @@ function popup(type, action, text) { eid(`popup-${type}`).focus(); } function changeSwitcher(li, b) { - if (b) { + if (switchers.serverPicker.includes(b)) { + if (!switchers[li].includes(b)) b = switchers[li][0]; + changeAPI(b); + sSet(li, b); + for (let i in switchers[li]) { + (switchers[li][i] === b) ? enable(`${li}-${b}`) : disable(`${li}-${switchers[li][i]}`) + } + } else if (b) { if (!switchers[li].includes(b)) b = switchers[li][0]; sSet(li, b); for (let i in switchers[li]) { diff --git a/src/localization/languages/en.json b/src/localization/languages/en.json index 3be93dbc..48123c0a 100644 --- a/src/localization/languages/en.json +++ b/src/localization/languages/en.json @@ -40,6 +40,9 @@ "SettingsThemeAuto": "auto", "SettingsThemeLight": "light", "SettingsThemeDark": "dark", + "SettingsServerPicker": "server picker", + "SettingsServerPickerDefault": "default", + "SettingsServerPickerDescription": "choose which server to download from, default is ", "SettingsKeepDownloadButton": "keep >> visible", "AccessibilityKeepDownloadButton": "keep the download button always visible", "SettingsEnableDownloadPopup": "ask how to save", diff --git a/src/modules/config.js b/src/modules/config.js index 5268b8dd..0f068213 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -15,5 +15,6 @@ export const donations = config.donations, ffmpegArgs = config.ffmpegArgs, supportedAudio = config.supportedAudio, + otherServers = config.otherServers, celebrations = config.celebrations, links = config.links diff --git a/src/modules/pageRender/elements.js b/src/modules/pageRender/elements.js index a1940d5c..cd8c3c13 100644 --- a/src/modules/pageRender/elements.js +++ b/src/modules/pageRender/elements.js @@ -13,6 +13,13 @@ export function switcher(obj) { let items = ``; if (obj.name === "download") { items = obj.items; + } else if (obj.vertical) { + for (let i = 0; i < obj.items.length; i++) { + let classes = obj.items[i]["classes"] ? obj.items[i]["classes"] : []; + if (i === 0) classes.push("first"); + if (i === (obj.items.length - 1)) classes.push("last"); + items += `` + } } else { for (let i = 0; i < obj.items.length; i++) { let classes = obj.items[i]["classes"] ? obj.items[i]["classes"] : []; @@ -22,12 +29,25 @@ export function switcher(obj) { } } - if (obj.noParent) return `