Skip to content

Commit

Permalink
fix: change sha256 hash lib
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Aug 7, 2023
1 parent ff71f26 commit fe24d0d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"i18n:build": "pnpm crowdin && node ./scripts/i18n.mjs",
"i18n:release": "pnpm run crowdin:download && node ./scripts/i18n.mjs",
"start": "vite",
"dev": "vite",
"dev": "vite --force",
"build": "vite build",
"serve": "vite preview",
"prepare": "husky install",
Expand All @@ -37,6 +37,7 @@
"@crowdin/cli": "^3.7.10",
"@types/mark.js": "^8.11.8",
"@types/node": "^18.7.5",
"@types/sha256": "^0.2.0",
"@types/streamsaver": "^2.0.1",
"@vitejs/plugin-legacy": "^2.0.1",
"husky": "^8.0.2",
Expand Down Expand Up @@ -71,7 +72,7 @@
"remark-gfm": "^3.0.1",
"remark-math": "^5.1.1",
"seemly": "^0.3.6",
"sha-anything": "^0.0.4",
"sha256": "^0.2.0",
"solid-contextmenu": "0.0.2",
"solid-icons": "^1.0.1",
"solid-js": "^1.4.8",
Expand Down
47 changes: 24 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/pages/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Login = () => {
async (): Promise<Resp<{ token: string }>> =>
r.post("/auth/login/hash", {
username: username(),
password: await hashPwd(password()),
password: hashPwd(password()),
otp_code: opt(),
}),
)
Expand Down
6 changes: 3 additions & 3 deletions src/utils/hash.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sha256 } from "sha-anything"
import sha256 from "sha256"

const hash_salt = "https://github.com/alist-org/alist"

export async function hashPwd(pwd: string) {
return await sha256(`${pwd}-${hash_salt}`)
export function hashPwd(pwd: string) {
return sha256(`${pwd}-${hash_salt}`)
}
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default defineConfig({
// },
// },
server: {
host: "0.0.0.0",
proxy: {
"/api": {
target: "http://localhost:5244",
Expand Down

0 comments on commit fe24d0d

Please sign in to comment.