Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
SunWuyuan committed Nov 17, 2024
1 parent ec8bbe6 commit 0b4bb67
Show file tree
Hide file tree
Showing 9 changed files with 1,224 additions and 1,514 deletions.
3 changes: 3 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ app.use(compress());
app.set("env", __dirname + "/.env");
app.set("data", __dirname + "/data");
app.set("views", __dirname + "/views");
app.set("prisma", __dirname + "/prisma");
app.set("node_modules/@prisma/client", __dirname + "/node_modules/@prisma/client");

app.set("view engine", "ejs");

//数据库
Expand Down
1,227 changes: 610 additions & 617 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"private": true,
"type": "commonjs",
"scripts": {
"build": "npm i -g @vercel/ncc && ncc build app.js && mkdir dist/api && cp dist/index.js dist/api/index.js",
"build": "npm i -g @vercel/ncc && ncc build .bin/www",
"test": "echo \"No test specified\" && exit 1",
"start": "node .bin/www",
"prisma": "prisma db pull && prisma generate"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.688.0",
"@aws-sdk/client-s3": "^3.693.0",
"@prisma/client": "^5.22.0",
"axios": "^1.7.3",
"body-parser": "^1.20.1",
Expand All @@ -28,11 +28,8 @@
"morgan": "^1.10.0",
"mysql": "^2.18.1",
"nodemailer": "^6.9.16",
"otpauth": "^9.3.4",
"passport": "^0.7.0",
"passport-2fa-totp": "^0.0.1",
"otpauth": "^9.3.5",
"phpass": "^0.1.1",
"qrcode": "^1.5.4",
"request": "^2.88.0"
},
"devDependencies": {
Expand Down
1,471 changes: 596 additions & 875 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ model ow_projects {
model ow_users {
id Int @unique(map: "id_UNIQUE") @default(autoincrement())
username String @unique(map: "user_UNIQUE") @db.Char(20)
email String @db.Char(100)
email String @id @db.Char(100)
password String @db.VarChar(255)
display_name String @default("OurWorld创作者") @db.Char(20)
state Int @default(0) @db.TinyInt
loginTime DateTime? @db.Timestamp(0)
regTime DateTime? @default(now()) @db.Timestamp(0)
sex Int? @default(0) @db.TinyInt
birthday DateTime? @default(dbgenerated("'2000-03-31 16:00:00'")) @db.Timestamp(0)
birthday DateTime? @default(dbgenerated("'2000-04-01 00:00:00'")) @db.Timestamp(0)
motto String? @default("OurWorld创作者") @db.VarChar(1000)
images String? @default("fcd939e653195bb6d057e8c2519f5cc7") @db.VarChar(255)
avatar String? @default("https://owcdn.190823.xyz/user/fcd939e653195bb6d057e8c2519f5cc7") @db.VarChar(255)
Expand All @@ -158,11 +158,9 @@ model ow_users {
weibo String? @db.VarChar(255)
qq String? @db.VarChar(255)
fa String? @map("2fa") @db.VarChar(255)
createdAt DateTime? @default(dbgenerated("'2000-03-31 16:00:00'")) @db.Timestamp(0)
updatedAt DateTime? @default(dbgenerated("'2000-03-31 16:00:00'")) @db.Timestamp(0)
createdAt DateTime? @default(dbgenerated("'2000-04-01 00:00:00'")) @db.Timestamp(0)
updatedAt DateTime? @default(dbgenerated("'2000-04-01 00:00:00'")) @db.Timestamp(0)
label String? @db.VarChar(255)
@@id([id, username, email])
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
Expand Down Expand Up @@ -237,7 +235,7 @@ model user {
loginTime DateTime? @db.Timestamp(0)
regTime DateTime? @default(now()) @db.Timestamp(0)
sex Int? @default(0) @db.TinyInt
birthday DateTime? @default(dbgenerated("'2000-04-01 00:00:00'")) @db.Timestamp(0)
birthday DateTime? @default(dbgenerated("'2000-04-01 08:00:00'")) @db.Timestamp(0)
motto String? @default("OurWorld创作者") @db.VarChar(1000)
images String? @default("头像") @db.VarChar(255)
Expand Down Expand Up @@ -375,7 +373,7 @@ view ow_projects_view {
authorid Int
state String? @default("private") @db.VarChar(32)
view_count Int? @default(0) @db.UnsignedInt
time DateTime? @default(now()) @db.Timestamp(0)
time DateTime? @db.Timestamp(0)
title String? @default("Scratch新项目") @db.VarChar(1000)
description String? @default("OurWorld上的Scratch项目") @db.VarChar(1000)
source String? @db.MediumText
Expand All @@ -397,7 +395,7 @@ view ow_public_projects_view {
authorid Int
state String? @default("private") @db.VarChar(32)
view_count Int? @default(0) @db.UnsignedInt
time DateTime? @default(now()) @db.Timestamp(0)
time DateTime? @db.Timestamp(0)
title String? @default("Scratch新项目") @db.VarChar(1000)
description String? @default("OurWorld上的Scratch项目") @db.VarChar(1000)
source String? @db.MediumText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ SELECT
`author`.`images` AS `author_images`
FROM
(
`zerocat`.`ow_projects` `project`
JOIN `zerocat`.`ow_users` `author` ON((`project`.`authorid` = `author`.`id`))
`zerocat_develop`.`ow_projects` `project`
JOIN `zerocat_develop`.`ow_users` `author` ON((`project`.`authorid` = `author`.`id`))
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ SELECT
`author`.`images` AS `author_images`
FROM
(
`zerocat`.`ow_projects` `project`
JOIN `zerocat`.`ow_users` `author` ON((`project`.`authorid` = `author`.`id`))
`zerocat_develop`.`ow_projects` `project`
JOIN `zerocat_develop`.`ow_users` `author` ON((`project`.`authorid` = `author`.`id`))
)
WHERE
(`project`.`state` = 'public')
2 changes: 0 additions & 2 deletions server/lib/totpUtils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const OTPAuth = require("otpauth");
const QRCode = require("qrcode");
const I = require("./global.js");
const e = require("express");

// Common function to create a TOTP instance
function createTotpInstance(
Expand Down
2 changes: 1 addition & 1 deletion server/router_account.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ router.post("/magiclink/generate", geetest, async (req, res) => {

res.status(200).json({status: "success", message: "Magic Link 已发送到您的邮箱" });
} catch (error) {
//console.error("生成 Magic Link 时出错:", error);
console.error("生成 Magic Link 时出错:", error);
res.status(200).json({ status: "error", message: "生成 Magic Link 失败" });
}
});
Expand Down

0 comments on commit 0b4bb67

Please sign in to comment.