Skip to content

Conversation

@RC-CHN
Copy link
Member

@RC-CHN RC-CHN commented Jan 13, 2026

Implement End User License Agreement (EULA) functionality that prompts users to accept terms before using the application.

Backend changes:

  • Add EulaRoute with endpoints for status, content, and acceptance
  • Store acceptance state in cmd_config.json with timestamp and user info

Frontend changes:

  • Add EulaDialog component with markdown rendering support
  • Integrate EULA check into FullLayout on page load (before migration)
  • Add i18n translations for zh-CN and en-US locales

Modifications / 改动点

在cmd_config内存储EULA签署状态,要求用户签署eula,首次签署后不再提醒。

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

image

Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Summary by Sourcery

引入终端用户许可协议(EULA)流程,用户必须在使用仪表盘和其他现有启动流程之前先接受该协议。

新功能:

  • 添加 EULA 后端路由,用于检查状态、获取 markdown 内容,并将带有元数据的接受记录写入 cmd_config.json
  • 添加前端 EULA 对话框组件,支持 markdown 渲染,并将其集成到主布局中,使用户在首次加载时会被提示接受协议。
  • 为与 EULA 相关的 UI 文本在 en-USzh-CN 语言环境中添加 i18n 资源和加载配置。

改进:

  • 更新仪表盘初始化顺序,使 EULA 检查在页面加载时先于现有的迁移对话框运行。
Original summary in English

Summary by Sourcery

Introduce an end-user license agreement (EULA) flow that must be accepted before using the dashboard and other existing startup flows.

New Features:

  • Add EULA backend routes for checking status, fetching markdown content, and recording acceptance in cmd_config.json with metadata.
  • Add a frontend EULA dialog component with markdown rendering and integrate it into the main layout so users are prompted to accept on first load.
  • Add i18n resources and loader wiring for EULA-related UI text in en-US and zh-CN locales.

Enhancements:

  • Update dashboard initialization order so the EULA check runs before the existing migration dialog on page load.

…upport

Implement End User License Agreement (EULA) functionality that prompts
users to accept terms before using the application.

Backend changes:
- Add EulaRoute with endpoints for status, content, and acceptance
- Store acceptance state in cmd_config.json with timestamp and user info

Frontend changes:
- Add EulaDialog component with markdown rendering support
- Integrate EULA check into FullLayout on page load (before migration)
- Add i18n translations for zh-CN and en-US locales
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jan 13, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出了一些总体反馈:

  • EulaDialog.vue 中,Markdown 使用 marked 直接渲染到 v-html,没有进行任何清理;建议在结果上使用一个内容清理器(例如 DOMPurify),或者使用更安全的 Markdown 渲染器,以避免在 EULA 内容将来可能变为用户可控时产生潜在的 XSS 风险。
  • EulaDialog.vue 中的 resolvePromise 回调从未被清空,可能会被无意间重复使用;在 handleAccept 中完成处理后(以及在任何可能的提前返回路径中)应将其设为 null,以避免内存泄漏或意外的多次 resolve。
  • EulaRoute 在构造函数中保存了 dbcore_lifecycle,但从未使用;可以考虑移除这些依赖,或者将它们真正接入路由逻辑中,以保持路由实现的聚焦并避免未使用的状态。
面向 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- In `EulaDialog.vue`, the Markdown is rendered directly with `marked` into `v-html` without sanitization; consider passing the result through a sanitizer (e.g., DOMPurify) or using a safer markdown renderer to avoid potential XSS if the EULA content ever becomes user-controlled.
- The `resolvePromise` callback in `EulaDialog.vue` is never cleared and could be reused unintentionally; set it to `null` after resolving in `handleAccept` (and in any early-return paths) to avoid memory leaks or accidental multiple resolutions.
- `EulaRoute` stores `db` and `core_lifecycle` in the constructor but never uses them; either remove these dependencies or wire them into the route logic to keep the route implementation focused and avoid unused state.

Sourcery 对开源项目免费 —— 如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈来改进后续评审。
Original comment in English

Hey - I've left some high level feedback:

  • In EulaDialog.vue, the Markdown is rendered directly with marked into v-html without sanitization; consider passing the result through a sanitizer (e.g., DOMPurify) or using a safer markdown renderer to avoid potential XSS if the EULA content ever becomes user-controlled.
  • The resolvePromise callback in EulaDialog.vue is never cleared and could be reused unintentionally; set it to null after resolving in handleAccept (and in any early-return paths) to avoid memory leaks or accidental multiple resolutions.
  • EulaRoute stores db and core_lifecycle in the constructor but never uses them; either remove these dependencies or wire them into the route logic to keep the route implementation focused and avoid unused state.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `EulaDialog.vue`, the Markdown is rendered directly with `marked` into `v-html` without sanitization; consider passing the result through a sanitizer (e.g., DOMPurify) or using a safer markdown renderer to avoid potential XSS if the EULA content ever becomes user-controlled.
- The `resolvePromise` callback in `EulaDialog.vue` is never cleared and could be reused unintentionally; set it to `null` after resolving in `handleAccept` (and in any early-return paths) to avoid memory leaks or accidental multiple resolutions.
- `EulaRoute` stores `db` and `core_lifecycle` in the constructor but never uses them; either remove these dependencies or wire them into the route logic to keep the route implementation focused and avoid unused state.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot dosubot bot added the area:webui The bug / feature is about webui(dashboard) of astrbot. label Jan 13, 2026
Switch markdown rendering library from marked to markdown-it with
explicit configuration for HTML support, linkify, and typographer.
- Remove unused db and core_lifecycle dependencies from EulaRoute
- Add DOMPurify sanitization for markdown rendered content to prevent XSS
- Add eula configuration object to default config with acceptance tracking
- Clear resolvePromise after use to prevent memory leaks
Implement SHA256 hash tracking to detect EULA file modifications.
When the EULA content changes, users are required to re-sign.

- Add content_hash field to eula config schema
- Calculate and store EULA file hash on acceptance
- Compare stored hash with current file hash on status check
- Return eula_updated reason when hash mismatch detected
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant