Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
SunWuyuan committed Nov 9, 2024
1 parent e8a9243 commit fac08f9
Show file tree
Hide file tree
Showing 19 changed files with 4,914 additions and 3,353 deletions.
10 changes: 2 additions & 8 deletions .bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
* Module dependencies.
*/

//prisma client
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();
const configManager = require("../server/configManager");


// 使用 getConfig 函数获取配置
(async () => {
await configManager.initialize(); // 初始化并加载配置

console.log("site.name:", await configManager.getConfig("site.name"));
console.log("加载网站:", await configManager.getConfig("site.name"));
})();

//console.log(config)
Expand Down Expand Up @@ -97,7 +93,5 @@ function onError(error) {

function onListening() {
var addr = server.address();
var bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port;
console.log("Listening on " + bind);
console.log("http://localhost:" + addr.port);
console.log("Listening on http://localhost:" + addr.port);
}
101 changes: 1 addition & 100 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,100 +1 @@
=
SiteName=
SiteSlogan=
SiteDomain=
SitePrivacyPolicy=
SiteTermsofService=
SiteFeedbackEmail=
#recaptcha 测试环境数据,始终返回成功,请勿在生产环境使用
#rekey='0x4AAAAAAAHW417G1zlyXZhW'
#resecret='0x4AAAAAAAHW46pUIOHkBAtxriTbQONaHT8'
rekey=
resecret=
#高级设置,可以兼容理论上所有兼容recaptcha的验证码,如非需要不需修改
reurl=
reverify=
=
#兼容hcaptcha示例
# reurl='https://challenges.cloudflare.com/turnstile/v0/api.js'
# reverify='https://challenges.cloudflare.com/turnstile/v0/siteverify'
=
#邮箱 生产环境,给俺小心点
mailservice=
mailuser=
mailpass=
mailfrom=
=
=
#安全 生产环境,给俺小心点
adminuser=
jwttoken=
SessionSecret=
=
#mysql 开发环境测试DB,请勿在生产环境使用
mysqlhost=
mysqlport=
mysqluser=
mysqlpassword=
mysqldatabase=
mysqlssl =
DATABASE_URL=
#DATABASE_URL="mysql://root:[email protected]:3306/zerocat"
=
=
# S3存储 生产环境,给俺小心点
S3endpoint=
S3region=
S3bucket=
=
=
#AWS_ACCESS_KEY_ID='wVSYiKJd6odezsq3t6kV12mw'
#AWS_SECRET_ACCESS_KEY='c8q6ocIbXHpg8w98KLsP3G94bXAvTI5'
=
=
#S3endpoint='https://s3.us-west-004.backblazeb2.com'
#S3region='us-west-004'
#S3bucket='ourworld'
#AWS_ACCESS_KEY_ID='00431947f6014c90000000002'
#AWS_SECRET_ACCESS_KEY='K004cd5buq0LBWxhzGi+k534Fj3tkhQ'
S3staticurl=
=
#Axiom日志流,不填则删掉这两行 不区分环境
AXIOM_DATASET=
AXIOM_TOKEN=
=
#Cors配置
corslist=
=
#评论区配置
WalineServerURL=
=
#兔小巢配置
txcid=
txckey=
=
#前端静态文件地址 记得改掉!
staticurl=
#localstatic=false
#staticpath='static'
=
#使用本地数据示例,请将https://github.com/ZeroCatOrg/StaticFile下载到项目目录中(与build,node_modules同级),并修改文件夹名称为staticpath的值(默认是static,也可以修改staticpath的值)
#使用时请注释掉上方内容(从前端静态文件地址到此处),因为环境变量不可以重复
# localstatic=true #是否使用本地静态文件
# staticurl='/static' #无需修改,当然也可以随便改成别的
# staticpath='static' #静态文件在服务器上的相对地址(相对于项目根目录)
html=
=
# This was inserted by `prisma init`:
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
=
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
=
editorurl=
=
=
# Geetest 极验
GEE_CAPTCHA_ID =
GEE_CAPTCHA_KEY =
GEE_API_SERVER =
DATABASE_URL="mysql://[username]:[password]@[host]:[port]/[database]"
7 changes: 3 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ let corslist;
(async () => {
corslist = (await configManager.getConfig("cors")).split(",");
})();
console.log(corslist);

var corsOptions = {
origin: (origin, callback) => {
Expand Down Expand Up @@ -133,12 +132,12 @@ let zcjwttoken
app.all("*", async function (req, res, next) {
//console.log(req.method +' '+ req.url + " IP:" + req.ip);
const token =
((req.headers["authorization"] || "").replace("Bearer ", ""))||
(req.cookies && req.cookies.token) ||
(req.body && req.body.token) ||
(req.headers && req.headers["token"]) ||
(req.query && req.query.token) ||
((req.headers["authorization"] || "").replace("Bearer ", ""));

(req.query && req.query.token)
console.log(token);
// Continue with the token verification
if (token) {
jwt.verify(token, zcjwttoken, (err, decodedToken) => {
Expand Down
Loading

0 comments on commit fac08f9

Please sign in to comment.