删除对 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

2612
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -10,29 +10,29 @@
}, },
"dependencies": { "dependencies": {
"@codemirror/lang-cpp": "^6.0.2", "@codemirror/lang-cpp": "^6.0.2",
"@codemirror/lang-python": "^6.1.6", "@codemirror/lang-python": "^6.1.7",
"@vueuse/core": "^11.1.0", "@vueuse/core": "^12.7.0",
"axios": "^1.7.7", "axios": "^1.7.9",
"client-zip": "1.6.4", "client-zip": "1.6.5",
"codemirror": "^6.0.1", "codemirror": "^6.0.1",
"copy-text-to-clipboard": "^3.2.0", "copy-text-to-clipboard": "^3.2.0",
"fflate": "^0.8.2", "fflate": "^0.8.2",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"naive-ui": "^2.40.1", "naive-ui": "^2.41.0",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"query-string": "^9.1.1", "query-string": "^9.1.1",
"vue": "^3.5.12", "vue": "^3.5.13",
"vue-codemirror": "^6.1.1" "vue-codemirror": "^6.1.1"
}, },
"devDependencies": { "devDependencies": {
"@iconify/vue": "^4.1.2", "@iconify/vue": "^4.3.0",
"@rsbuild/core": "^1.0.18", "@rsbuild/core": "^1.2.9",
"@rsbuild/plugin-vue": "^1.0.2", "@rsbuild/plugin-vue": "^1.0.6",
"@types/file-saver": "^2.0.7", "@types/file-saver": "^2.0.7",
"@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue": "^5.2.1",
"prettier": "^3.3.3", "prettier": "^3.5.1",
"prettier-plugin-organize-imports": "^4.1.0", "prettier-plugin-organize-imports": "^4.1.0",
"typescript": "^5.6.3", "typescript": "^5.7.3",
"vite": "^5.4.10" "vite": "^6.1.1"
} }
} }

View File

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