删除对 chrome 版本的判断

This commit is contained in:
2025-02-19 19:21:20 +08:00
parent 37b30502d1
commit 647041590f
3 changed files with 1409 additions and 1245 deletions

View File

@@ -2,14 +2,14 @@ import axios from "axios"
import { languageToId } from "./templates"
import { Code, Submission } from "./types"
function getChromeVersion() {
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)
return raw ? parseInt(raw[2], 10) : 0
}
// function getChromeVersion() {
// var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)
// return raw ? parseInt(raw[2], 10) : 0
// }
const isLowVersion = getChromeVersion() < 80
// const isLowVersion = getChromeVersion() < 80
const protocol = isLowVersion ? "http" : "https"
// const protocol = isLowVersion ? "http" : "https"
function encode(string?: string) {
return btoa(String.fromCharCode(...new TextEncoder().encode(string ?? "")))
@@ -24,8 +24,8 @@ function decode(bytes?: string) {
)
}
const judge = axios.create({ baseURL: `${protocol}://judge0api.xuyue.cc` })
const api = axios.create({ baseURL: `${protocol}://codeapi.xuyue.cc` })
const judge = axios.create({ baseURL: `https://judge0api.xuyue.cc` })
const api = axios.create({ baseURL: `https://codeapi.xuyue.cc` })
export async function submit(code: Code, input: string) {
const encodedCode = encode(code.value)