Commit b90127c5 authored by Chunchi Che's avatar Chunchi Che

fix match in Chinese

parent e52bde55
Pipeline #23451 passed with stages
in 17 minutes and 29 seconds
...@@ -12,8 +12,7 @@ export async function match( ...@@ -12,8 +12,7 @@ export async function match(
arena: string = "entertain", arena: string = "entertain",
): Promise<MatchInfo | undefined> { ): Promise<MatchInfo | undefined> {
const headers = { const headers = {
Authorization: Authorization: "Basic " + customBase64Encode(username + ":" + extraId),
"Basic " + btoa(encodeURIComponent(username) + ":" + extraId),
}; };
let response: Response | undefined = undefined; let response: Response | undefined = undefined;
const params = new URLSearchParams({ const params = new URLSearchParams({
...@@ -38,3 +37,9 @@ export async function match( ...@@ -38,3 +37,9 @@ export async function match(
return (await response?.json()) as MatchInfo; return (await response?.json()) as MatchInfo;
} }
function customBase64Encode(input: string): string {
const uint8Array = new TextEncoder().encode(input);
const base64String = btoa(String.fromCharCode(...uint8Array));
return base64String;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment