mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-18 06:09:58 +00:00
api: url-encode UTF-8 characters in url
this encode-decode construct is ugly, but necessary to retain backwards compatibility for weirdos that encode the URL when passing it in via json ( like the frontend, for example. :/ )
This commit is contained in:
parent
60743cdcdf
commit
190a0131d4
2 changed files with 2 additions and 2 deletions
|
@ -10,7 +10,7 @@ import hostOverrides from "./processing/hostOverrides.js";
|
||||||
|
|
||||||
export async function getJSON(originalURL, lang, obj) {
|
export async function getJSON(originalURL, lang, obj) {
|
||||||
try {
|
try {
|
||||||
let patternMatch, url = decodeURIComponent(originalURL),
|
let patternMatch, url = encodeURI(decodeURIComponent(originalURL)),
|
||||||
hostname = new URL(url).hostname.split('.'),
|
hostname = new URL(url).hostname.split('.'),
|
||||||
host = hostname[hostname.length - 2];
|
host = hostname[hostname.length - 2];
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ const apiVar = {
|
||||||
},
|
},
|
||||||
booleanOnly: ["isAudioOnly", "isNoTTWatermark", "isTTFullAudio", "isAudioMuted", "dubLang", "vimeoDash", "disableMetadata"]
|
booleanOnly: ["isAudioOnly", "isNoTTWatermark", "isTTFullAudio", "isAudioMuted", "dubLang", "vimeoDash", "disableMetadata"]
|
||||||
}
|
}
|
||||||
const forbiddenChars = ['}', '{', '(', ')', '\\', '%', '>', '<', '^', '*', '!', '~', ';', ':', ',', '`', '[', ']', '#', '$', '"', "'", "@", '=='];
|
const forbiddenChars = ['}', '{', '(', ')', '\\', '>', '<', '^', '*', '!', '~', ';', ':', ',', '`', '[', ']', '#', '$', '"', "'", "@", '=='];
|
||||||
const forbiddenCharsString = ['}', '{', '%', '>', '<', '^', ';', '`', '$', '"', "@", '='];
|
const forbiddenCharsString = ['}', '{', '%', '>', '<', '^', ';', '`', '$', '"', "@", '='];
|
||||||
|
|
||||||
export function apiJSON(type, obj) {
|
export function apiJSON(type, obj) {
|
||||||
|
|
Loading…
Reference in a new issue