Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

hash phpsessid #451

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Server/Source/Process.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Result, ThrowErrorIfFailed } from "./Result";
import { Database } from "./Database";
import MD5 from "crypto-js/md5";
import { Output } from "./Output";
import { CaptchaSecretKey } from "./Secret"
import * as cheerio from "cheerio";
Expand Down Expand Up @@ -55,7 +56,7 @@ export class Process {
// return new Result(true, "令牌检测跳过");

let CurrentSessionData = ThrowErrorIfFailed(await this.XMOJDatabase.Select("phpsessid", ["user_id", "create_time"], {
token: this.SessionID
token: MD5(this.SessionID)
}));
if (CurrentSessionData.toString() !== "") {
if (CurrentSessionData[0]["user_id"] === this.Username &&
Expand Down Expand Up @@ -97,7 +98,7 @@ export class Process {
}

ThrowErrorIfFailed(await this.XMOJDatabase.Insert("phpsessid", {
token: this.SessionID,
token: MD5(this.SessionID),
user_id: this.Username,
create_time: new Date().getTime()
}));
Expand Down
3 changes: 2 additions & 1 deletion Server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"wrangler": "^3.8.0"
},
"dependencies": {
"cheerio": "^1.0.0-rc.12"
"cheerio": "^1.0.0-rc.12",
"cryptojs": "^2.5.3"
}
}