feat: componentize User Agreement and Privacy Policy display
Extracted the User Agreement and Privacy Policy presentation into a reusable DocumentRenderer component (web/src/components/common/DocumentRenderer). Unified rendering logic and i18n source for these documents, removed the legacy contentDetector utility, and updated the related pages to use the new component. Adjusted controller/backend (controller/misc.go) and locale files to support the new rendering approach. This improves reuse, maintainability, and future extensibility.
This commit is contained in:
@@ -110,27 +110,9 @@ const RegisterForm = () => {
|
||||
setTurnstileSiteKey(status.turnstile_site_key);
|
||||
}
|
||||
|
||||
// 检查用户协议和隐私政策是否已设置
|
||||
const checkTermsAvailability = async () => {
|
||||
try {
|
||||
const [userAgreementRes, privacyPolicyRes] = await Promise.all([
|
||||
API.get('/api/user-agreement'),
|
||||
API.get('/api/privacy-policy')
|
||||
]);
|
||||
|
||||
if (userAgreementRes.data.success && userAgreementRes.data.data) {
|
||||
setHasUserAgreement(true);
|
||||
}
|
||||
|
||||
if (privacyPolicyRes.data.success && privacyPolicyRes.data.data) {
|
||||
setHasPrivacyPolicy(true);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('检查用户协议和隐私政策失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
checkTermsAvailability();
|
||||
// 从 status 获取用户协议和隐私政策的启用状态
|
||||
setHasUserAgreement(status.user_agreement_enabled || false);
|
||||
setHasPrivacyPolicy(status.privacy_policy_enabled || false);
|
||||
}, [status]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user