From e48cd2d8598772af1bf1e97d78f5ca09ba059f06 Mon Sep 17 00:00:00 2001 From: codex Date: Sat, 24 Oct 2026 18:11:54 +0800 Subject: [PATCH] feat(web): add landing and global legal pages --- docs/DEPLOYMENT.md | 8 + docs/PRUNING_REPORT.md | 1 + docs/VALIDATION.md | 5 + web/app/Controllers/Admin/LegalController.php | 118 +++ web/app/Controllers/AuthController.php | 3 + web/app/Controllers/LegalController.php | 41 + web/app/Models/LegalDocument.php | 9 + web/app/Models/LegalDocumentRevision.php | 9 + web/app/Services/LegalDocumentService.php | 524 +++++++++++ web/config/routes.php | 8 + web/public/cloud/account.css | 53 +- web/public/theme/venix/css/admin-home.css | 114 +++ web/public/theme/venix/css/home.css | 814 +++++++++--------- web/public/theme/venix/js/admin-legal.js | 180 ++++ web/resources/views/venix/admin/legal.tpl | 120 +++ .../views/venix/admin/static_header.tpl | 1 + web/resources/views/venix/auth/register.tpl | 72 +- .../views/venix/home/layout_header.tpl | 2 +- .../views/venix/home/site_footer.tpl | 37 + .../views/venix/home/site_header.tpl | 24 + web/resources/views/venix/index.tpl | 95 +- web/resources/views/venix/layout_assets.tpl | 2 +- web/resources/views/venix/legal.tpl | 25 + web/sql/legal_documents.sql | 33 + web/sql/ss.sql | 41 + web/tests/LegalDocumentServiceTest.php | 150 ++++ web/tests/LegalPagesContractTest.php | 84 ++ 27 files changed, 2053 insertions(+), 520 deletions(-) create mode 100644 web/app/Controllers/Admin/LegalController.php create mode 100644 web/app/Controllers/LegalController.php create mode 100644 web/app/Models/LegalDocument.php create mode 100644 web/app/Models/LegalDocumentRevision.php create mode 100644 web/app/Services/LegalDocumentService.php create mode 100644 web/public/theme/venix/js/admin-legal.js create mode 100644 web/resources/views/venix/admin/legal.tpl create mode 100644 web/resources/views/venix/home/site_footer.tpl create mode 100644 web/resources/views/venix/home/site_header.tpl create mode 100644 web/resources/views/venix/legal.tpl create mode 100644 web/sql/legal_documents.sql create mode 100644 web/tests/LegalDocumentServiceTest.php create mode 100644 web/tests/LegalPagesContractTest.php diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md index c43be8a6..59329b17 100644 --- a/docs/DEPLOYMENT.md +++ b/docs/DEPLOYMENT.md @@ -71,6 +71,14 @@ mariadb -h DB_HOST -P DB_PORT -u DB_USER -p BUSINESS_DB < /home/virt-cloud/web/s 该增量文件只为当前分支的测试环境补充姓、名、手机号和地址字段,不读取或迁移已退役系统的数据。注册流程不采集这些资料;新用户和已有用户均可登录后在“账户设置 → 账户信息”中补充。 +已经运行当前 `go` 分支 schema 的环境,在启用后台法律页面编辑前还需导入全局法律内容表: + +```bash +mariadb -h DB_HOST -P DB_PORT -u DB_USER -p BUSINESS_DB < /home/virt-cloud/web/sql/legal_documents.sql +``` + +服务条款和隐私政策按语言维护草稿与不可变发布版本,但不按域名拆分;所有配置域名读取同一份已发布内容,页面中的 `{{site_name}}` 会在展示时替换为当前站点名称。未导入增量表时公开页面使用内置安全文本,后台会明确提示先执行该 SQL,且不会把草稿误当作已发布内容。 + 若实例是在缺少 PHP 模板展示快照的早期 Go Agent 版本中创建,更新面板代码后先执行只读检查,再显式应用元数据修复: ```bash diff --git a/docs/PRUNING_REPORT.md b/docs/PRUNING_REPORT.md index c7e9e45b..31626cc3 100644 --- a/docs/PRUNING_REPORT.md +++ b/docs/PRUNING_REPORT.md @@ -9,6 +9,7 @@ - 云套餐、库存、订单、发票、支付、独立预付费账期、流量额度和三天未支付续费宽限。 - 多宿主机、资源池、容量策略、reservation、具体公网 IP 账本、多 CIDR、云镜像、救援 ISO、快照、防火墙、指标与控制台入口。 - 管理员工单 Telegram 通知;普通用户仍只在网页处理工单。 +- 公开产品落地页,以及后台统一维护、带草稿和发布历史的全局服务条款与隐私政策页面;法律内容不按域名拆分。 ## 删除 diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index 0b28bb6f..41fe3c6e 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -121,6 +121,11 @@ jq empty deploy/*.json.example - 任务中心分别查询 active/completed,显示未读数量,并在已完成内容真实渲染后显式标记已读。 - 全部 UI 不显示“待核对”、`uncertain`、`needs_attention`、停止自动核对、自动恢复、任务重试或续作旧 mutation 的控件。 - Unix 秒必须按秒转换;错误文本来自本地白名单,不显示 Agent 自由文本、路径、密钥或载荷。 +- 服务条款和隐私政策的公开页面只读取最近一次已发布版本;保存草稿、预览草稿和发布失败都不能改变公开内容。 +- 中文与英文法律内容分别维护草稿和发布历史;切换语言不能串用另一语言的版本。不同访问域名必须读取同一份全局发布内容,只允许 `{{site_name}}` 按当前站点名称安全替换。 +- 两个管理员同时编辑同一法律页面时,旧 `draft_version` 的保存或发布必须返回冲突,不能覆盖新草稿;发布成功必须新增不可变历史版本。 +- 法律内容在保存、预览和公开读取时都必须经过服务端清洗;脚本、事件属性、表单、外链资源和未知标签不能进入预览或公开页面。 +- 落地页、服务条款、隐私政策和后台法律编辑页必须分别在桌面与窄屏视口验收,导航、目录、编辑控件和正文不得横向溢出。 ## 7. 非生产宿主机验收 diff --git a/web/app/Controllers/Admin/LegalController.php b/web/app/Controllers/Admin/LegalController.php new file mode 100644 index 00000000..b29123c1 --- /dev/null +++ b/web/app/Controllers/Admin/LegalController.php @@ -0,0 +1,118 @@ +withStatus($exception->httpStatus) + ->withHeader('Cache-Control', 'private, no-store'); + } + + $query = $request->getQueryParams(); + $slug = $query['document'] ?? 'terms'; + $locale = $query['locale'] ?? 'zh-CN'; + $state = null; + $error = ''; + $status = 200; + try { + $state = LegalDocumentService::editorState($actor, $slug, $locale); + } catch (CloudError $exception) { + $error = $exception->getMessage(); + $status = $exception->httpStatus; + } catch (\Throwable $exception) { + error_log('Legal document editor failed: ' . get_class($exception)); + $error = '法律页面暂时无法读取,请检查数据库升级状态。'; + $status = 503; + } + + $smarty = $this->view()->assign([ + 'legal_state' => $state, + 'legal_error' => $error, + 'legal_can_manage' => (bool) ($actor['is_super_admin'] && $actor['can_manage']), + 'legal_selected_slug' => is_string($slug) ? $slug : 'terms', + 'legal_selected_locale' => is_string($locale) ? $locale : 'zh-CN', + ]); + $response->getBody()->write($smarty->fetch('admin/legal.tpl')); + return $response->withStatus($status)->withHeader('Cache-Control', 'private, no-store'); + } + + public function draft($request, $response, $args) + { + return $this->write($request, $response, $args, false); + } + + public function publish($request, $response, $args) + { + return $this->write($request, $response, $args, true); + } + + public function preview($request, $response, $args) + { + try { + $actor = CloudAccess::actor(false); + $input = $this->input($request); + $document = LegalDocumentService::preview( + $actor, + (string) ($args['slug'] ?? ''), + $input, + (string) Config::get('appName') + ); + return $response->withJson(['ret' => 1, 'document' => $document]) + ->withHeader('Cache-Control', 'private, no-store'); + } catch (CloudError $exception) { + return $this->error($response, $exception); + } catch (\Throwable $exception) { + error_log('Legal document preview failed: ' . get_class($exception)); + return $response->withJson(['ret' => 0, 'msg' => '预览生成失败,请稍后重试。'], 500) + ->withHeader('Cache-Control', 'private, no-store'); + } + } + + private function write($request, $response, array $args, bool $publish) + { + try { + $actor = CloudAccess::actor(false); + $input = $this->input($request); + $state = $publish + ? LegalDocumentService::publish($actor, (string) ($args['slug'] ?? ''), $input) + : LegalDocumentService::saveDraft($actor, (string) ($args['slug'] ?? ''), $input); + return $response->withJson([ + 'ret' => 1, + 'msg' => $publish ? '法律页面已发布' : '草稿已保存', + 'state' => $state, + ])->withHeader('Cache-Control', 'private, no-store'); + } catch (CloudError $exception) { + return $this->error($response, $exception); + } catch (\Throwable $exception) { + error_log('Legal document write failed: ' . get_class($exception)); + return $response->withJson(['ret' => 0, 'msg' => '法律页面保存失败,请稍后重试。'], 500) + ->withHeader('Cache-Control', 'private, no-store'); + } + } + + private function input($request): array + { + $input = $request->getParsedBody(); + if (!is_array($input)) { + throw new CloudError('请求格式不正确', 400); + } + return $input; + } + + private function error($response, CloudError $exception) + { + return $response->withJson(['ret' => 0, 'msg' => $exception->getMessage()], $exception->httpStatus) + ->withHeader('Cache-Control', 'private, no-store'); + } +} diff --git a/web/app/Controllers/AuthController.php b/web/app/Controllers/AuthController.php index 1d78157b..5d0d614e 100644 --- a/web/app/Controllers/AuthController.php +++ b/web/app/Controllers/AuthController.php @@ -872,6 +872,9 @@ class AuthController extends BaseController $value = $request->getParam($name, ''); return is_string($value) ? $value : ''; }; + if (Config::get('tos_reg') === 'true' && $read('accept_legal') !== 'true') { + return $this->echoJson($response, ['ret' => 0, 'msg' => '请先阅读并同意服务条款和隐私政策']); + } $email = strtolower(trim($read('email'))); $name = trim($read('name')); $password = $read('passwd'); diff --git a/web/app/Controllers/LegalController.php b/web/app/Controllers/LegalController.php new file mode 100644 index 00000000..4366e241 --- /dev/null +++ b/web/app/Controllers/LegalController.php @@ -0,0 +1,41 @@ +renderDocument($request, $response, 'terms'); + } + + public function privacy($request, $response, $args) + { + return $this->renderDocument($request, $response, 'privacy'); + } + + private function renderDocument($request, $response, string $slug) + { + $query = $request->getQueryParams(); + $requestedLocale = $query['lang'] ?? ''; + $locale = is_string($requestedLocale) && in_array($requestedLocale, ['zh-CN', 'en'], true) + ? $requestedLocale + : ($this->language === 'true' ? 'en' : 'zh-CN'); + $document = LegalDocumentService::published($slug, $locale, (string) $this->appName); + $smarty = $this->view()->assign([ + 'cdn' => $this->cdn, + 'backup_cdn' => $this->backup_cdn, + 'appName' => $this->appName, + 'seo' => $this->seo, + 'language' => $locale === 'en' ? 'true' : 'false', + 'legal_document' => $document, + 'legal_slug' => $slug, + ]); + $response->getBody()->write($smarty->fetch('legal.tpl')); + return $response + ->withHeader('Cache-Control', 'public, max-age=60') + ->withHeader('X-Content-Type-Options', 'nosniff'); + } +} diff --git a/web/app/Models/LegalDocument.php b/web/app/Models/LegalDocument.php new file mode 100644 index 00000000..6cbf3271 --- /dev/null +++ b/web/app/Models/LegalDocument.php @@ -0,0 +1,9 @@ + ['zh-CN' => '服务条款', 'en' => 'Terms of Service'], + 'privacy' => ['zh-CN' => '隐私政策', 'en' => 'Privacy Policy'], + ]; + private const LOCALES = ['zh-CN' => '简体中文', 'en' => 'English']; + private const ALLOWED_TAGS = [ + 'p', 'div', 'h2', 'h3', 'ul', 'ol', 'li', 'strong', 'em', + 'blockquote', 'br', + ]; + private const DROP_WITH_CONTENT = [ + 'script', 'style', 'iframe', 'object', 'embed', 'form', 'input', + 'button', 'textarea', 'select', 'option', 'link', 'meta', 'base', + 'svg', 'math', 'template', + ]; + private const MAX_TITLE_LENGTH = 120; + private const MAX_CONTENT_LENGTH = 100000; + + public static function published(string $slug, string $locale, string $siteName): array + { + $slug = self::slug($slug); + $locale = self::locale($locale); + try { + if (self::hasSchema()) { + $document = LegalDocument::query() + ->where('slug', $slug)->where('locale', $locale)->first(); + if ($document !== null && (int) $document->published_revision_id > 0) { + $revision = LegalDocumentRevision::query() + ->where('id', (int) $document->published_revision_id) + ->where('document_id', (int) $document->id)->first(); + if ($revision !== null) { + return self::publicDto( + $slug, + $locale, + (string) $revision->title, + (string) $revision->content_html, + (string) $revision->effective_date, + (int) $revision->version, + (string) $revision->published_at, + $siteName, + false + ); + } + } + } + } catch (\Throwable $exception) { + // Public legal pages stay available while an existing installation + // is applying the additive schema. Administrator writes still fail + // closed with an explicit migration error in editorState(). + if (!self::$fallbackErrorLogged) { + self::$fallbackErrorLogged = true; + error_log('Legal document fallback: ' . get_class($exception)); + } + } + + $default = self::defaults($slug, $locale); + return self::publicDto( + $slug, + $locale, + $default['title'], + $default['content_html'], + $default['effective_date'], + 1, + '', + $siteName, + true + ); + } + + public static function editorState(array $actor, string $slug, string $locale): array + { + self::authorize($actor); + $slug = self::slug($slug); + $locale = self::locale($locale); + self::assertSchema(); + + $document = LegalDocument::query() + ->where('slug', $slug)->where('locale', $locale)->first(); + $default = self::defaults($slug, $locale); + $published = null; + $history = []; + if ($document !== null) { + if ((int) $document->published_revision_id > 0) { + $published = LegalDocumentRevision::query() + ->where('id', (int) $document->published_revision_id) + ->where('document_id', (int) $document->id)->first(); + } + $history = LegalDocumentRevision::query() + ->where('document_id', (int) $document->id) + ->orderByDesc('version')->limit(20)->get()->map( + static fn ($revision): array => self::revisionDto($revision) + )->all(); + } + + return [ + 'slug' => $slug, + 'slug_label' => self::SLUGS[$slug][$locale], + 'locale' => $locale, + 'locale_label' => self::LOCALES[$locale], + 'title' => $document === null ? $default['title'] : (string) $document->title, + 'content_html' => self::sanitizeHtml( + $document === null ? $default['content_html'] : (string) $document->draft_html + ), + 'effective_date' => $document === null ? $default['effective_date'] : (string) $document->effective_date, + 'draft_version' => $document === null ? 0 : (int) $document->draft_version, + 'updated_at' => $document === null ? null : (string) $document->updated_at, + 'updated_by' => $document === null ? null : (int) $document->updated_by, + 'published' => $published === null ? null : self::revisionDto($published), + 'history' => $history, + 'documents' => self::SLUGS, + 'locales' => self::LOCALES, + ]; + } + + public static function saveDraft(array $actor, string $slug, array $input): array + { + self::authorize($actor, true); + $slug = self::slug($slug); + $values = self::validatedInput($input); + self::assertSchema(); + + (new LegalDocument())->getConnection()->transaction( + static function () use ($actor, $slug, $values): void { + self::writeDraft($actor, $slug, $values); + } + ); + + return self::editorState($actor, $slug, $values['locale']); + } + + public static function publish(array $actor, string $slug, array $input): array + { + self::authorize($actor, true); + $slug = self::slug($slug); + $values = self::validatedInput($input); + self::assertSchema(); + + (new LegalDocument())->getConnection()->transaction( + static function () use ($actor, $slug, $values): void { + $document = self::writeDraft($actor, $slug, $values); + $lastVersion = (int) LegalDocumentRevision::query() + ->where('document_id', (int) $document->id)->lockForUpdate()->max('version'); + $now = date('Y-m-d H:i:s'); + $revision = new LegalDocumentRevision(); + $revision->document_id = (int) $document->id; + $revision->version = $lastVersion + 1; + $revision->title = (string) $document->title; + $revision->content_html = (string) $document->draft_html; + $revision->effective_date = (string) $document->effective_date; + $revision->published_at = $now; + $revision->published_by = (int) $actor['user_id']; + $revision->save(); + + $document->published_revision_id = (int) $revision->id; + $document->updated_at = $now; + $document->updated_by = (int) $actor['user_id']; + $document->save(); + } + ); + + return self::editorState($actor, $slug, $values['locale']); + } + + public static function preview(array $actor, string $slug, array $input, string $siteName): array + { + self::authorize($actor); + $slug = self::slug($slug); + $values = self::validatedInput($input, false); + return self::publicDto( + $slug, + $values['locale'], + $values['title'], + $values['content_html'], + $values['effective_date'], + 0, + '', + $siteName, + true + ); + } + + private static function writeDraft(array $actor, string $slug, array $values): LegalDocument + { + $document = LegalDocument::query()->where('slug', $slug) + ->where('locale', $values['locale'])->lockForUpdate()->first(); + $actualVersion = $document === null ? 0 : (int) $document->draft_version; + if ($actualVersion !== $values['draft_version']) { + throw new CloudError('内容已被其他管理员更新,请重新加载后再编辑', 409); + } + $now = date('Y-m-d H:i:s'); + if ($document === null) { + $document = new LegalDocument(); + $document->slug = $slug; + $document->locale = $values['locale']; + $document->published_revision_id = null; + $document->created_at = $now; + } + $document->title = $values['title']; + $document->draft_html = $values['content_html']; + $document->effective_date = $values['effective_date']; + $document->draft_version = $actualVersion + 1; + $document->updated_at = $now; + $document->updated_by = (int) $actor['user_id']; + $document->save(); + return $document; + } + + private static function publicDto( + string $slug, + string $locale, + string $title, + string $html, + string $effectiveDate, + int $version, + string $publishedAt, + string $siteName, + bool $fallback + ): array { + $html = self::sanitizeHtml($html); + $safeSiteName = htmlspecialchars(trim($siteName), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + if ($safeSiteName === '') { + $safeSiteName = $locale === 'en' ? 'this site' : '本站'; + } + $title = str_replace('{{site_name}}', html_entity_decode($safeSiteName, ENT_QUOTES, 'UTF-8'), $title); + $html = str_replace('{{site_name}}', $safeSiteName, $html); + [$html, $outline] = self::decorateHeadings($html); + return [ + 'slug' => $slug, + 'locale' => $locale, + 'title' => $title, + 'content_html' => $html, + 'effective_date' => $effectiveDate, + 'version' => $version, + 'published_at' => $publishedAt === '' ? null : $publishedAt, + 'fallback' => $fallback, + 'outline' => $outline, + ]; + } + + private static function validatedInput(array $input, bool $withVersion = true): array + { + $locale = self::locale($input['locale'] ?? null); + $title = self::plainText($input['title'] ?? null, '标题', self::MAX_TITLE_LENGTH); + $content = $input['content_html'] ?? null; + if (!is_string($content) || !mb_check_encoding($content, 'UTF-8') + || mb_strlen($content, 'UTF-8') > self::MAX_CONTENT_LENGTH) { + throw new CloudError('正文格式不正确或超过 100000 个字符', 400); + } + $content = self::sanitizeHtml($content); + if (trim(strip_tags($content)) === '') { + throw new CloudError('正文不能为空', 400); + } + $effectiveDate = self::date($input['effective_date'] ?? null); + $version = 0; + if ($withVersion) { + $candidate = $input['draft_version'] ?? null; + if ((!is_int($candidate) && !is_string($candidate)) + || !preg_match('/^[0-9]{1,10}$/D', (string) $candidate)) { + throw new CloudError('草稿版本不正确,请重新加载页面', 400); + } + $version = (int) $candidate; + } + return [ + 'locale' => $locale, + 'title' => $title, + 'content_html' => $content, + 'effective_date' => $effectiveDate, + 'draft_version' => $version, + ]; + } + + private static function sanitizeHtml(string $html): string + { + $html = (new AntiXSS())->xss_clean($html); + [$dom, $root] = self::fragment($html); + $xpath = new DOMXPath($dom); + $nodes = []; + foreach ($xpath->query('//*') ?: [] as $node) { + if ($node instanceof DOMElement && $node !== $root) { + $nodes[] = $node; + } + } + foreach ($nodes as $node) { + if ($node->parentNode === null) { + continue; + } + $tag = strtolower($node->tagName); + if (in_array($tag, self::DROP_WITH_CONTENT, true)) { + $node->parentNode->removeChild($node); + continue; + } + if (!in_array($tag, self::ALLOWED_TAGS, true)) { + self::unwrap($node); + continue; + } + while ($node->attributes !== null && $node->attributes->length > 0) { + $node->removeAttributeNode($node->attributes->item(0)); + } + } + foreach ($xpath->query('//comment()|//processing-instruction()') ?: [] as $node) { + if ($node->parentNode !== null) { + $node->parentNode->removeChild($node); + } + } + return trim(self::innerHtml($root)); + } + + private static function decorateHeadings(string $html): array + { + [$dom, $root] = self::fragment($html); + $xpath = new DOMXPath($dom); + $outline = []; + $index = 0; + foreach ($xpath->query('.//h2|.//h3', $root) ?: [] as $heading) { + if (!$heading instanceof DOMElement) { + continue; + } + $label = trim(preg_replace('/\s+/u', ' ', (string) $heading->textContent)); + if ($label === '') { + continue; + } + $index++; + $id = 'legal-section-' . $index; + $heading->setAttribute('id', $id); + $outline[] = ['id' => $id, 'title' => $label, 'level' => strtolower($heading->tagName)]; + } + return [trim(self::innerHtml($root)), $outline]; + } + + private static function fragment(string $html): array + { + $dom = new DOMDocument('1.0', 'UTF-8'); + $previous = libxml_use_internal_errors(true); + $dom->loadHTML( + '', + LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD + ); + libxml_clear_errors(); + libxml_use_internal_errors($previous); + $root = (new DOMXPath($dom))->query('//*[@id="legal-document-root"]')->item(0); + if (!$root instanceof DOMElement) { + throw new CloudError('正文无法解析', 400); + } + return [$dom, $root]; + } + + private static function unwrap(DOMNode $node): void + { + $parent = $node->parentNode; + if ($parent === null) { + return; + } + while ($node->firstChild !== null) { + $parent->insertBefore($node->firstChild, $node); + } + $parent->removeChild($node); + } + + private static function innerHtml(DOMElement $root): string + { + $html = ''; + foreach ($root->childNodes as $child) { + $html .= $root->ownerDocument->saveHTML($child); + } + return $html; + } + + private static function revisionDto($revision): array + { + return [ + 'id' => (int) $revision->id, + 'version' => (int) $revision->version, + 'title' => (string) $revision->title, + 'effective_date' => (string) $revision->effective_date, + 'published_at' => (string) $revision->published_at, + 'published_by' => (int) $revision->published_by, + ]; + } + + private static function authorize(array $actor, bool $write = false): void + { + if ((int) ($actor['user_id'] ?? 0) < 1) { + throw new CloudError('请先登录', 401); + } + if (!($actor['is_admin'] ?? false)) { + throw new CloudError('需要管理员权限', 403); + } + if ($write && (!($actor['is_super_admin'] ?? false) || !($actor['can_manage'] ?? false))) { + throw new CloudError('只有超级管理员可以编辑和发布法律页面', 403); + } + } + + private static function assertSchema(): void + { + if (!self::hasSchema()) { + throw new CloudError('法律页面数据表尚未安装,请先导入 web/sql/legal_documents.sql', 503); + } + } + + private static function hasSchema(): bool + { + $schema = (new LegalDocument())->getConnection()->getSchemaBuilder(); + return $schema->hasTable('legal_documents') && $schema->hasTable('legal_document_revisions'); + } + + private static function slug($value): string + { + if (!is_string($value) || !array_key_exists($value, self::SLUGS)) { + throw new CloudError('法律页面类型不正确', 400); + } + return $value; + } + + private static function locale($value): string + { + if (!is_string($value) || !array_key_exists($value, self::LOCALES)) { + throw new CloudError('页面语言不正确', 400); + } + return $value; + } + + private static function plainText($value, string $label, int $limit): string + { + if (!is_string($value) || !mb_check_encoding($value, 'UTF-8') + || preg_match('/[\x00-\x1f\x7f]/', $value)) { + throw new CloudError($label . '格式不正确', 400); + } + $value = trim(strip_tags($value)); + if ($value === '' || mb_strlen($value, 'UTF-8') > $limit) { + throw new CloudError($label . '不能为空且最多 ' . $limit . ' 个字符', 400); + } + return $value; + } + + private static function date($value): string + { + if (!is_string($value) || !preg_match('/^\d{4}-\d{2}-\d{2}$/D', $value)) { + throw new CloudError('生效日期格式不正确', 400); + } + $date = \DateTimeImmutable::createFromFormat('!Y-m-d', $value); + if ($date === false || $date->format('Y-m-d') !== $value) { + throw new CloudError('生效日期不存在', 400); + } + return $value; + } + + private static function defaults(string $slug, string $locale): array + { + $content = self::DEFAULT_CONTENT[$locale][$slug] ?? ''; + return [ + 'title' => self::SLUGS[$slug][$locale], + 'content_html' => $content, + 'effective_date' => '2026-10-24', + ]; + } + + private const DEFAULT_CONTENT = [ + 'zh-CN' => [ + 'terms' => <<<'HTML' +

接受与适用范围

当你注册账户、购买或使用 {{site_name}} 提供的云服务器及相关功能时,即表示你已阅读并同意本条款。

+

账户与安全

你应提供真实、准确的信息,并妥善保管密码、验证码和多因素认证凭据。发现异常登录或凭据泄露时,应立即修改密码并联系支持。

+

服务、账单与续费

实例以订单展示的配置、计费周期与流量额度交付。购买与续费分别形成对应的预付费服务周期;账单、到期时间、宽限期及资源释放规则,以结算页和控制台中的明确提示为准。

+

可接受使用规则

不得利用服务实施攻击、欺诈、恶意扫描、垃圾信息传播、侵权分发,或任何违反适用法律的行为。我们可对明显危害平台、网络或第三方安全的资源采取限制措施。

+

暂停、终止与数据处理

未支付续费账单、严重违规或安全风险可能导致网络暂停或服务终止。服务到期后的资源保留和删除期限,以购买时展示的规则为准;资源被永久删除后通常无法恢复。

+

可用性与责任边界

我们会采取合理措施维护服务稳定与安全,但互联网、上游网络、硬件故障和不可抗力可能导致中断。除非另有书面约定,服务按现状提供,责任范围受适用法律限制。

+

条款变更与联系

当产品、法律或运营安排发生变化时,我们可能更新本条款。重要变化将通过站内通知、邮件或页面公告告知。对条款有疑问,可通过控制台工单联系支持。

+HTML, + 'privacy' => <<<'HTML' +

我们收集的信息

包括注册与账户资料、联系方式、订单与支付状态、实例及网络资源标识、登录与安全日志、工单沟通内容,以及你主动提交给我们的其他信息。

+

我们如何使用信息

用于创建和维护账户、交付云服务、处理账单、保障账户和平台安全、响应支持请求、履行法律义务,以及在获得适当授权时改进产品体验。

+

支付与敏感凭据

支付通常由受支持的支付服务商处理,我们仅保存完成订单和对账所必需的状态信息。密码应以不可逆方式处理;验证码、密钥和令牌仅在实现相应安全功能所需的范围内使用。

+

Cookie 与设备信息

我们可能使用必要 Cookie 维持登录状态、保存安全偏好和防止滥用。可选分析功能应在适用地区取得必要同意,并提供清晰的关闭方式。

+

共享与披露

我们不会出售你的个人信息。仅在交付服务所需、获得你的指示、履行法律义务或保护平台与他人合法权益时,向受约束的服务商或主管机构披露必要信息。

+

保存与安全

我们根据服务履行、争议处理、安全审计及法律要求确定保存期限,并采取访问控制、加密、日志审计和最小权限等措施降低未授权访问风险。

+

你的权利

在适用法律允许的范围内,你可以请求访问、更正、导出或删除个人信息,也可以撤回特定同意。部分数据可能因账务、安全或合规义务而需要继续保存。

+

更新与联系

我们可能随业务和法律要求更新本政策,并在生效前提供合理提示。如有隐私问题或权利请求,请通过控制台工单联系我们。

+HTML, + ], + 'en' => [ + 'terms' => <<<'HTML' +

Acceptance and scope

By registering an account, purchasing, or using cloud servers and related features provided by {{site_name}}, you acknowledge that you have read and accepted these terms.

+

Accounts and security

You must provide accurate information and protect passwords, verification codes, and multi-factor authentication credentials. Change your password and contact support promptly if you detect unauthorized access.

+

Services, billing, and renewal

Instances are delivered according to the configuration, billing period, and traffic allowance shown in the order. Purchases and renewals create their corresponding prepaid service periods. The checkout and control panel state the applicable payment, expiry, grace-period, and resource-removal rules.

+

Acceptable use

You must not use the service for attacks, fraud, malicious scanning, spam, unlawful distribution, infringement, or other conduct prohibited by applicable law. We may restrict resources that create a clear risk to the platform, network, or third parties.

+

Suspension, termination, and data

Unpaid renewal invoices, serious violations, or security risks may result in network suspension or service termination. Resource retention and deletion follow the rules shown at purchase. Permanently deleted resources normally cannot be recovered.

+

Availability and liability

We take reasonable measures to maintain service stability and security, but internet conditions, upstream networks, hardware failures, and events beyond reasonable control may cause interruption. Unless agreed otherwise in writing, services are provided as available and liability is limited by applicable law.

+

Changes and contact

We may update these terms when products, laws, or operating arrangements change. Material changes will be communicated through the control panel, email, or a site notice. Contact support through a control-panel ticket if you have questions.

+HTML, + 'privacy' => <<<'HTML' +

Information we collect

This may include registration and account details, contact information, order and payment status, instance and network identifiers, login and security logs, support communications, and other information you choose to provide.

+

How we use information

We use information to create and maintain accounts, deliver cloud services, process billing, protect accounts and the platform, answer support requests, meet legal obligations, and improve the product where appropriate authorization exists.

+

Payments and sensitive credentials

Supported payment providers normally process payment details. We retain only the status information needed for orders and reconciliation. Passwords should be processed irreversibly, while codes, keys, and tokens are used only as needed for their security function.

+

Cookies and device information

Necessary cookies may maintain sessions, preserve security preferences, and prevent abuse. Optional analytics should request any consent required in the applicable region and provide a clear way to disable them.

+

Sharing and disclosure

We do not sell personal information. We disclose only what is necessary to bound providers or authorities when needed to deliver the service, follow your instructions, meet legal obligations, or protect lawful interests.

+

Retention and security

Retention periods reflect service delivery, dispute handling, security auditing, and legal requirements. We use measures such as access controls, encryption, audit logging, and least privilege to reduce unauthorized access risk.

+

Your rights

Subject to applicable law, you may request access, correction, export, or deletion of personal information and may withdraw specific consent. Some records must be retained for billing, security, or compliance obligations.

+

Updates and contact

We may update this policy as the service and legal requirements change, with reasonable notice before material changes take effect. Submit a control-panel ticket for privacy questions or rights requests.

+HTML, + ], + ]; +} diff --git a/web/config/routes.php b/web/config/routes.php index 4488d78e..f6db1981 100644 --- a/web/config/routes.php +++ b/web/config/routes.php @@ -81,6 +81,8 @@ $app = new App($container); // Home $app->get('/', 'App\Controllers\HomeController:index'); +$app->get('/terms', 'App\Controllers\LegalController:terms'); +$app->get('/privacy', 'App\Controllers\LegalController:privacy'); $app->get('/404', 'App\Controllers\HomeController:page404'); $app->get('/405', 'App\Controllers\HomeController:page405'); $app->get('/500', 'App\Controllers\HomeController:page500'); @@ -295,6 +297,12 @@ $app->group('/admin', function () { $this->post('/config/trusted-login-devices/clear', 'App\Controllers\Admin\ConfigController:clearTrustedLoginDevices')->add(new SuperAdmin()); $this->post('/config/login-sessions/clear', 'App\Controllers\Admin\ConfigController:clearLoginSessions')->add(new SuperAdmin()); + // Global legal documents. Content is shared by all configured domains. + $this->get('/legal', 'App\Controllers\Admin\LegalController:index'); + $this->post('/legal/{slug:terms|privacy}/draft', 'App\Controllers\Admin\LegalController:draft')->add(new SuperAdmin()); + $this->post('/legal/{slug:terms|privacy}/publish', 'App\Controllers\Admin\LegalController:publish')->add(new SuperAdmin()); + $this->post('/legal/{slug:terms|privacy}/preview', 'App\Controllers\Admin\LegalController:preview'); + })->add(new Admin()); // API diff --git a/web/public/cloud/account.css b/web/public/cloud/account.css index 49aef3c4..deac54cb 100644 --- a/web/public/cloud/account.css +++ b/web/public/cloud/account.css @@ -1205,36 +1205,29 @@ body.venix-auth .auth-captcha { border-radius: 10px; cursor: pointer; } -body.venix-auth .auth-modal { - position: fixed; - inset: 0; - z-index: 1000; - display: none; - align-items: center; - justify-content: center; - padding: 20px; - background: rgba(5, 17, 30, .66); - backdrop-filter: blur(5px); +body.venix-auth .auth-legal-consent { + display: grid; + grid-template-columns: 18px minmax(0, 1fr); + align-items: start; + gap: 10px; + margin: 0; + color: var(--vu-muted); + font-size: 12px; + line-height: 1.65; + cursor: pointer; } -body.venix-auth .auth-modal[aria-hidden="false"] { display: flex; } -body.venix-auth .auth-modal-panel { - width: min(100%, 620px); - max-height: 82vh; - overflow-y: auto; - padding: 30px; - color: var(--vu-text); - background: var(--vu-panel); - border: 1px solid var(--vu-border); - border-radius: 16px; - box-shadow: 0 28px 80px rgba(4, 17, 31, .24); +body.venix-auth .auth-legal-consent input { + width: 16px; + height: 16px; + margin: 2px 0 0; + accent-color: var(--vu-brand); } -body.venix-auth .auth-modal-actions { - display: flex; - justify-content: flex-end; - gap: 10px; - margin-top: 22px; +body.venix-auth .auth-legal-consent a { + color: var(--vu-brand-strong); + font-weight: 800; + text-decoration: none; } - +body.venix-auth .auth-legal-consent a:hover { text-decoration: underline; } /* Authentication pages retain their optional theme. The logged-in control panel stays on the original VM-panel palette on every route. */ :root[data-bs-theme="dark"] body.venix-auth { @@ -1354,10 +1347,8 @@ body.venix-auth .auth-modal-actions { body.vu-body .vu-support-summary > div:last-child { border-bottom: 0; } body.vu-body .vu-support-message-item { padding: 17px; } body.vu-body .vu-table-footer { align-items: flex-start; flex-direction: column; } - body.vu-body .vu-pay-dialog, - body.venix-auth .auth-modal { align-items: flex-end; padding: 12px; } - body.vu-body .vu-pay-dialog-panel, - body.venix-auth .auth-modal-panel { + body.vu-body .vu-pay-dialog { align-items: flex-end; padding: 12px; } + body.vu-body .vu-pay-dialog-panel { max-height: 91vh; padding: 25px 20px; border-radius: 16px; diff --git a/web/public/theme/venix/css/admin-home.css b/web/public/theme/venix/css/admin-home.css index 44729e7a..09251ebc 100644 --- a/web/public/theme/venix/css/admin-home.css +++ b/web/public/theme/venix/css/admin-home.css @@ -216,6 +216,120 @@ html.admin-sidebar-scroll-locked { width: auto; } +/* Global legal-content editor. */ +.legal-admin-selector { + display: flex; + align-items: flex-end; + gap: 18px; + flex-wrap: wrap; +} + +.legal-admin-selector > div:not(.alert) { + flex: 0 0 auto; +} + +.legal-admin-selector .alert { + min-width: min(100%, 320px); + padding: 11px 14px; +} + +.legal-admin-workspace { + display: grid; + grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); + gap: 16px; + align-items: start; +} + +.legal-editor-toolbar { + min-height: 44px; + padding: 6px; + border: 1px solid #d8e1e8; + border-bottom: 0; + border-radius: 8px 8px 0 0; + background: #f7f9fb; + display: flex; + align-items: center; + gap: 5px; + flex-wrap: wrap; +} + +.legal-editor-toolbar button { + min-width: 34px; + min-height: 31px; + padding: 4px 8px; + border: 0; + border-radius: 6px; + color: #34445a; + background: transparent; + font-size: 12px; +} + +.legal-editor-toolbar button:hover:not(:disabled), +.legal-editor-toolbar button:focus-visible { + color: #087f89; + background: #e1f5f4; +} + +.legal-editor-toolbar > span { + width: 1px; + height: 23px; + margin: 0 3px; + background: #d8e1e8; +} + +.legal-rich-editor { + min-height: 520px; + max-height: 70vh; + padding: 24px; + overflow: auto; + border: 1px solid #d8e1e8; + border-radius: 0 0 8px 8px; + color: #24384c; + background: #fff; + font-size: 14px; + line-height: 1.8; + outline: 0; +} + +.legal-rich-editor[contenteditable="true"]:focus { + border-color: #22aab3; + box-shadow: 0 0 0 3px rgba(34, 170, 179, .12); +} + +.legal-rich-editor h2 { margin: 28px 0 10px; font-size: 22px; } +.legal-rich-editor h3 { margin: 22px 0 8px; font-size: 17px; } +.legal-rich-editor p { margin: 10px 0; } +.legal-rich-editor blockquote { margin: 16px 0; padding: 12px 16px; border-left: 3px solid #17a6ad; background: #edf8f7; } + +.legal-admin-preview { + position: sticky; + top: 86px; +} + +.legal-admin-preview iframe { + width: 100%; + min-height: 650px; + display: block; + border: 1px solid #d8e1e8; + border-radius: 8px; + background: #fff; +} + +@media (max-width: 1199px) { + .legal-admin-workspace { grid-template-columns: 1fr; } + .legal-admin-preview { position: static; } + .legal-admin-preview iframe { min-height: 500px; } +} + +@media (max-width: 575px) { + .legal-admin-selector { align-items: stretch; } + .legal-admin-selector > div:not(.alert), + .legal-admin-selector .btn-group { width: 100%; } + .legal-admin-selector .btn { flex: 1 1 50%; } + .legal-rich-editor { min-height: 430px; padding: 18px; } + .legal-admin-preview iframe { min-height: 460px; } +} + [data-admin-instances] .admin-instance-ip .admin-mono, [data-admin-instance-drawer] .admin-instance-ip .admin-mono { overflow-wrap: anywhere; diff --git a/web/public/theme/venix/css/home.css b/web/public/theme/venix/css/home.css index dd948961..797e36a0 100644 --- a/web/public/theme/venix/css/home.css +++ b/web/public/theme/venix/css/home.css @@ -1,416 +1,448 @@ :root { - --home-ink: #ffffff; - --home-muted: rgba(255, 255, 255, 0.82); - --home-line: rgba(255, 255, 255, 0.26); - --home-accent: #ffffff; - --home-dark: #173c72; -} - -* { - box-sizing: border-box; -} - -html { - min-height: 100%; -} - + --landing-navy: #071726; + --landing-navy-soft: #0b2236; + --landing-ink: #102a3e; + --landing-muted: #657b8b; + --landing-teal: #16b8ad; + --landing-teal-bright: #2de2c2; + --landing-line: #d7e2e4; + --landing-paper: #f4f8f7; + --landing-white: #fff; +} + +* { box-sizing: border-box; } +html { min-height: 100%; scroll-behavior: smooth; } body.venix-home { - height: 100vh; - height: 100svh; + min-width: 320px; + min-height: 100vh; margin: 0; - color: var(--home-ink); - background: - linear-gradient(45deg, rgba(42, 27, 161, 0.7), rgba(29, 210, 177, 0.7) 100%), - url("/theme/venix/images/home.jpeg") center center / cover no-repeat fixed; - background-color: var(--home-dark); - font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; - display: flex; - flex-direction: column; - overflow: hidden; -} - -body.venix-home::before { - content: none; -} - -a { - color: inherit; -} - -.home-nav, -.home-footer, -.home-hero { - width: min(1180px, calc(100% - 40px)); + color: var(--landing-ink); + background: var(--landing-paper); + font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; + -webkit-font-smoothing: antialiased; +} +body.venix-home.venix-landing { overflow-x: hidden; } +body.venix-home a { color: inherit; } +body.venix-home ::selection { color: #04191b; background: var(--landing-teal-bright); } +.landing-shell { min-height: 100vh; overflow: hidden; } + +.landing-site-header { + position: absolute; + inset: 0 0 auto; + z-index: 30; + width: min(1240px, calc(100% - 48px)); + min-height: 88px; margin: 0 auto; - position: relative; - z-index: 1; -} - -.home-nav { - flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; - gap: 20px; - padding: 26px 0; -} - -main { - flex: 1 1 auto; - min-height: 0; - display: flex; -} - -.home-brand { - display: inline-flex; - align-items: center; - gap: 12px; + gap: 28px; color: #fff; - font-size: 20px; - font-weight: 900; - text-decoration: none; - text-shadow: 0 14px 34px rgba(0, 0, 0, 0.22); -} - -.home-brand img { - width: 38px; - height: 38px; - border-radius: 8px; -} - -.home-nav nav { - display: flex; - align-items: center; - justify-content: flex-end; - gap: 10px; - flex-wrap: wrap; } - -.home-nav a { - min-height: 38px; +.landing-site-header::before { + content: ""; + position: fixed; + z-index: -1; + inset: 0 0 auto; + height: 88px; + background: rgba(7, 23, 38, .94); + border-bottom: 1px solid rgba(255, 255, 255, .06); + backdrop-filter: blur(18px); +} +.landing-brand { display: inline-flex; align-items: center; - padding: 0 12px; - border-radius: 8px; - color: rgba(255, 255, 255, 0.84); - font-size: 14px; - font-weight: 800; + gap: 11px; + color: inherit; + font-size: 19px; + font-weight: 850; + letter-spacing: -.03em; text-decoration: none; + white-space: nowrap; } - -.home-nav a:hover { - color: #fff; - background: rgba(255, 255, 255, 0.12); -} - -.home-nav-button, -.home-button { - color: #253047 !important; - background: #fff; -} - -.home-hero { - flex: 1 1 auto; - min-height: 0; - display: flex; - align-items: center; - justify-content: flex-start; - padding: 34px 0 46px clamp(150px, 16vw, 280px); -} - -.home-hero-copy { - max-width: 760px; - margin-left: 0; - animation: homeFadeIn 0.78s ease both; -} - -.home-kicker { - display: inline-flex; - align-items: center; - min-height: 30px; - margin: 0 0 18px; - padding: 0 12px; - border: 1px solid rgba(255, 255, 255, 0.25); - border-radius: 999px; - color: var(--home-accent); - background: rgba(255, 255, 255, 0.1); - font-size: 12px; - font-weight: 900; - letter-spacing: 0; - text-transform: uppercase; - backdrop-filter: blur(10px); -} - -.home-hero h1 { - margin: 0; - color: #fff; - font-size: clamp(48px, 7.6vw, 96px); - line-height: 0.95; - font-weight: 900; - letter-spacing: 0; - text-shadow: 0 24px 60px rgba(0, 0, 0, 0.26); -} - -.home-lead { - max-width: 660px; - margin: 26px 0 0; - color: var(--home-muted); - font-size: clamp(15px, 1.7vw, 19px); - line-height: 1.85; - font-weight: 500; - text-shadow: 0 16px 38px rgba(0, 0, 0, 0.24); -} - -.home-actions { - display: flex; - align-items: center; - gap: 12px; - flex-wrap: wrap; - margin-top: 36px; -} - -.home-button { +.landing-brand-mark { + position: relative; + width: 31px; + height: 31px; + display: inline-block; + flex: 0 0 auto; + color: var(--landing-teal-bright); + transform: rotate(45deg); +} +.landing-brand-mark i { + position: absolute; + display: block; + border: 6px solid currentColor; + border-radius: 4px; +} +.landing-brand-mark i:first-child { inset: 2px 11px 11px 2px; } +.landing-brand-mark i:last-child { inset: 11px 2px 2px 11px; opacity: .58; } +.landing-main-nav { display: flex; align-items: center; justify-content: center; gap: 34px; } +.landing-main-nav a { + position: relative; + color: rgba(255, 255, 255, .68); + font-size: 13px; + font-weight: 680; + text-decoration: none; + transition: color .2s ease; +} +.landing-main-nav a:hover, +.landing-main-nav a.is-active { color: #fff; } +.landing-main-nav a.is-active::after { + content: ""; + position: absolute; + right: 0; + bottom: -10px; + left: 0; + height: 2px; + background: var(--landing-teal-bright); +} +.landing-nav-actions { display: flex; align-items: center; gap: 16px; } +.landing-nav-login { color: rgba(255, 255, 255, .8); font-size: 13px; font-weight: 750; text-decoration: none; } +.landing-nav-login:hover { color: #fff; } +.landing-button { min-height: 48px; + padding: 0 21px; + border: 1px solid transparent; + border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; - gap: 8px; - padding: 0 18px; - border-radius: 8px; - font-size: 14px; - font-weight: 900; - text-decoration: none; - box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18); -} - -.home-button-ghost { - color: #fff !important; - background: rgba(255, 255, 255, 0.12); - border: 1px solid var(--home-line); - box-shadow: none; - backdrop-filter: blur(12px); -} - -.home-footer { - flex: 0 0 auto; - display: flex; - justify-content: center; - gap: 14px; - padding: 14px 0 20px; - color: rgba(255, 255, 255, 0.72); - font-size: 14px; - font-weight: 700; -} - -.home-footer a { - color: rgba(255, 255, 255, 0.78); + gap: 10px; + font-size: 13px; + font-weight: 800; text-decoration: none; + transition: transform .2s ease, box-shadow .2s ease, background .2s ease; +} +.landing-button:hover { transform: translateY(-2px); } +.landing-button-small { min-height: 42px; padding: 0 17px; border-radius: 10px; } +.landing-button-primary { color: #04191b !important; background: var(--landing-teal-bright); box-shadow: 0 16px 38px rgba(45, 226, 194, .2); } +.landing-button-light { color: var(--landing-navy) !important; background: #fff; } +.landing-mobile-menu { + width: 42px; + height: 42px; + display: none; + place-items: center; + padding: 0; + border: 0; + border-radius: 9px; + color: #fff; + background: rgba(255, 255, 255, .08); + font-size: 23px; } -body.venix-home > main.home-error { - width: 100%; - min-height: 100vh; - min-height: 100svh; - margin: 0; - padding: 24px; +.landing-hero { + position: relative; + min-height: 690px; + padding: 168px max(24px, calc((100vw - 1240px) / 2)) 86px; + color: #fff; + background: var(--landing-navy); display: grid; - place-items: center; + grid-template-columns: .88fr 1.12fr; + align-items: center; + gap: 56px; + isolation: isolate; +} +.landing-hero::before { + content: ""; + position: absolute; + z-index: -1; + width: 670px; + height: 670px; + top: -210px; + right: -240px; + border-radius: 50%; + background: radial-gradient(circle, rgba(29, 190, 179, .17), transparent 68%); +} +.landing-hero::after { + content: ""; + position: absolute; + z-index: -1; + inset: 0; + opacity: .16; + background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); + background-size: 72px 72px; + mask-image: linear-gradient(90deg, transparent, #000 55%); +} +.landing-hero-copy { position: relative; z-index: 4; } +.landing-eyebrow { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; } +.landing-eyebrow > span { width: 7px; height: 7px; border-radius: 50%; background: var(--landing-teal-bright); box-shadow: 0 0 0 5px rgba(45, 226, 194, .12); } +.landing-hero h1 { margin: 24px 0 0; font-size: clamp(52px, 6.4vw, 86px); line-height: .98; font-weight: 820; letter-spacing: -.065em; } +.landing-hero h1 em { color: var(--landing-teal-bright); font-style: normal; } +.landing-hero-copy > p { max-width: 540px; margin: 27px 0 0; color: rgba(255,255,255,.67); font-size: 16px; line-height: 1.85; } +.landing-hero-actions { margin-top: 36px; display: flex; align-items: center; flex-wrap: wrap; gap: 24px; } +.landing-text-link { display: inline-flex; align-items: center; gap: 14px; color: rgba(255,255,255,.78); font-size: 13px; font-weight: 750; text-decoration: none; } +.landing-text-link span { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; } +.landing-hero-proof { margin-top: 45px; display: flex; align-items: center; gap: 12px; } +.landing-proof-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid var(--landing-navy); border-radius: 50%; color: var(--landing-navy); background: #d9f7f2; } +.landing-hero-proof > span:last-child { display: flex; flex-direction: column; gap: 3px; } +.landing-hero-proof strong { font-size: 12px; } +.landing-hero-proof small { color: rgba(255,255,255,.44); font-size: 10px; } + +.landing-console { position: relative; - z-index: 1; -} - -.home-error-card { - width: min(760px, 100%); - margin: auto; - padding: clamp(30px, 6vw, 58px); - border: 1px solid rgba(255, 255, 255, 0.22); - border-radius: 8px; - background: rgba(255, 255, 255, 0.1); - box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24); - text-align: center; - backdrop-filter: blur(14px); - animation: homeFadeIn 0.78s ease both; -} - -.home-error-code { - margin: 4px 0 14px; - color: rgba(255, 255, 255, 0.26); - font-size: clamp(84px, 16vw, 160px); - line-height: 0.86; - font-weight: 900; -} - -.home-error-card h1 { - margin: 0; + z-index: 3; + width: 100%; + min-height: 450px; + border: 1px solid rgba(255,255,255,.12); + border-radius: 18px; + color: #d8e7ee; + background: #0b2031; + box-shadow: 0 45px 100px rgba(0,0,0,.34); + transform: perspective(1200px) rotateY(-4deg) rotateX(1deg); +} +.landing-console-top { height: 48px; padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 16px; } +.landing-console-top > span { display: flex; gap: 5px; } +.landing-console-top > span i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.18); } +.landing-console-top b { margin-right: auto; font-size: 10px; letter-spacing: .04em; } +.landing-console-top em { padding: 4px 7px; border-radius: 4px; color: var(--landing-teal-bright); background: rgba(45,226,194,.08); font-size: 8px; font-style: normal; font-weight: 900; letter-spacing: .14em; } +.landing-console-body { min-height: 400px; display: grid; grid-template-columns: 58px 1fr; } +.landing-console-body aside { padding: 16px 10px; border-right: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; align-items: center; gap: 10px; } +.landing-console-body aside span { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; color: rgba(255,255,255,.34); } +.landing-console-body aside span.is-active { color: var(--landing-teal-bright); background: rgba(45,226,194,.11); } +.landing-console-main { padding: 24px; overflow: hidden; } +.landing-console-heading { display: flex; align-items: flex-end; justify-content: space-between; } +.landing-console-heading > div { display: flex; flex-direction: column; gap: 5px; } +.landing-console-heading small { color: rgba(255,255,255,.44); font-size: 10px; } +.landing-console-heading strong { font-size: 31px; } +.landing-console-heading > span { padding: 6px 9px; border-radius: 6px; color: #8ef0d9; background: rgba(44,203,167,.1); font-size: 9px; font-weight: 700; } +.landing-console-heading > span i, +.landing-instance-row > i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #2dd29a; box-shadow: 0 0 10px #2dd29a; } +.landing-chart { position: relative; height: 155px; margin-top: 22px; padding: 14px 14px 0; border: 1px solid rgba(255,255,255,.06); border-radius: 11px; background: rgba(255,255,255,.02); overflow: hidden; } +.landing-chart > div { display: flex; justify-content: space-between; color: rgba(255,255,255,.45); font-size: 9px; } +.landing-chart > div b { color: #fff; } +.landing-chart svg { position: absolute; inset: 40px 0 0; width: 100%; height: 115px; } +.landing-chart .area { fill: url(#landingArea); } +.landing-chart .line { fill: none; stroke: var(--landing-teal-bright); stroke-width: 2; vector-effect: non-scaling-stroke; } +.landing-instance-row { min-height: 57px; margin-top: 10px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.06); border-radius: 10px; background: rgba(255,255,255,.025); display: grid; grid-template-columns: 34px 1fr auto 10px; align-items: center; gap: 11px; } +.landing-instance-row > span { width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; color: var(--landing-teal-bright); background: rgba(45,226,194,.12); font-size: 8px; font-weight: 900; } +.landing-instance-row > span.is-alt { color: #aab8ff; background: rgba(139,151,255,.12); } +.landing-instance-row > div { display: flex; flex-direction: column; gap: 4px; } +.landing-instance-row strong { font-size: 10px; } +.landing-instance-row small, +.landing-instance-row code { color: rgba(255,255,255,.34); font-size: 8px; } +.landing-instance-row > i { margin: 0; } +.landing-float { position: absolute; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(12,38,57,.9); box-shadow: 0 22px 48px rgba(0,0,0,.3); backdrop-filter: blur(15px); } +.landing-float-traffic { right: -35px; bottom: 65px; width: 150px; padding: 14px; display: flex; flex-direction: column; gap: 7px; } +.landing-float-traffic > span { color: rgba(255,255,255,.48); font-size: 8px; } +.landing-float-traffic strong { font-size: 20px; } +.landing-float-traffic strong small { font-size: 9px; } +.landing-float-traffic > i { height: 4px; border-radius: 5px; background: rgba(255,255,255,.1); overflow: hidden; } +.landing-float-traffic > i b { display: block; width: 68%; height: 100%; background: var(--landing-teal-bright); } +.landing-float-traffic em { color: rgba(255,255,255,.38); font-size: 8px; font-style: normal; } +.landing-float-ready { top: 75px; left: -25px; padding: 11px 13px; display: flex; align-items: center; gap: 9px; } +.landing-float-ready > i { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: var(--landing-navy); background: var(--landing-teal-bright); } +.landing-float-ready > span { display: flex; flex-direction: column; gap: 3px; } +.landing-float-ready strong { font-size: 9px; } +.landing-float-ready small { color: rgba(255,255,255,.38); font-size: 7px; } + +.landing-signal { min-height: 112px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); color: #d6e2e6; background: #0a2032; display: flex; align-items: center; justify-content: space-between; gap: 40px; } +.landing-signal p { margin: 0; color: rgba(255,255,255,.38); font-size: 10px; font-weight: 750; letter-spacing: .12em; } +.landing-signal > div { display: flex; gap: clamp(20px, 4vw, 58px); } +.landing-signal span { display: inline-flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 700; } +.landing-signal span i { color: var(--landing-teal-bright); font-size: 18px; } + +.landing-section { width: min(1240px, calc(100% - 48px)); margin: 0 auto; } +.landing-capabilities { padding-top: 122px; padding-bottom: 132px; } +.landing-section-heading { display: grid; grid-template-columns: .65fr 1.3fr .8fr; gap: 46px; align-items: start; } +.landing-section-heading > div { display: flex; align-items: center; gap: 16px; } +.landing-section-heading > div span { font-size: 12px; font-weight: 850; } +.landing-section-heading > div p { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .12em; } +.landing-section-heading h2 { margin: 0; font-size: clamp(32px, 4.2vw, 58px); line-height: 1.08; letter-spacing: -.055em; } +.landing-section-heading > p { margin: 4px 0 0; color: var(--landing-muted); font-size: 14px; line-height: 1.85; } +.landing-feature-grid { margin-top: 74px; border-top: 1px solid #cfdbdd; display: grid; grid-template-columns: repeat(3, 1fr); } +.landing-feature-grid article { position: relative; min-height: 350px; padding: 34px; border-right: 1px solid #cfdbdd; } +.landing-feature-grid article:last-child { border-right: 0; } +.landing-feature-grid article > span { position: absolute; top: 24px; right: 24px; color: #91a1a8; font-size: 10px; font-weight: 750; } +.landing-feature-grid article > div { width: 49px; height: 49px; display: grid; place-items: center; border-radius: 13px; color: var(--landing-teal); background: #dbefeb; font-size: 23px; } +.landing-feature-grid h3 { margin: 62px 0 14px; font-size: 25px; letter-spacing: -.04em; } +.landing-feature-grid p { max-width: 290px; margin: 0; color: var(--landing-muted); font-size: 13px; line-height: 1.75; } +.landing-feature-grid a { position: absolute; bottom: 36px; left: 34px; display: inline-flex; align-items: center; gap: 8px; color: #1f5b61; font-size: 11px; font-weight: 800; text-decoration: none; } + +.landing-workflow { margin-bottom: 132px; padding: 78px; border-radius: 24px; color: #dce8eb; background: #0c2636; display: grid; grid-template-columns: .95fr 1.05fr; gap: 85px; } +.landing-workflow-copy > span { color: var(--landing-teal-bright); font-size: 10px; font-weight: 850; letter-spacing: .14em; } +.landing-workflow h2 { margin: 18px 0; color: #fff; font-size: clamp(34px, 4.3vw, 55px); line-height: 1.08; letter-spacing: -.055em; } +.landing-workflow-copy p { margin: 0; color: rgba(255,255,255,.54); font-size: 14px; line-height: 1.85; } +.landing-workflow ol { margin: 0; padding: 0; list-style: none; border-top: 1px solid rgba(255,255,255,.12); } +.landing-workflow li { min-height: 90px; border-bottom: 1px solid rgba(255,255,255,.12); display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 18px; } +.landing-workflow li > span { color: var(--landing-teal-bright); font: 10px/1 ui-monospace, monospace; } +.landing-workflow li > div { display: flex; flex-direction: column; gap: 7px; } +.landing-workflow li strong { color: #fff; font-size: 15px; } +.landing-workflow li small { color: rgba(255,255,255,.43); font-size: 11px; } + +.landing-cta { position: relative; min-height: 340px; margin: 0 32px; padding: 70px max(24px, calc((100vw - 1120px) / 2)); border-radius: 25px; color: #fff; background: #0a3341; display: flex; align-items: center; justify-content: space-between; gap: 60px; overflow: hidden; } +.landing-cta::after { content: ""; position: absolute; width: 440px; height: 440px; right: -120px; bottom: -260px; border: 1px solid rgba(45,226,194,.28); border-radius: 50%; box-shadow: 0 0 0 60px rgba(45,226,194,.03), 0 0 0 120px rgba(45,226,194,.02); } +.landing-cta h2 { margin: 20px 0 11px; font-size: clamp(31px, 4vw, 52px); letter-spacing: -.05em; } +.landing-cta p { margin: 0; color: rgba(255,255,255,.55); font-size: 14px; } +.landing-cta .landing-button { position: relative; z-index: 2; flex: 0 0 auto; } + +.landing-site-footer { padding: 76px max(24px, calc((100vw - 1240px) / 2)) 55px; color: #d8e5e8; background: var(--landing-navy); display: grid; grid-template-columns: 1.5fr 1fr; gap: 50px; } +.landing-footer-brand p { margin: 22px 0 0; color: inherit; opacity: .58; font-size: 13px; } +.landing-footer-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 50px; } +.landing-footer-links > div { display: flex; flex-direction: column; gap: 12px; } +.landing-footer-links strong { margin-bottom: 5px; font-size: 11px; letter-spacing: .12em; } +.landing-footer-links a { color: inherit; opacity: .58; font-size: 13px; text-decoration: none; } +.landing-footer-links a:hover { opacity: 1; } +.landing-footer-bottom { grid-column: 1 / -1; margin-top: 22px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.16); display: flex; justify-content: space-between; gap: 20px; color: inherit; opacity: .48; font-size: 11px; } + +/* Published legal pages share the landing-page visual system. */ +.legal-page { min-height: 900px; padding-bottom: 110px; background: var(--landing-paper); } +.legal-hero { min-height: 410px; padding: 158px max(24px, calc((100vw - 1160px) / 2)) 72px; color: #fff; background: var(--landing-navy); display: flex; align-items: flex-end; justify-content: space-between; gap: 70px; } +.legal-hero > div > span { display: block; margin-bottom: 23px; color: var(--landing-teal-bright); font-size: 9px; font-weight: 850; letter-spacing: .2em; } +.legal-hero h1 { margin: 0; font-size: clamp(54px, 8vw, 100px); line-height: .9; letter-spacing: -.07em; } +.legal-hero p { margin: 24px 0 0; color: rgba(255,255,255,.56); font-size: 15px; } +.legal-hero dl { min-width: 280px; margin: 0; } +.legal-hero dl > div { padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.2); display: flex; justify-content: space-between; gap: 25px; } +.legal-hero dt { color: rgba(255,255,255,.45); font-size: 10px; } +.legal-hero dd { margin: 0; font-size: 10px; font-weight: 800; } +.legal-fallback-notice { width: min(1160px, calc(100% - 48px)); margin: 42px auto 70px; padding: 22px; border: 1px solid #acdcd4; color: #176c6c; background: #e2f5f1; display: flex; align-items: flex-start; gap: 15px; } +.legal-fallback-notice > i { font-size: 24px; } +.legal-fallback-notice p { margin: 0; display: flex; flex-direction: column; gap: 6px; } +.legal-fallback-notice strong { font-size: 11px; } +.legal-fallback-notice span { max-width: 850px; opacity: .7; font-size: 11px; line-height: 1.7; } +.legal-layout { width: min(1160px, calc(100% - 48px)); margin: 82px auto 0; display: grid; grid-template-columns: 260px 1fr; gap: 80px; align-items: start; } +.legal-fallback-notice + .legal-layout { margin-top: 0; } +.legal-layout aside { position: sticky; top: 116px; padding: 25px 0; border-top: 2px solid #173044; display: flex; flex-direction: column; } +.legal-layout aside > span { margin-bottom: 15px; color: #7a8d99; font-size: 9px; font-weight: 800; letter-spacing: .15em; } +.legal-layout aside a { padding: 10px 0; display: flex; gap: 12px; color: #718591; font-size: 11px; line-height: 1.45; text-decoration: none; } +.legal-layout aside a:hover { color: #153447; } +.legal-layout aside a.is-subsection { padding-left: 14px; } +.legal-layout aside b { color: #9aacb4; font-family: ui-monospace, monospace; font-weight: 500; } +.legal-content { border-top: 1px solid var(--landing-line); } +.legal-content h2, +.legal-content h3 { scroll-margin-top: 112px; } +.legal-content h2 { margin: 0; padding: 45px 0 0; color: #173044; font-size: 24px; letter-spacing: -.04em; } +.legal-content h3 { margin: 0; padding: 32px 0 0; color: #24475a; font-size: 18px; } +.legal-content p, +.legal-content ul, +.legal-content ol, +.legal-content blockquote { color: #607783; font-size: 14px; line-height: 1.95; } +.legal-content p { margin: 17px 0 0; padding-bottom: 45px; border-bottom: 1px solid var(--landing-line); } +.legal-content h3 + p { padding-bottom: 30px; } +.legal-content ul, +.legal-content ol { margin: 18px 0 40px; padding-left: 24px; } +.legal-content blockquote { margin: 20px 0 40px; padding: 18px 22px; border-left: 3px solid var(--landing-teal); background: #e7f4f1; } +.legal-content div { margin: 0; } +.legal-contact { width: min(1160px, calc(100% - 48px)); min-height: 230px; margin: 100px auto 0; padding: 44px; color: #fff; background: #0a3341; display: flex; align-items: center; justify-content: space-between; gap: 40px; } +.legal-contact span { color: var(--landing-teal-bright); font-size: 10px; font-weight: 800; letter-spacing: .12em; } +.legal-contact h2 { margin: 13px 0 0; font-size: clamp(28px, 3.5vw, 42px); letter-spacing: -.045em; } + +/* Standalone error pages retain a compact full-screen treatment. */ +body.venix-home:not(.venix-landing) { color: #fff; - font-size: clamp(34px, 6vw, 58px); - line-height: 1.05; - font-weight: 900; - letter-spacing: 0; - text-shadow: 0 24px 60px rgba(0, 0, 0, 0.24); -} - -.home-error-card p:not(.home-kicker) { - max-width: 560px; - margin: 20px auto 0; - color: var(--home-muted); - font-size: 17px; - line-height: 1.8; - font-weight: 600; -} - -.home-error-card .home-actions { - justify-content: center; -} - -@keyframes homeFadeIn { - from { - opacity: 0; - transform: translate3d(-24px, 10px, 0); - } - - to { - opacity: 1; - transform: translate3d(0, 0, 0); - } -} - -@media (max-width: 900px) { - body.venix-home { - background: - linear-gradient(45deg, rgba(42, 27, 161, 0.74), rgba(29, 210, 177, 0.72) 100%), - url("/theme/venix/images/home.jpeg") center center / cover no-repeat fixed; - } - - .home-nav { - align-items: center; - flex-direction: row; - padding: 18px 0; - } - - .home-nav nav { - justify-content: flex-end; - } - - .home-hero { - min-height: 0; - padding: 18px 0 26px clamp(18px, 4vw, 36px); - } - - .home-hero-copy { - width: 100%; - max-width: 620px; - margin: 0 auto; - text-align: center; - } - - .home-hero h1 { - font-size: clamp(34px, 10vw, 60px); - } - - .home-lead { - margin-left: auto; - margin-right: auto; - } - - body.venix-home > main.home-error { - padding: 22px 0 26px; - } - - .home-actions { - justify-content: center; - } - - .home-lead { - margin-top: 18px; - font-size: 14px; - line-height: 1.7; - } - - .home-actions { - margin-top: 24px; - } -} - -@media (max-width: 520px) { - .home-nav, - .home-footer, - .home-hero { - width: min(100% - 28px, 1180px); - } - - .home-nav nav { - width: auto; - gap: 6px; - } - - .home-nav a { - min-height: 34px; - padding: 0 9px; - font-size: 13px; - } - - .home-brand { - gap: 8px; - font-size: 16px; - } - - .home-brand img { - width: 30px; - height: 30px; - } - - .home-kicker { - min-height: 28px; - margin-bottom: 14px; - font-size: 11px; - } - - .home-actions { - display: flex; - justify-content: center; - gap: 10px; - } - - .home-button { - width: auto; - min-width: 132px; - } - - .home-hero { - padding-left: 0; - padding-right: 0; - } - - body.venix-home > main.home-error { - padding: 14px; - } - - .home-error-card { - padding: 26px 18px; - } - - .home-footer { - padding: 8px 0 14px; - font-size: 12px; - } -} - -@media (max-height: 680px) and (max-width: 520px) { - .home-kicker { - display: none; - } - - .home-lead { - margin-top: 14px; - line-height: 1.55; - } - - .home-actions { - margin-top: 18px; - } - - .home-button { - min-height: 42px; + background: radial-gradient(circle at 75% 15%, rgba(45,226,194,.16), transparent 35%), var(--landing-navy); +} +body.venix-home > main.home-error { width: 100%; min-height: 100vh; min-height: 100svh; margin: 0; padding: 24px; display: grid; place-items: center; } +.home-error-card { width: min(760px, 100%); padding: clamp(30px, 6vw, 58px); border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.06); box-shadow: 0 30px 90px rgba(0,0,0,.24); text-align: center; backdrop-filter: blur(14px); } +.home-error-code { margin: 4px 0 14px; color: rgba(255,255,255,.2); font-size: clamp(84px,16vw,160px); line-height: .86; font-weight: 900; } +.home-error-card h1 { margin: 0; color: #fff; font-size: clamp(34px,6vw,58px); line-height: 1.05; } +.home-error-card p:not(.home-kicker) { max-width: 560px; margin: 20px auto 0; color: rgba(255,255,255,.68); font-size: 17px; line-height: 1.8; } +.home-error-card .home-actions { margin-top: 28px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; } +.home-error-card .home-button { min-height: 46px; padding: 0 18px; border-radius: 10px; color: var(--landing-navy); background: var(--landing-teal-bright); display: inline-flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; } +.home-error-card .home-button-ghost { color: #fff; border: 1px solid rgba(255,255,255,.2); background: transparent; } +.home-error-card .home-kicker { color: var(--landing-teal-bright); font-size: 11px; font-weight: 800; letter-spacing: .14em; } + +@media (max-width: 1050px) { + .landing-main-nav { gap: 18px; } + .landing-hero { grid-template-columns: 1fr; padding-top: 145px; } + .landing-hero-copy { max-width: 750px; } + .landing-console { max-width: 780px; margin: 10px auto 0; transform: none; } + .landing-signal { align-items: flex-start; flex-direction: column; padding-top: 28px; padding-bottom: 28px; } + .landing-signal > div { width: 100%; justify-content: space-between; flex-wrap: wrap; } + .landing-section-heading { grid-template-columns: .45fr 1.15fr; } + .landing-section-heading > p { grid-column: 2; } + .landing-workflow { padding: 58px; grid-template-columns: 1fr; gap: 45px; } +} + +@media (max-width: 820px) { + .landing-site-header { width: min(100% - 32px, 1240px); } + .landing-main-nav, + .landing-nav-actions { display: none; } + .landing-mobile-menu { display: grid; } + .landing-site-header.is-menu-open { align-items: flex-start; } + .landing-site-header.is-menu-open .landing-main-nav { + position: absolute; + top: 74px; + right: 0; + left: 0; + padding: 16px; + border: 1px solid rgba(255,255,255,.1); + border-radius: 12px; + background: #0b2236; + box-shadow: 0 20px 55px rgba(0,0,0,.28); + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 4px; } + .landing-site-header.is-menu-open .landing-main-nav a { padding: 12px; border-radius: 8px; } + .landing-site-header.is-menu-open .landing-main-nav a:hover { background: rgba(255,255,255,.06); } + .landing-site-header.is-menu-open .landing-main-nav a.is-active::after { display: none; } + .landing-hero { gap: 40px; } + .landing-feature-grid { grid-template-columns: 1fr; } + .landing-feature-grid article { min-height: 300px; border-right: 0; border-bottom: 1px solid #cfdbdd; } + .landing-feature-grid article:last-child { border-bottom: 0; } + .landing-cta { align-items: flex-start; flex-direction: column; margin: 0 16px; } + .landing-site-footer { grid-template-columns: 1fr; padding-top: 62px; } + .legal-hero { align-items: flex-start; flex-direction: column; } + .legal-hero dl { width: 100%; } + .legal-layout { grid-template-columns: 1fr; gap: 28px; } + .legal-layout aside { position: static; display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 18px; } + .legal-layout aside > span { grid-column: 1 / -1; } +} + +@media (max-width: 560px) { + .landing-site-header { min-height: 76px; } + .landing-site-header::before { height: 76px; } + .landing-brand { font-size: 16px; } + .landing-brand-mark { width: 27px; height: 27px; } + .landing-hero { min-height: auto; padding: 126px 18px 66px; } + .landing-hero h1 { font-size: clamp(43px, 13vw, 63px); } + .landing-hero-copy > p { font-size: 14px; line-height: 1.75; } + .landing-hero-actions { align-items: stretch; flex-direction: column; gap: 14px; } + .landing-hero-actions .landing-button { width: 100%; } + .landing-text-link { justify-content: center; } + .landing-console { min-height: 385px; } + .landing-console-body { min-height: 335px; grid-template-columns: 46px 1fr; } + .landing-console-body aside { padding: 12px 5px; } + .landing-console-body aside span { width: 31px; height: 31px; } + .landing-console-main { padding: 18px 12px; } + .landing-chart { height: 130px; } + .landing-instance-row { grid-template-columns: 31px 1fr 8px; gap: 8px; } + .landing-instance-row code { display: none; } + .landing-float { display: none; } + .landing-signal > div { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; } + .landing-section { width: min(100% - 32px, 1240px); } + .landing-capabilities { padding-top: 88px; padding-bottom: 88px; } + .landing-section-heading { grid-template-columns: 1fr; gap: 25px; } + .landing-section-heading > p { grid-column: auto; } + .landing-feature-grid { margin-top: 48px; } + .landing-feature-grid article { padding: 28px 18px; } + .landing-feature-grid article > span { right: 18px; } + .landing-feature-grid article a { left: 18px; } + .landing-workflow { width: calc(100% - 32px); margin-bottom: 88px; padding: 36px 22px; border-radius: 18px; } + .landing-cta { min-height: 380px; padding: 50px 24px; border-radius: 18px; } + .landing-cta .landing-button { width: 100%; } + .landing-site-footer { padding: 58px 18px 32px; gap: 36px; } + .landing-footer-links { gap: 24px; } + .landing-footer-bottom { align-items: flex-start; flex-direction: column; } + .legal-hero { min-height: 410px; padding: 128px 18px 52px; gap: 38px; } + .legal-hero h1 { font-size: clamp(50px, 17vw, 74px); } + .legal-fallback-notice, + .legal-layout, + .legal-contact { width: calc(100% - 32px); } + .legal-fallback-notice { margin-top: 28px; margin-bottom: 48px; } + .legal-layout { margin-top: 52px; } + .legal-fallback-notice + .legal-layout { margin-top: 0; } + .legal-layout aside { grid-template-columns: 1fr; } + .legal-content h2 { padding-top: 36px; font-size: 22px; } + .legal-content p { padding-bottom: 36px; } + .legal-contact { margin-top: 70px; padding: 32px 24px; align-items: stretch; flex-direction: column; } + .legal-contact .landing-button { width: 100%; } + body.venix-home > main.home-error { padding: 14px; } + .home-error-card { padding: 28px 18px; } +} + +@media (prefers-reduced-motion: reduce) { + html { scroll-behavior: auto; } + .landing-button { transition: none; } } diff --git a/web/public/theme/venix/js/admin-legal.js b/web/public/theme/venix/js/admin-legal.js new file mode 100644 index 00000000..98a788ac --- /dev/null +++ b/web/public/theme/venix/js/admin-legal.js @@ -0,0 +1,180 @@ +(function () { + 'use strict'; + + var root = document.querySelector('[data-legal-editor]'); + var form = document.getElementById('legal-form'); + if (!root || !form) return; + + var slug = root.dataset.slug; + var locale = root.dataset.locale; + var canManage = root.dataset.canManage === '1'; + var title = document.getElementById('legal-title'); + var date = document.getElementById('legal-effective-date'); + var editor = document.getElementById('legal-content'); + var version = document.getElementById('legal-draft-version'); + var feedback = document.getElementById('legal-feedback'); + var frame = document.getElementById('legal-preview-frame'); + var saveButton = document.getElementById('legal-save'); + var publishButton = document.getElementById('legal-publish'); + var previewTimer = null; + var previewSequence = 0; + var busy = false; + var uncertain = false; + var initialSnapshot = snapshot(); + + function snapshot() { + return JSON.stringify([title.value, date.value, editor.innerHTML, version.value]); + } + + function inform(message, state) { + feedback.textContent = message; + feedback.className = 'admin-config-status' + (state ? ' is-' + state : ''); + } + + function setControls() { + var locked = !canManage || busy || uncertain; + saveButton.disabled = locked; + publishButton.disabled = locked; + title.readOnly = locked; + date.readOnly = locked; + editor.contentEditable = locked ? 'false' : 'true'; + root.querySelectorAll('[data-legal-command]').forEach(function (button) { + button.disabled = locked; + }); + } + + function payload(includeVersion) { + var values = new URLSearchParams(); + values.set('locale', locale); + values.set('title', title.value); + values.set('effective_date', date.value); + values.set('content_html', editor.innerHTML); + if (includeVersion) values.set('draft_version', version.value); + return values; + } + + function escapeHtml(value) { + return String(value).replace(/[&<>"']/g, function (character) { + return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[character]; + }); + } + + function previewDocument(documentData) { + var content = documentData && typeof documentData.content_html === 'string' + ? documentData.content_html : '

预览暂不可用。

'; + var pageTitle = documentData && typeof documentData.title === 'string' + ? documentData.title : ''; + var effectiveDate = documentData && typeof documentData.effective_date === 'string' + ? documentData.effective_date : ''; + return '' + + '

' + escapeHtml(pageTitle) + '

' + + (locale === 'en' ? 'Effective date: ' : '生效日期:') + escapeHtml(effectiveDate) + + '

' + content + '
'; + } + + async function request(url, requestPayload) { + var response = await window.fetch(url, { + method: 'POST', + credentials: 'same-origin', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'X-Requested-With': 'XMLHttpRequest' + }, + body: requestPayload + }); + var result = await response.json(); + if (!response.ok || !result || result.ret !== 1) { + var error = new Error(result && typeof result.msg === 'string' ? result.msg : '请求未完成'); + error.confirmed = response.status < 500 && result && result.ret === 0; + throw error; + } + return result; + } + + async function refreshPreview() { + var sequence = ++previewSequence; + try { + var result = await request('/admin/legal/' + slug + '/preview', payload(false)); + if (sequence === previewSequence && frame) frame.srcdoc = previewDocument(result.document); + } catch (error) { + if (sequence === previewSequence && frame) { + frame.srcdoc = previewDocument({ title: '预览不可用', effective_date: '', content_html: '

' + escapeHtml(error.message) + '

' }); + } + } + } + + function schedulePreview() { + window.clearTimeout(previewTimer); + previewTimer = window.setTimeout(refreshPreview, 350); + if (canManage && !busy && !uncertain) { + inform(snapshot() === initialSnapshot ? '尚未修改' : '有未保存的修改'); + } + } + + async function write(kind) { + if (!canManage || busy || uncertain || !form.reportValidity()) return; + if (!title.value.trim() || !editor.textContent.trim()) { + inform('标题和正文不能为空。', 'error'); + return; + } + if (kind === 'publish' && !window.confirm('确认发布当前内容?公开页面会立即切换到新版本。')) return; + busy = true; + setControls(); + inform(kind === 'publish' ? '正在发布…' : '正在保存草稿…'); + try { + var result = await request('/admin/legal/' + slug + '/' + kind, payload(true)); + if (!result.state || !Number.isInteger(Number(result.state.draft_version))) { + throw new Error('服务器回执不完整,请刷新页面核对。'); + } + version.value = String(result.state.draft_version); + initialSnapshot = snapshot(); + inform(result.msg || (kind === 'publish' ? '已发布' : '草稿已保存'), 'success'); + if (kind === 'publish') { + window.location.reload(); + return; + } + } catch (error) { + if (!error.confirmed) { + uncertain = true; + inform('请求结果未确认,请刷新页面核对后再操作,不要重复提交。', 'error'); + } else { + inform(error.message, 'error'); + } + } finally { + busy = false; + setControls(); + } + } + + root.querySelectorAll('[data-legal-command]').forEach(function (button) { + button.addEventListener('click', function () { + if (!canManage || busy || uncertain) return; + editor.focus(); + var command = button.dataset.legalCommand; + var value = button.dataset.legalValue || null; + if (command === 'formatBlock' && value) value = '<' + value + '>'; + document.execCommand(command, false, value); + schedulePreview(); + }); + }); + + form.addEventListener('input', schedulePreview); + form.addEventListener('submit', function (event) { event.preventDefault(); }); + saveButton.addEventListener('click', function () { write('draft'); }); + publishButton.addEventListener('click', function () { write('publish'); }); + window.addEventListener('beforeunload', function (event) { + if (!canManage || uncertain || snapshot() === initialSnapshot) return; + event.preventDefault(); + event.returnValue = ''; + }); + + setControls(); + refreshPreview(); +})(); diff --git a/web/resources/views/venix/admin/legal.tpl b/web/resources/views/venix/admin/legal.tpl new file mode 100644 index 00000000..824d6f54 --- /dev/null +++ b/web/resources/views/venix/admin/legal.tpl @@ -0,0 +1,120 @@ +{assign var=admin_title value='法律页面'} +{assign var=admin_active value='legal'} +{include file='admin/static_header.tpl'} +{assign var=legal_manage value=$legal_can_manage|default:false} +
+
+
+

Legal content

+

服务条款与隐私政策

+

所有配置域名共享同一份内容;使用 {literal}{{site_name}}{/literal} 可在展示时带入当前站点名称。

+
+
+ + {if $legal_error|default:''}{$legal_error|escape}{elseif !$legal_manage}只读模式{else}草稿不会自动公开{/if} + + {if $legal_state} + + 查看已发布页面 + + {/if} +
+
+ +
+ +
+ + {if $legal_error|default:''} + + {elseif $legal_state} +
+
当前编辑

{$legal_state.slug_label|escape}

{$legal_state.locale_label|escape}
+
草稿版本

v{$legal_state.draft_version|escape}

{if $legal_state.updated_at}{$legal_state.updated_at|escape}{else}尚未保存{/if}
+
公开版本

{if $legal_state.published}v{$legal_state.published.version|escape}{else}使用内置默认内容{/if}

{if $legal_state.published}{$legal_state.published.published_at|escape}{else}尚未从后台发布{/if}
+
+ + + +
+

每次发布生成独立记录;历史版本保留用于审计,不会被后续草稿覆盖。

+
+ {foreach $legal_state.history as $revision}{foreachelse}{/foreach} +
法律页面发布历史
版本标题生效日期发布时间发布人 ID
v{$revision.version|escape}{if $legal_state.published && $legal_state.published.id == $revision.id} 当前{/if}{$revision.title|escape}{$revision.effective_date|escape}{$revision.published_at|escape}#{$revision.published_by|escape}
尚未从后台发布版本,公开页面当前使用内置默认内容。
+
+ {/if} +
+{if $legal_state}{/if} +{include file='admin/static_footer.tpl'} diff --git a/web/resources/views/venix/admin/static_header.tpl b/web/resources/views/venix/admin/static_header.tpl index 9e3d3df4..52e65296 100644 --- a/web/resources/views/venix/admin/static_header.tpl +++ b/web/resources/views/venix/admin/static_header.tpl @@ -154,6 +154,7 @@
  • 提现管理
  • 工单系统
  • 站点设置
  • +
  • 法律页面
  • diff --git a/web/resources/views/venix/auth/register.tpl b/web/resources/views/venix/auth/register.tpl index 95bef293..3dbe34a8 100644 --- a/web/resources/views/venix/auth/register.tpl +++ b/web/resources/views/venix/auth/register.tpl @@ -62,7 +62,14 @@ {/if} - @@ -73,32 +80,12 @@ -{if $tos_reg == 'true'} - -{/if} - {include file='auth/layout_scripts.tpl'} diff --git a/web/resources/views/venix/home/site_header.tpl b/web/resources/views/venix/home/site_header.tpl new file mode 100644 index 00000000..d2dc4490 --- /dev/null +++ b/web/resources/views/venix/home/site_header.tpl @@ -0,0 +1,24 @@ +
    + + + {$appName|escape:'html'} + + + + +
    diff --git a/web/resources/views/venix/index.tpl b/web/resources/views/venix/index.tpl index 8e52ce7e..aec53271 100644 --- a/web/resources/views/venix/index.tpl +++ b/web/resources/views/venix/index.tpl @@ -1,51 +1,58 @@ +{assign var=home_title value=$appName} +{assign var=home_body_class value=' venix-landing'} +{assign var=home_active value='home'} {include file='home/layout_header.tpl'} -
    - - - {$appName} - - -
    +
    + {include file='home/site_header.tpl'} +
    +
    +
    +
    {if $language == 'true'}CLEAR FROM DEPLOYMENT TO DAILY OPERATIONS{else}从创建到运行,全程清晰可控{/if}
    +

    {if $language == 'true'}Your cloud resources
    should feel simple.{else}你的云资源,
    不该复杂。{/if}

    +

    {if $language == 'true'}Create cloud servers and manage networking, traffic, billing, security, recovery, and every operation from one focused control panel.{else}快速创建云服务器,集中管理网络、流量、账单、安全与救援。把繁琐的基础设施,变成一套直观、可靠的日常工作流。{/if}

    + +
    {if $language == 'true'}A complete service lifecycle{else}完整服务周期{/if}{if $language == 'true'}Orders, resources, tasks, and audit history stay connected.{else}订单、资源、任务与操作记录保持关联{/if}
    +
    +
    +
    {if $language == 'true'}Resource overview{else}资源概览{/if}LIVE
    +
    + +
    +
    {if $language == 'true'}Running instances{else}运行中的实例{/if}3
    {if $language == 'true'}All healthy{else}全部正常{/if}
    +
    {if $language == 'true'}Resource usage{else}资源使用{/if}42%
    +
    VC
    production-012 vCPU · 4 GB · 80 GB
    203.0.113.18
    +
    VC
    database-014 vCPU · 8 GB · 160 GB
    203.0.113.26
    +
    +
    +
    {if $language == 'true'}Current traffic period{else}本周期流量{/if}1.28 TB{if $language == 'true'}68% remaining{else}剩余 68%{/if}
    +
    {if $language == 'true'}Instance ready{else}实例已就绪{/if}{if $language == 'true'}Deployment completed{else}开通任务已完成{/if}
    +
    +
    -
    -
    -
    -

    Secure Network Workspace

    -

    {$appName}

    -

    {if $language == 'true'}{$appName} offers lightweight, reliable network access with stronger interference resistance and faster, more stable connections.{else}{$appName},全新一代的轻型加速服务。抗干扰性更强,数据传输速度更快更稳定。{/if}

    -
    - {if $user->isLogin} - {if $language == 'true'}Open dashboard{else}进入用户中心{/if} - {if $user->isAdmin()}{if $language == 'true'}Admin panel{else}管理面板{/if}{/if} - {else} - {if $language == 'true'}Get started{else}立即开始{/if} - {if $language == 'true'}Log in to your account{else}已有账户登录{/if} - {/if} +

    {if $language == 'true'}DESIGNED FOR CONTROLLED OPERATIONS{else}为稳定运行而设计{/if}

    {if $language == 'true'}Queued delivery{else}队列化交付{/if}{if $language == 'true'}Network protection{else}网络防护{/if}{if $language == 'true'}Rescue mode{else}救援模式{/if}{if $language == 'true'}Visible usage{else}用量可见{/if}
    + +
    +
    01

    {if $language == 'true'}CORE CAPABILITIES{else}核心能力{/if}

    {if $language == 'true'}One console for the complete instance lifecycle.{else}一套控制台,
    覆盖实例的完整生命周期。{/if}

    {if $language == 'true'}Purchasing, delivery, renewal, upgrades, rescue, and recovery all retain clear state and operation history.{else}从购买、交付到续费、升级、救援与故障核对,每一步都保留清晰状态和操作记录。{/if}

    +
    +
    01

    {if $language == 'true'}Flexible compute{else}灵活计算{/if}

    {if $language == 'true'}Choose an appropriate plan and upgrade CPU, memory, storage, and traffic to a larger eligible plan.{else}按业务需要选择配置,并可升级 CPU、内存、磁盘与流量到符合条件的更高套餐。{/if}

    {if $language == 'true'}View plans{else}查看实例计划{/if}
    +
    02

    {if $language == 'true'}Managed networking{else}独立网络{/if}

    {if $language == 'true'}Public addresses, traffic periods, firewall policy, and network state are visible in one place.{else}公网地址、流量周期、防火墙策略与网络状态集中呈现。{/if}

    {if $language == 'true'}Open instances{else}管理实例网络{/if}
    +
    03

    {if $language == 'true'}Safety and recovery{else}安全与恢复{/if}

    {if $language == 'true'}Rescue media, snapshots, operation reconciliation, and logs keep failures observable and recoverable.{else}救援镜像、快照、任务核对与操作日志,让异常可见并保留恢复路径。{/if}

    {if $language == 'true'}View operations{else}查看资源状态{/if}
    -
    -
    -
    + + +
    +
    02 · WORKFLOW

    {if $language == 'true'}Every operation has a visible result.{else}每一次操作,
    都有明确结果。{/if}

    {if $language == 'true'}Long-running infrastructure work stays in the task center. Leaving the page does not cancel the task, and uncertain outcomes remain available for reconciliation.{else}耗时的基础设施操作进入任务中心执行。离开页面不会取消任务,结果不确定的操作也会保留并持续核对。{/if}

    +
    1. 01
      {if $language == 'true'}Choose resources{else}选择资源{/if}{if $language == 'true'}Plan, image, region, and billing period{else}套餐、镜像、地区与账期{/if}
    2. 02
      {if $language == 'true'}Confirm the invoice{else}确认账单{/if}{if $language == 'true'}Pricing and payment deadline stay explicit{else}费用与支付截止时间清晰可见{/if}
    3. 03
      {if $language == 'true'}Track delivery{else}跟踪交付{/if}{if $language == 'true'}Task state and operation history are retained{else}任务状态与操作日志完整保留{/if}
    +
    -
    - © {$appName} -
    +
    READY WHEN YOU ARE

    {if $language == 'true'}Ready to launch your next instance?{else}准备好启动下一台实例了吗?{/if}

    {if $language == 'true'}Create an account and choose the resources your workload needs today.{else}注册账户,选择适合当前业务的资源计划。{/if}

    {if $language == 'true'}Open console{else}打开控制台{/if}
    +
    + {include file='home/site_footer.tpl'} +
    {include file='home/layout_scripts.tpl'} - + diff --git a/web/resources/views/venix/layout_assets.tpl b/web/resources/views/venix/layout_assets.tpl index 8d7d14e6..0582d36c 100644 --- a/web/resources/views/venix/layout_assets.tpl +++ b/web/resources/views/venix/layout_assets.tpl @@ -1,2 +1,2 @@ {* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *} -{assign var=venix_asset_version value='2026102414' scope='global'} +{assign var=venix_asset_version value='2026102415' scope='global'} diff --git a/web/resources/views/venix/legal.tpl b/web/resources/views/venix/legal.tpl new file mode 100644 index 00000000..22cc097a --- /dev/null +++ b/web/resources/views/venix/legal.tpl @@ -0,0 +1,25 @@ +{assign var=home_title value=$legal_document.title|cat:' | '|cat:$appName} +{assign var=home_body_class value=' venix-landing venix-legal'} +{assign var=home_active value=$legal_slug} +{include file='home/layout_header.tpl'} +
    + {include file='home/site_header.tpl'} +
    + + {if $legal_document.fallback} + + {/if} + + +
    + {include file='home/site_footer.tpl'} +
    +{include file='home/layout_scripts.tpl'} + + diff --git a/web/sql/legal_documents.sql b/web/sql/legal_documents.sql new file mode 100644 index 00000000..10ab4a76 --- /dev/null +++ b/web/sql/legal_documents.sql @@ -0,0 +1,33 @@ +-- Add global, versioned service terms and privacy-policy content. +-- Content is shared by every configured domain; the site name is substituted +-- when the published document is rendered. +CREATE TABLE IF NOT EXISTS `legal_documents` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `slug` varchar(32) NOT NULL, + `locale` varchar(10) NOT NULL, + `title` varchar(120) NOT NULL, + `draft_html` longtext NOT NULL, + `effective_date` date NOT NULL, + `draft_version` int(10) UNSIGNED NOT NULL DEFAULT 0, + `published_revision_id` bigint(20) UNSIGNED DEFAULT NULL, + `updated_by` bigint(20) UNSIGNED NOT NULL DEFAULT 0, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uniq_legal_document_slug_locale` (`slug`,`locale`), + KEY `idx_legal_document_published_revision` (`published_revision_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `legal_document_revisions` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `document_id` bigint(20) UNSIGNED NOT NULL, + `version` int(10) UNSIGNED NOT NULL, + `title` varchar(120) NOT NULL, + `content_html` longtext NOT NULL, + `effective_date` date NOT NULL, + `published_at` datetime NOT NULL, + `published_by` bigint(20) UNSIGNED NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uniq_legal_document_revision` (`document_id`,`version`), + KEY `idx_legal_revision_published` (`document_id`,`published_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/web/sql/ss.sql b/web/sql/ss.sql index 88d3410b..cbf98b5d 100644 --- a/web/sql/ss.sql +++ b/web/sql/ss.sql @@ -41,6 +41,31 @@ CREATE TABLE `configurations` ( `value` text DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +CREATE TABLE `legal_documents` ( + `id` bigint(20) UNSIGNED NOT NULL, + `slug` varchar(32) NOT NULL, + `locale` varchar(10) NOT NULL, + `title` varchar(120) NOT NULL, + `draft_html` longtext NOT NULL, + `effective_date` date NOT NULL, + `draft_version` int(10) UNSIGNED NOT NULL DEFAULT 0, + `published_revision_id` bigint(20) UNSIGNED DEFAULT NULL, + `updated_by` bigint(20) UNSIGNED NOT NULL DEFAULT 0, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE `legal_document_revisions` ( + `id` bigint(20) UNSIGNED NOT NULL, + `document_id` bigint(20) UNSIGNED NOT NULL, + `version` int(10) UNSIGNED NOT NULL, + `title` varchar(120) NOT NULL, + `content_html` longtext NOT NULL, + `effective_date` date NOT NULL, + `published_at` datetime NOT NULL, + `published_by` bigint(20) UNSIGNED NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + CREATE TABLE `coupon` ( `id` bigint(20) NOT NULL, `code` text NOT NULL, @@ -390,6 +415,16 @@ ALTER TABLE `configurations` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `uniq_configurations_name` (`name`); +ALTER TABLE `legal_documents` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `uniq_legal_document_slug_locale` (`slug`,`locale`), + ADD KEY `idx_legal_document_published_revision` (`published_revision_id`); + +ALTER TABLE `legal_document_revisions` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `uniq_legal_document_revision` (`document_id`,`version`), + ADD KEY `idx_legal_revision_published` (`document_id`,`published_at`); + ALTER TABLE `coupon` ADD PRIMARY KEY (`id`); @@ -521,6 +556,12 @@ ALTER TABLE `code` ALTER TABLE `configurations` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +ALTER TABLE `legal_documents` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; + +ALTER TABLE `legal_document_revisions` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; + ALTER TABLE `coupon` MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; diff --git a/web/tests/LegalDocumentServiceTest.php b/web/tests/LegalDocumentServiceTest.php new file mode 100644 index 00000000..349a306c --- /dev/null +++ b/web/tests/LegalDocumentServiceTest.php @@ -0,0 +1,150 @@ +httpStatus === $status, 'Unexpected rejection status: ' . $exception->httpStatus); + return; + } + throw new RuntimeException('Expected rejection was accepted.'); +}; + +$capsule = new Capsule(); +$capsule->addConnection(['driver' => 'sqlite', 'database' => ':memory:'], 'default'); +$capsule->setAsGlobal(); +$capsule->bootEloquent(); +$connection = $capsule->getConnection(); +$schema = $connection->getSchemaBuilder(); +$schema->create('legal_documents', static function (Blueprint $table): void { + $table->bigIncrements('id'); + $table->string('slug', 32); + $table->string('locale', 10); + $table->string('title', 120); + $table->longText('draft_html'); + $table->date('effective_date'); + $table->unsignedInteger('draft_version')->default(0); + $table->unsignedBigInteger('published_revision_id')->nullable(); + $table->unsignedBigInteger('updated_by')->default(0); + $table->dateTime('created_at'); + $table->dateTime('updated_at'); + $table->unique(['slug', 'locale']); +}); +$schema->create('legal_document_revisions', static function (Blueprint $table): void { + $table->bigIncrements('id'); + $table->unsignedBigInteger('document_id'); + $table->unsignedInteger('version'); + $table->string('title', 120); + $table->longText('content_html'); + $table->date('effective_date'); + $table->dateTime('published_at'); + $table->unsignedBigInteger('published_by'); + $table->unique(['document_id', 'version']); +}); + +$customer = ['user_id' => 1, 'is_admin' => false, 'is_super_admin' => false, 'can_manage' => false]; +$admin = ['user_id' => 2, 'is_admin' => true, 'is_super_admin' => false, 'can_manage' => false]; +$super = ['user_id' => 3, 'is_admin' => true, 'is_super_admin' => true, 'can_manage' => true]; + +$initial = LegalDocumentService::editorState($admin, 'terms', 'zh-CN'); +$assert($initial['draft_version'] === 0 && $initial['published'] === null + && str_contains($initial['content_html'], '接受与适用范围'), 'New editor did not expose safe default copy.'); +$fallback = LegalDocumentService::published('terms', 'zh-CN', '测试云'); +$assert($fallback['fallback'] === true && $fallback['version'] === 1 + && str_contains($fallback['content_html'], '测试云') && count($fallback['outline']) >= 5, + 'Public fallback or site-name substitution is incorrect.'); + +$draft = LegalDocumentService::saveDraft($super, 'terms', [ + 'locale' => 'zh-CN', + 'title' => '平台服务条款', + 'effective_date' => '2026-11-01', + 'draft_version' => '0', + 'content_html' => '

    范围

    使用 {{site_name}}。

    ' + . '危险链接' + . '
    说明
    ', +]); +$assert($draft['draft_version'] === 1 && !str_contains($draft['content_html'], ' 'zh-CN', + 'title' => '平台服务条款', + 'effective_date' => '2026-11-01', + 'draft_version' => '1', + 'content_html' => '

    适用范围

    {{site_name}} 为你提供云服务。

    账户

    请保护凭据。

    ', +]); +$assert($publishedState['draft_version'] === 2 && $publishedState['published']['version'] === 1 + && count($publishedState['history']) === 1, 'First publication did not create an immutable revision.'); +$published = LegalDocumentService::published('terms', 'zh-CN', '<站点>'); +$assert($published['fallback'] === false && $published['version'] === 1 + && str_contains($published['content_html'], '<站点>') + && str_contains($published['content_html'], 'id="legal-section-1"') + && count($published['outline']) === 2, 'Published DTO is unsafe or missing its outline.'); + +$firstRevision = $connection->table('legal_document_revisions')->where('version', 1)->first(); +$secondState = LegalDocumentService::publish($super, 'terms', [ + 'locale' => 'zh-CN', + 'title' => '平台服务条款(更新)', + 'effective_date' => '2026-12-01', + 'draft_version' => '2', + 'content_html' => '

    更新范围

    第二版正文。

    ', +]); +$assert($secondState['draft_version'] === 3 && $secondState['published']['version'] === 2 + && count($secondState['history']) === 2, 'Second publication overwrote or omitted revision history.'); +$unchangedFirst = $connection->table('legal_document_revisions')->where('version', 1)->first(); +$assert($firstRevision->content_html === $unchangedFirst->content_html, + 'Publishing a new version mutated an older revision.'); + +$reject(static fn () => LegalDocumentService::saveDraft($super, 'terms', [ + 'locale' => 'zh-CN', 'title' => '冲突', 'effective_date' => '2026-12-01', + 'draft_version' => '2', 'content_html' => '

    陈旧版本。

    ', +]), 409); +$reject(static fn () => LegalDocumentService::saveDraft($admin, 'terms', [ + 'locale' => 'zh-CN', 'title' => '无权限', 'effective_date' => '2026-12-01', + 'draft_version' => '3', 'content_html' => '

    无权限。

    ', +]), 403); +$reject(static fn () => LegalDocumentService::editorState($customer, 'terms', 'zh-CN'), 403); +$reject(static fn () => LegalDocumentService::editorState([], 'terms', 'zh-CN'), 401); +$reject(static fn () => LegalDocumentService::preview($admin, 'wrong', [], '站点'), 400); +$reject(static fn () => LegalDocumentService::preview($admin, 'terms', [ + 'locale' => 'fr', 'title' => 'Title', 'effective_date' => '2026-12-01', 'content_html' => '

    Body

    ', +], '站点'), 400); +$reject(static fn () => LegalDocumentService::preview($admin, 'terms', [ + 'locale' => 'en', 'title' => 'Title', 'effective_date' => '2026-02-30', 'content_html' => '

    Body

    ', +], '站点'), 400); +$reject(static fn () => LegalDocumentService::preview($admin, 'terms', [ + 'locale' => 'en', 'title' => 'Title', 'effective_date' => '2026-12-01', 'content_html' => ' ', +], '站点'), 400); + +$documentId = (int) $connection->table('legal_documents')->where('slug', 'terms')->where('locale', 'zh-CN')->value('id'); +$revisionId = (int) $connection->table('legal_documents')->where('id', $documentId)->value('published_revision_id'); +$connection->table('legal_document_revisions')->where('id', $revisionId)->update([ + 'content_html' => '

    数据库异常内容

    仍可显示。

    ', +]); +$sanitizedRead = LegalDocumentService::published('terms', 'zh-CN', '站点'); +$assert(!str_contains($sanitizedRead['content_html'], 'hasColumn('legal_documents', 'domain') && !$schema->hasColumn('legal_documents', 'host'), + 'Legal content was accidentally scoped per domain.'); + +echo "Legal document service tests passed.\n"; diff --git a/web/tests/LegalPagesContractTest.php b/web/tests/LegalPagesContractTest.php new file mode 100644 index 00000000..a50130fa --- /dev/null +++ b/web/tests/LegalPagesContractTest.php @@ -0,0 +1,84 @@ +add\\(new SuperAdmin\\(\\)\\)#"; + $assert(preg_match($pattern, $routes) === 1, "{$action} route is not protected by SuperAdmin middleware."); +} +$assert(str_contains($routes, "LegalController:preview") && !str_contains($routes, '/legal/{domain}'), + 'Legal preview is missing or legal content became domain scoped.'); + +$migration = $read('web/sql/legal_documents.sql'); +$fresh = $read('web/sql/ss.sql'); +foreach (['legal_documents', 'legal_document_revisions'] as $table) { + $assert(str_contains($migration, "`{$table}`") && str_contains($fresh, "CREATE TABLE `{$table}`"), + "{$table} is absent from migration or fresh schema."); +} +$assert(!preg_match('/`(?:domain|host|hostname)`/i', $migration), 'Legal schema is incorrectly partitioned by domain.'); +$assert(str_contains($migration, 'uniq_legal_document_slug_locale') + && str_contains($migration, 'uniq_legal_document_revision'), 'Legal uniqueness contracts are missing.'); + +$admin = $read('web/resources/views/venix/admin/legal.tpl'); +$adminJs = $read('web/public/theme/venix/js/admin-legal.js'); +$sidebar = $read('web/resources/views/venix/admin/static_header.tpl'); +$assert(str_contains($sidebar, 'href="/admin/legal"') && str_contains($sidebar, '法律页面'), + 'Admin navigation does not expose legal content.'); +$assert(str_contains($admin, '草稿不会自动公开') && str_contains($admin, '发布历史') + && str_contains($admin, '所有配置域名共享同一份内容') && str_contains($admin, 'sandbox=""'), + 'Admin editor does not communicate or enforce the publishing model.'); +$assert(str_contains($adminJs, "'/preview'") && str_contains($adminJs, "write('draft')") + && str_contains($adminJs, "write('publish')") && str_contains($adminJs, '请求结果未确认'), + 'Admin editor runtime is missing preview, write, or uncertain-result handling.'); + +$landing = $read('web/resources/views/venix/index.tpl'); +$legal = $read('web/resources/views/venix/legal.tpl'); +$footer = $read('web/resources/views/venix/home/site_footer.tpl'); +$css = $read('web/public/theme/venix/css/home.css'); +$assert(str_contains($landing, 'landing-console') && str_contains($landing, 'id="capabilities"') + && str_contains($landing, 'landing-workflow') && str_contains($css, '.landing-hero'), + 'The approved console-led landing page was not integrated.'); +$assert(str_contains($legal, '{$legal_document.content_html nofilter}') + && str_contains($legal, 'legal_document.outline') && str_contains($css, '.legal-layout'), + 'Published legal content or its responsive information architecture is missing.'); +$assert(str_contains($footer, '© 2026 {$appName|escape:\'html\'}. All rights reserved.') + && str_contains($footer, 'href="/terms') && str_contains($footer, 'href="/privacy') + && substr_count($footer, "?lang=en") === 2, + 'Landing footer lacks dynamic copyright or legal links.'); + +$register = $read('web/resources/views/venix/auth/register.tpl'); +$auth = $read('web/app/Controllers/AuthController.php'); +$assert(str_contains($register, 'id="accept_legal"') && str_contains($register, 'accept_legal:') + && str_contains($register, 'href="/terms') && str_contains($register, 'href="/privacy'), + 'Registration does not collect explicit legal consent.'); +$assert(!str_contains($register, 'termsModal') && !str_contains($register, 'openTerms()'), + 'The retired hard-coded terms modal remains.'); +$assert(str_contains($auth, "Config::get('tos_reg') === 'true'") + && str_contains($auth, "\$read('accept_legal') !== 'true'"), + 'Legal consent is only client-side and can be bypassed.'); + +$assets = $read('web/resources/views/venix/layout_assets.tpl'); +$assert(str_contains($assets, "value='2026102415'") + && str_contains($admin, '?v={$venix_asset_version}') + && str_contains($read('web/resources/views/venix/home/layout_header.tpl'), '?v={$venix_asset_version}'), + 'Shared browser asset version was not coupled to the new assets.'); + +$deployment = $read('docs/DEPLOYMENT.md'); +$pruning = $read('docs/PRUNING_REPORT.md'); +$assert(str_contains($deployment, 'web/sql/legal_documents.sql') + && str_contains($deployment, '不按域名拆分') && str_contains($pruning, '全局服务条款'), + 'Deployment or retained-feature documentation is stale.'); + +echo "Legal pages contract tests passed.\n";