提交详情
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2025-09-25 23:05:09 +08:00
parent 25117b454d
commit d7bc25d086
8 changed files with 197 additions and 85 deletions

View File

@@ -1,6 +1,7 @@
import { getTime, intervalToDuration, parseISO, type Duration } from "date-fns"
import { User } from "./types"
import { USER_TYPE } from "./constants"
import { strFromU8, strToU8, unzlibSync, zlibSync } from "fflate"
function calculateACRate(acCount: number, totalCount: number): string {
if (totalCount === 0) return "0.00"
@@ -184,6 +185,20 @@ export function getCSRFToken(): string {
return match ? decodeURIComponent(match[1]) : ""
}
export function utoa(data: string): string {
const buffer = strToU8(data)
const zipped = zlibSync(buffer, { level: 9 })
const binary = strFromU8(zipped, true)
return btoa(binary)
}
export function atou(base64: string): string {
const binary = atob(base64)
const buffer = strToU8(binary, true)
const unzipped = unzlibSync(buffer)
return strFromU8(unzipped)
}
// function getChromeVersion() {
// var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)
// return raw ? parseInt(raw[2], 10) : 0

View File

@@ -120,9 +120,9 @@ export interface Problem {
total_score: number
submission_number: number
accepted_number: number
statistic_info: { [key in string]: number }
statistic_info: { time_cost: number; memory_cost: number }
share_submission: boolean
contest: null
contest: number
my_status: number
visible: boolean
}
@@ -220,11 +220,27 @@ export interface Submission {
memory_cost?: number
}
ip: string
contest: null
problem: string
contest: number
problem: number // 不是 display_id
can_unshare: boolean
}
export interface SubmissionListItem {
id: string
problem: string
show_link: boolean
create_time: string
user_id: number
username: string
result: SUBMISSION_RESULT
language: LANGUAGE
shared: boolean
statistic_info: {
time_cost: number
memory_cost: number
}
}
export interface SubmissionListPayload {
myself?: "1" | "0"
result?: string