move servers into config.json for page.js

This commit is contained in:
blueb 2023-08-22 01:04:27 -04:00
parent e39cbf26a4
commit a1646480fb
4 changed files with 15 additions and 27 deletions

View File

@ -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://wukko.wolfdo.gg", "https://api.co.749.city", "https://cobalt-api.fluffy.tools", "https://capi.oak.li"]
}

View File

@ -1214,4 +1214,3 @@ button:active,
border-bottom-right-radius: 5px 6px!important;
border-top-right-radius: 0px;
}

View File

@ -15,5 +15,6 @@ export const
donations = config.donations,
ffmpegArgs = config.ffmpegArgs,
supportedAudio = config.supportedAudio,
otherServers = config.otherServers,
celebrations = config.celebrations,
links = config.links

View File

@ -1,5 +1,5 @@
import { checkbox, collapsibleList, explanation, footerButtons, multiPagePopup, popup, popupWithBottomButtons, sep, settingsCategory, switcher, socialLink, urgentNotice, keyboardShortcuts } from "./elements.js";
import { services as s, authorInfo, version, repo, donations, supportedAudio } from "../config.js";
import { services as s, authorInfo, version, repo, donations, supportedAudio, otherServers } from "../config.js";
import { getCommitInfo } from "../sub/currentCommit.js";
import loc from "../../localization/manager.js";
import emoji from "../emoji.js";
@ -7,6 +7,8 @@ import changelogManager from "../changelog/changelogManager.js";
let com = getCommitInfo();
let defaultApiURL = process.env.apiURL ? process.env.apiURL.slice(0, -1) : '';
let enabledServices = Object.keys(s).filter((p) => {
if (s[p].enabled) return true;
}).sort().map((p) => {
@ -28,7 +30,13 @@ for (let i in donations["crypto"]) {
extr = ' top-margin'
}
let defaultApiURL = process.env.apiURL ? process.env.apiURL.slice(0, -1) : '';
let servers = otherServers.map((p) => {
if (p === "default") {
return { "action": defaultApiURL, "text": defaultApiURL.replace("https://","") }
} else {
return { "action": p, "text": p.replace("https://","") }
}
})
export default function(obj) {
const t = (str, replace) => { return loc(obj.lang, str, replace) };
@ -461,28 +469,7 @@ export default function(obj) {
name: "serverPicker",
explanation: t(['SettingsServerPickerDescription'])+defaultApiURL.replace("https://","")+".",
vertical: true,
items: [{
action: defaultApiURL,
text: defaultApiURL.replace("https://","")
}, {
action: "https://co.wuk.sh",
text: "co.wuk.sh"
}, {
action: "https://api.c0ba.lt",
text: "api.c0ba.lt"
}, {
action: "https://wukko.wolfdo.gg",
text: "wukko.wolfdo.gg"
}, {
action: "https://api.co.749.city",
text: "api.co.749.city"
}, {
action: "https://cobalt-api.fluffy.tools",
text: "cobalt-api.fluffy.tools"
}, {
action: "https://capi.oak.li",
text: "capi.oak.li"
}]
items: servers
})
})
}],