-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(dashboard): add EULA acceptance flow with backend and frontend support #4445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RC-CHN
wants to merge
4
commits into
AstrBotDevs:master
Choose a base branch
from
RC-CHN:sign-EULA
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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
Contributor
There was a problem hiding this 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在构造函数中保存了db和core_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.帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈来改进后续评审。
Original comment in English
Hey - I've left some high level feedback:
- In
EulaDialog.vue, the Markdown is rendered directly withmarkedintov-htmlwithout 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
resolvePromisecallback inEulaDialog.vueis never cleared and could be reused unintentionally; set it tonullafter resolving inhandleAccept(and in any early-return paths) to avoid memory leaks or accidental multiple resolutions. EulaRoutestoresdbandcore_lifecyclein 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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement End User License Agreement (EULA) functionality that prompts users to accept terms before using the application.
Backend changes:
Frontend changes:
Modifications / 改动点
在cmd_config内存储EULA签署状态,要求用户签署eula,首次签署后不再提醒。
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Summary by Sourcery
引入终端用户许可协议(EULA)流程,用户必须在使用仪表盘和其他现有启动流程之前先接受该协议。
新功能:
cmd_config.json。en-US和zh-CN语言环境中添加 i18n 资源和加载配置。改进:
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:
Enhancements: