Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Allow configuring login cookie with an expiry duration

未关闭
#7,301 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript

调研方向

从 src/node/http.ts 约第 328 行开始,然后追踪配置参数的定义和读取方式。为登录 cookie 添加可选的过期设置;当该设置缺失或为零时,保留会话 cookie 的行为。确认配置的持续时间会在浏览器关闭后保留登录 cookie。

由索引模型根据 Issue 内容生成。

描述

enhancement

What is your suggestion?

Allow configuring an (optional) expiry age for the login cookie so that it persists beyond a browser session. This is handy for not re-entering the password every time.

Possible change:
https://github.com/coder/code-server/blob/main/src/node/http.ts#L328

...
return {
  domain: getCookieDomain(url.host, req.args["proxy-domain"]),
  path: normalize(url.pathname) || "/",
  sameSite: "lax",
  // Load, if provided, max age for login cookie. 0 means it becomes a Session cookie (according to Express docs)
  maxAge: getConfigCookieMaxAgeAsMilliseconds() || 0,
}

Why do you want this feature?

I want to maintain my login status even after closing the browser (as the Cookie is currently session-only). Say keep the login cookie for a week or a month. Adding a max-age changes the cookie from Session to persistent for the given duration using Express' maxAge parameter (docs).

Are there any workarounds to get this functionality today?

No, none directly. User can manually edit the cookie in Devtools

Are you interested in submitting a PR for this?

I'm not that familiar with how to make new configuration argument and also how the config args are read (there's some middleware for args IIRC, but not sure how to use that). But I can give it a go, with some help.

The above given change should be roughly all that's needed, sans the config reading.

主要语言
TypeScript
星标
79.4k
派生
6.9k
平均合并
2 天 13 小时
30 天内合并 PR
39

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

coder/code-server 的其他 Issue

查看 coder/code-server 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。