diff --git a/.env b/.env new file mode 100644 index 0000000..f339eb3 --- /dev/null +++ b/.env @@ -0,0 +1,14 @@ +# 端口 +PORT=3000 + +# MongoDB 连接地址,如果 MongoDB 在本机默认端口 +DB_CONNECTION="mongodb://localhost:27017/livepoll" + +# 密码加密复杂度 +SALT_ROUNDS=6 + +# JWT 私钥(可以随便写一串随机字符) +JWT_PRIVATE="your-secret-jwt-key" + +# 前端访问地址(群友打开的链接) +CLIENT_URL="http://110.42.109.143:3000" diff --git a/backend/src/controllers/user.controller.js b/backend/src/controllers/user.controller.js index 2e79b80..fb12647 100644 --- a/backend/src/controllers/user.controller.js +++ b/backend/src/controllers/user.controller.js @@ -31,8 +31,8 @@ export async function signinController(req, res) { const { token, userData } = await signinService(email, password); res.cookie("livepoll-access-token", token, { httpOnly: true, - secure: true, - sameSite: "None", + secure: false, + sameSite: "Lax", expires: new Date(Date.now() + 24 * 60 * 60 * 1000 * 365), // 1 year path: "/" }).status(200).json({ diff --git a/frontend/.env b/frontend/.env index d40a145..8c264d6 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1 +1 @@ -VITE_BACKEND_URL="https://livepoll-anjx.onrender.com" \ No newline at end of file +VITE_BACKEND_URL="http://localhost:3000" diff --git a/frontend/src/components/Header/Header.jsx b/frontend/src/components/Header/Header.jsx index 0c3e2ce..4657e8e 100644 --- a/frontend/src/components/Header/Header.jsx +++ b/frontend/src/components/Header/Header.jsx @@ -17,15 +17,15 @@ function Header() {
- LivePoll is your platform for real-time, interactive polling. Create polls, participate in - active discussions, and get instant feedback with live updates and visualizations. Discover - what people think on topics that matter to you and have your voice heard! + LivePoll 是您进行实时互动投票的平台。创建投票,参与活跃讨论,并通过实时更新和可视化获得即时反馈。探索人们对您关心话题的看法,让您的声音被听到!
- Create custom polls on any topic and share them with others. Add options, set - permissions, and see the responses roll in real-time. + 创建关于任何主题的自定义投票并与他人分享。添加选项,设置权限,并实时查看响应结果。
- Browse a variety of public polls or join private ones shared with you. Cast your vote - and see the real-time results as others participate. + 浏览各种公开投票或加入与您分享的私人投票。投出您的一票,并在他人参与时查看实时结果。
- Bookmark polls to save them for later, view your past participation, and stay updated - on topics you care about. + 收藏投票以便稍后查看,查看您过去的参与记录,并随时了解您关心的话题动态。
- Don’t have an account?{' '} - Sign up + 还没有账户?{' '} + 立即注册