feat(web): add landing and global legal pages
parent
f05c0b0f9e
commit
e48cd2d859
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\AdminController;
|
||||
use App\Services\Cloud\CloudAccess;
|
||||
use App\Services\Cloud\CloudError;
|
||||
use App\Services\Config;
|
||||
use App\Services\LegalDocumentService;
|
||||
|
||||
final class LegalController extends AdminController
|
||||
{
|
||||
public function index($request, $response, $args)
|
||||
{
|
||||
try {
|
||||
$actor = CloudAccess::actor(false);
|
||||
} catch (CloudError $exception) {
|
||||
return $response->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');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Services\LegalDocumentService;
|
||||
|
||||
final class LegalController extends HomeController
|
||||
{
|
||||
public function terms($request, $response, $args)
|
||||
{
|
||||
return $this->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');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
final class LegalDocument extends Model
|
||||
{
|
||||
protected $connection = 'default';
|
||||
protected $table = 'legal_documents';
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
final class LegalDocumentRevision extends Model
|
||||
{
|
||||
protected $connection = 'default';
|
||||
protected $table = 'legal_document_revisions';
|
||||
}
|
||||
@ -0,0 +1,524 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\LegalDocument;
|
||||
use App\Models\LegalDocumentRevision;
|
||||
use App\Services\Cloud\CloudError;
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use DOMNode;
|
||||
use DOMXPath;
|
||||
use voku\helper\AntiXSS;
|
||||
|
||||
/**
|
||||
* Global legal copy with draft/publish separation and immutable revisions.
|
||||
*
|
||||
* Public callers only need published(); administrator callers use the three
|
||||
* editing methods. Domain selection deliberately stays outside this module:
|
||||
* every domain reads the same document and only {{site_name}} is resolved at
|
||||
* render time.
|
||||
*/
|
||||
final class LegalDocumentService
|
||||
{
|
||||
private static bool $fallbackErrorLogged = false;
|
||||
private const SLUGS = [
|
||||
'terms' => ['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(
|
||||
'<?xml encoding="utf-8"?><div id="legal-document-root">' . $html . '</div>',
|
||||
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'
|
||||
<h2>接受与适用范围</h2><p>当你注册账户、购买或使用 {{site_name}} 提供的云服务器及相关功能时,即表示你已阅读并同意本条款。</p>
|
||||
<h2>账户与安全</h2><p>你应提供真实、准确的信息,并妥善保管密码、验证码和多因素认证凭据。发现异常登录或凭据泄露时,应立即修改密码并联系支持。</p>
|
||||
<h2>服务、账单与续费</h2><p>实例以订单展示的配置、计费周期与流量额度交付。购买与续费分别形成对应的预付费服务周期;账单、到期时间、宽限期及资源释放规则,以结算页和控制台中的明确提示为准。</p>
|
||||
<h2>可接受使用规则</h2><p>不得利用服务实施攻击、欺诈、恶意扫描、垃圾信息传播、侵权分发,或任何违反适用法律的行为。我们可对明显危害平台、网络或第三方安全的资源采取限制措施。</p>
|
||||
<h2>暂停、终止与数据处理</h2><p>未支付续费账单、严重违规或安全风险可能导致网络暂停或服务终止。服务到期后的资源保留和删除期限,以购买时展示的规则为准;资源被永久删除后通常无法恢复。</p>
|
||||
<h2>可用性与责任边界</h2><p>我们会采取合理措施维护服务稳定与安全,但互联网、上游网络、硬件故障和不可抗力可能导致中断。除非另有书面约定,服务按现状提供,责任范围受适用法律限制。</p>
|
||||
<h2>条款变更与联系</h2><p>当产品、法律或运营安排发生变化时,我们可能更新本条款。重要变化将通过站内通知、邮件或页面公告告知。对条款有疑问,可通过控制台工单联系支持。</p>
|
||||
HTML,
|
||||
'privacy' => <<<'HTML'
|
||||
<h2>我们收集的信息</h2><p>包括注册与账户资料、联系方式、订单与支付状态、实例及网络资源标识、登录与安全日志、工单沟通内容,以及你主动提交给我们的其他信息。</p>
|
||||
<h2>我们如何使用信息</h2><p>用于创建和维护账户、交付云服务、处理账单、保障账户和平台安全、响应支持请求、履行法律义务,以及在获得适当授权时改进产品体验。</p>
|
||||
<h2>支付与敏感凭据</h2><p>支付通常由受支持的支付服务商处理,我们仅保存完成订单和对账所必需的状态信息。密码应以不可逆方式处理;验证码、密钥和令牌仅在实现相应安全功能所需的范围内使用。</p>
|
||||
<h2>Cookie 与设备信息</h2><p>我们可能使用必要 Cookie 维持登录状态、保存安全偏好和防止滥用。可选分析功能应在适用地区取得必要同意,并提供清晰的关闭方式。</p>
|
||||
<h2>共享与披露</h2><p>我们不会出售你的个人信息。仅在交付服务所需、获得你的指示、履行法律义务或保护平台与他人合法权益时,向受约束的服务商或主管机构披露必要信息。</p>
|
||||
<h2>保存与安全</h2><p>我们根据服务履行、争议处理、安全审计及法律要求确定保存期限,并采取访问控制、加密、日志审计和最小权限等措施降低未授权访问风险。</p>
|
||||
<h2>你的权利</h2><p>在适用法律允许的范围内,你可以请求访问、更正、导出或删除个人信息,也可以撤回特定同意。部分数据可能因账务、安全或合规义务而需要继续保存。</p>
|
||||
<h2>更新与联系</h2><p>我们可能随业务和法律要求更新本政策,并在生效前提供合理提示。如有隐私问题或权利请求,请通过控制台工单联系我们。</p>
|
||||
HTML,
|
||||
],
|
||||
'en' => [
|
||||
'terms' => <<<'HTML'
|
||||
<h2>Acceptance and scope</h2><p>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.</p>
|
||||
<h2>Accounts and security</h2><p>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.</p>
|
||||
<h2>Services, billing, and renewal</h2><p>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.</p>
|
||||
<h2>Acceptable use</h2><p>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.</p>
|
||||
<h2>Suspension, termination, and data</h2><p>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.</p>
|
||||
<h2>Availability and liability</h2><p>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.</p>
|
||||
<h2>Changes and contact</h2><p>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.</p>
|
||||
HTML,
|
||||
'privacy' => <<<'HTML'
|
||||
<h2>Information we collect</h2><p>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.</p>
|
||||
<h2>How we use information</h2><p>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.</p>
|
||||
<h2>Payments and sensitive credentials</h2><p>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.</p>
|
||||
<h2>Cookies and device information</h2><p>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.</p>
|
||||
<h2>Sharing and disclosure</h2><p>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.</p>
|
||||
<h2>Retention and security</h2><p>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.</p>
|
||||
<h2>Your rights</h2><p>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.</p>
|
||||
<h2>Updates and contact</h2><p>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.</p>
|
||||
HTML,
|
||||
],
|
||||
];
|
||||
}
|
||||
@ -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; }
|
||||
}
|
||||
|
||||
@ -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 : '<p>预览暂不可用。</p>';
|
||||
var pageTitle = documentData && typeof documentData.title === 'string'
|
||||
? documentData.title : '';
|
||||
var effectiveDate = documentData && typeof documentData.effective_date === 'string'
|
||||
? documentData.effective_date : '';
|
||||
return '<!doctype html><html lang="' + (locale === 'en' ? 'en' : 'zh-CN') + '"><head><meta charset="utf-8">' +
|
||||
'<meta name="viewport" content="width=device-width,initial-scale=1"><style>' +
|
||||
'body{margin:0;padding:28px;color:#183247;background:#fff;font:14px/1.85 Inter,system-ui,sans-serif}' +
|
||||
'header{padding-bottom:22px;border-bottom:1px solid #dce5e8}h1{margin:0 0 8px;font-size:28px;line-height:1.2}' +
|
||||
'header p{margin:0;color:#738797;font-size:12px}main{padding-top:12px}h2{margin:30px 0 10px;font-size:21px}' +
|
||||
'h3{margin:24px 0 8px;font-size:17px}p{margin:10px 0;color:#536b7b}ul,ol{padding-left:22px;color:#536b7b}' +
|
||||
'blockquote{margin:18px 0;padding:12px 16px;border-left:3px solid #16b8ad;background:#edf9f7;color:#315865}' +
|
||||
'</style></head><body><header><h1>' + escapeHtml(pageTitle) + '</h1><p>' +
|
||||
(locale === 'en' ? 'Effective date: ' : '生效日期:') + escapeHtml(effectiveDate) +
|
||||
'</p></header><main>' + content + '</main></body></html>';
|
||||
}
|
||||
|
||||
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: '<p>' + escapeHtml(error.message) + '</p>' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
})();
|
||||
@ -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}
|
||||
<main data-legal-editor
|
||||
data-slug="{$legal_state.slug|default:$legal_selected_slug|escape:'html'}"
|
||||
data-locale="{$legal_state.locale|default:$legal_selected_locale|escape:'html'}"
|
||||
data-can-manage="{if $legal_manage}1{else}0{/if}">
|
||||
<div class="py-3 d-flex align-items-sm-center flex-sm-row flex-column gap-3">
|
||||
<div class="flex-grow-1">
|
||||
<p class="admin-eyebrow mb-1">Legal content</p>
|
||||
<h1 class="fs-20 fw-semibold mb-1">服务条款与隐私政策</h1>
|
||||
<p class="text-muted mb-0">所有配置域名共享同一份内容;使用 <code>{literal}{{site_name}}{/literal}</code> 可在展示时带入当前站点名称。</p>
|
||||
</div>
|
||||
<div class="admin-config-actions flex-shrink-0">
|
||||
<span class="admin-config-status{if $legal_error|default:''} is-error{/if}" id="legal-feedback" role="status" aria-live="polite">
|
||||
{if $legal_error|default:''}{$legal_error|escape}{elseif !$legal_manage}只读模式{else}草稿不会自动公开{/if}
|
||||
</span>
|
||||
{if $legal_state}
|
||||
<a class="btn btn-light" href="/{if $legal_state.slug == 'terms'}terms{else}privacy{/if}?lang={$legal_state.locale|escape:'url'}" target="_blank" rel="noopener">
|
||||
<i class="mdi mdi-open-in-new me-1" aria-hidden="true"></i>查看已发布页面
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="card mb-3" aria-label="法律页面选择">
|
||||
<div class="card-body legal-admin-selector">
|
||||
<div>
|
||||
<span class="form-label d-block">页面</span>
|
||||
<div class="btn-group" role="group" aria-label="选择法律页面">
|
||||
<a class="btn {if $legal_selected_slug == 'terms'}btn-primary{else}btn-light{/if}" href="/admin/legal?document=terms&locale={$legal_selected_locale|escape:'url'}">服务条款</a>
|
||||
<a class="btn {if $legal_selected_slug == 'privacy'}btn-primary{else}btn-light{/if}" href="/admin/legal?document=privacy&locale={$legal_selected_locale|escape:'url'}">隐私政策</a>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span class="form-label d-block">语言版本</span>
|
||||
<div class="btn-group" role="group" aria-label="选择页面语言">
|
||||
<a class="btn {if $legal_selected_locale == 'zh-CN'}btn-primary{else}btn-light{/if}" href="/admin/legal?document={$legal_selected_slug|escape:'url'}&locale=zh-CN">简体中文</a>
|
||||
<a class="btn {if $legal_selected_locale == 'en'}btn-primary{else}btn-light{/if}" href="/admin/legal?document={$legal_selected_slug|escape:'url'}&locale=en">English</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-info mb-0 flex-grow-1" role="note">
|
||||
页面内容全局生效,不会因访问域名不同而创建独立版本。中文和英文分别保存、分别发布。
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{if $legal_error|default:''}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<strong>法律页面编辑器暂不可用。</strong>
|
||||
<div class="mt-2">现有环境请先备份业务库,再导入 <code>web/sql/legal_documents.sql</code>。公开条款和政策页面仍会显示内置默认内容。</div>
|
||||
</div>
|
||||
{elseif $legal_state}
|
||||
<section class="row g-3 mb-3" aria-label="法律页面状态">
|
||||
<div class="col-md-4"><article class="card h-100"><div class="card-body"><span class="text-muted fs-13">当前编辑</span><h2 class="h5 mt-2 mb-1">{$legal_state.slug_label|escape}</h2><span class="badge text-bg-light">{$legal_state.locale_label|escape}</span></div></article></div>
|
||||
<div class="col-md-4"><article class="card h-100"><div class="card-body"><span class="text-muted fs-13">草稿版本</span><h2 class="h5 mt-2 mb-1">v{$legal_state.draft_version|escape}</h2><span class="text-muted fs-13">{if $legal_state.updated_at}{$legal_state.updated_at|escape}{else}尚未保存{/if}</span></div></article></div>
|
||||
<div class="col-md-4"><article class="card h-100"><div class="card-body"><span class="text-muted fs-13">公开版本</span><h2 class="h5 mt-2 mb-1">{if $legal_state.published}v{$legal_state.published.version|escape}{else}使用内置默认内容{/if}</h2><span class="text-muted fs-13">{if $legal_state.published}{$legal_state.published.published_at|escape}{else}尚未从后台发布{/if}</span></div></article></div>
|
||||
</section>
|
||||
|
||||
<div class="legal-admin-workspace">
|
||||
<section class="card legal-admin-compose" aria-labelledby="legal-editor-title">
|
||||
<div class="card-header d-flex align-items-start justify-content-between gap-3 flex-wrap">
|
||||
<div><h2 class="h5 card-title mb-1" id="legal-editor-title">编辑草稿</h2><p class="text-muted fs-13 mb-0">保存草稿不会改变公开页面;点击发布后才生成新的不可变版本。</p></div>
|
||||
{if !$legal_manage}<span class="badge text-bg-warning">仅超级管理员可编辑</span>{/if}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="legal-form" novalidate>
|
||||
<input id="legal-draft-version" type="hidden" value="{$legal_state.draft_version|escape}">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label" for="legal-title">页面标题</label>
|
||||
<input class="form-control" id="legal-title" maxlength="120" value="{$legal_state.title|escape:'html'}" required {if !$legal_manage}readonly{/if}>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label" for="legal-effective-date">生效日期</label>
|
||||
<input class="form-control" id="legal-effective-date" type="date" value="{$legal_state.effective_date|escape:'html'}" required {if !$legal_manage}readonly{/if}>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label" id="legal-content-label">正文</label>
|
||||
<div class="legal-editor-toolbar" role="toolbar" aria-label="正文格式工具">
|
||||
<button type="button" data-legal-command="formatBlock" data-legal-value="p" title="正文" {if !$legal_manage}disabled{/if}>P</button>
|
||||
<button type="button" data-legal-command="formatBlock" data-legal-value="h2" title="二级标题" {if !$legal_manage}disabled{/if}>H2</button>
|
||||
<button type="button" data-legal-command="formatBlock" data-legal-value="h3" title="三级标题" {if !$legal_manage}disabled{/if}>H3</button>
|
||||
<span aria-hidden="true"></span>
|
||||
<button type="button" data-legal-command="bold" title="加粗" {if !$legal_manage}disabled{/if}><strong>B</strong></button>
|
||||
<button type="button" data-legal-command="italic" title="斜体" {if !$legal_manage}disabled{/if}><em>I</em></button>
|
||||
<button type="button" data-legal-command="insertUnorderedList" title="无序列表" {if !$legal_manage}disabled{/if}>• 列表</button>
|
||||
<button type="button" data-legal-command="insertOrderedList" title="有序列表" {if !$legal_manage}disabled{/if}>1. 列表</button>
|
||||
<button type="button" data-legal-command="formatBlock" data-legal-value="blockquote" title="引用" {if !$legal_manage}disabled{/if}>引用</button>
|
||||
<button type="button" data-legal-command="removeFormat" title="清除文字格式" {if !$legal_manage}disabled{/if}>清除格式</button>
|
||||
</div>
|
||||
<div class="legal-rich-editor" id="legal-content" role="textbox" aria-labelledby="legal-content-label" aria-multiline="true" contenteditable="{if $legal_manage}true{else}false{/if}" spellcheck="true">{$legal_state.content_html nofilter}</div>
|
||||
<div class="form-text">允许标题、段落、列表、粗体、斜体和引用;脚本、链接、图片、内联样式及其他属性会在服务端删除。正文最多 100000 个字符。</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-form-actions mt-4">
|
||||
<button class="btn btn-light" id="legal-save" type="button" {if !$legal_manage}disabled{/if}><i class="mdi mdi-content-save-outline me-1"></i>保存草稿</button>
|
||||
<button class="btn btn-primary" id="legal-publish" type="button" {if !$legal_manage}disabled{/if}><i class="mdi mdi-publish me-1"></i>发布新版本</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card legal-admin-preview" aria-labelledby="legal-preview-title">
|
||||
<div class="card-header"><h2 class="h5 card-title mb-1" id="legal-preview-title">安全预览</h2><p class="text-muted fs-13 mb-0">预览由服务端使用与公开页面相同的规则过滤后生成。</p></div>
|
||||
<div class="card-body"><iframe id="legal-preview-frame" title="法律页面正文预览" sandbox=""></iframe></div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="card mt-3" aria-labelledby="legal-history-title">
|
||||
<div class="card-header"><h2 class="h5 card-title mb-1" id="legal-history-title">发布历史</h2><p class="text-muted fs-13 mb-0">每次发布生成独立记录;历史版本保留用于审计,不会被后续草稿覆盖。</p></div>
|
||||
<div class="card-body"><div class="table-responsive"><table class="table align-middle mb-0"><caption class="visually-hidden">法律页面发布历史</caption><thead><tr><th scope="col">版本</th><th scope="col">标题</th><th scope="col">生效日期</th><th scope="col">发布时间</th><th scope="col">发布人 ID</th></tr></thead><tbody>
|
||||
{foreach $legal_state.history as $revision}<tr><td><strong>v{$revision.version|escape}</strong>{if $legal_state.published && $legal_state.published.id == $revision.id} <span class="badge text-bg-success">当前</span>{/if}</td><td>{$revision.title|escape}</td><td>{$revision.effective_date|escape}</td><td class="text-muted">{$revision.published_at|escape}</td><td class="text-muted">#{$revision.published_by|escape}</td></tr>{foreachelse}<tr><td colspan="5" class="text-center text-muted py-4">尚未从后台发布版本,公开页面当前使用内置默认内容。</td></tr>{/foreach}
|
||||
</tbody></table></div></div>
|
||||
</section>
|
||||
{/if}
|
||||
</main>
|
||||
{if $legal_state}<script src="/theme/venix/js/admin-legal.js?v={$venix_asset_version}" defer></script>{/if}
|
||||
{include file='admin/static_footer.tpl'}
|
||||
@ -0,0 +1,37 @@
|
||||
<footer class="landing-site-footer">
|
||||
<div class="landing-footer-brand">
|
||||
<a class="landing-brand" href="/">
|
||||
<span class="landing-brand-mark" aria-hidden="true"><i></i><i></i></span>
|
||||
<span>{$appName|escape:'html'}</span>
|
||||
</a>
|
||||
<p>{if $language == 'true'}A clear, reliable way to manage cloud servers.{else}清晰、可靠的云服务器管理体验。{/if}</p>
|
||||
</div>
|
||||
<div class="landing-footer-links">
|
||||
<div><strong>{if $language == 'true'}Product{else}产品{/if}</strong><a href="/">{if $language == 'true'}Home{else}产品首页{/if}</a><a href="/#capabilities">{if $language == 'true'}Capabilities{else}产品能力{/if}</a><a href="/user">{if $language == 'true'}Console{else}用户控制台{/if}</a></div>
|
||||
<div><strong>{if $language == 'true'}Legal{else}法律{/if}</strong><a href="/terms{if $language == 'true'}?lang=en{/if}">{if $language == 'true'}Terms of Service{else}服务条款{/if}</a><a href="/privacy{if $language == 'true'}?lang=en{/if}">{if $language == 'true'}Privacy Policy{else}隐私政策{/if}</a></div>
|
||||
</div>
|
||||
<div class="landing-footer-bottom">
|
||||
<span>© 2026 {$appName|escape:'html'}. All rights reserved.</span>
|
||||
<span>{if $language == 'true'}LANGUAGE · ENGLISH{else}LANGUAGE · 简体中文{/if}</span>
|
||||
</div>
|
||||
</footer>
|
||||
<script>
|
||||
(function () {
|
||||
var header = document.querySelector('[data-site-header]');
|
||||
var button = document.querySelector('[data-site-menu]');
|
||||
if (!header || !button) return;
|
||||
button.addEventListener('click', function () {
|
||||
var open = header.classList.toggle('is-menu-open');
|
||||
button.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
button.setAttribute('aria-label', open ? '{if $language == 'true'}Close navigation{else}关闭导航{/if}' : '{if $language == 'true'}Open navigation{else}打开导航{/if}');
|
||||
var icon = button.querySelector('i');
|
||||
if (icon) icon.className = 'mdi ' + (open ? 'mdi-close' : 'mdi-menu');
|
||||
});
|
||||
document.addEventListener('keydown', function (event) {
|
||||
if (event.key !== 'Escape' || !header.classList.contains('is-menu-open')) return;
|
||||
header.classList.remove('is-menu-open');
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
button.focus();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
@ -0,0 +1,24 @@
|
||||
<header class="landing-site-header" data-site-header>
|
||||
<a class="landing-brand" href="/" aria-label="{$appName|escape:'html'}{if $language == 'true'} home{else}首页{/if}">
|
||||
<span class="landing-brand-mark" aria-hidden="true"><i></i><i></i></span>
|
||||
<span>{$appName|escape:'html'}</span>
|
||||
</a>
|
||||
<nav class="landing-main-nav" id="landing-main-nav" aria-label="{if $language == 'true'}Main navigation{else}主导航{/if}">
|
||||
<a {if $home_active|default:'home' == 'home'}class="is-active" aria-current="page"{/if} href="/">{if $language == 'true'}Home{else}产品首页{/if}</a>
|
||||
<a href="/#capabilities">{if $language == 'true'}Capabilities{else}产品能力{/if}</a>
|
||||
<a {if $home_active|default:'' == 'terms'}class="is-active" aria-current="page"{/if} href="/terms{if $language == 'true'}?lang=en{/if}">{if $language == 'true'}Terms{else}服务条款{/if}</a>
|
||||
<a {if $home_active|default:'' == 'privacy'}class="is-active" aria-current="page"{/if} href="/privacy{if $language == 'true'}?lang=en{/if}">{if $language == 'true'}Privacy{else}隐私政策{/if}</a>
|
||||
</nav>
|
||||
<div class="landing-nav-actions">
|
||||
{if $user->isLogin}
|
||||
{if $user->isAdmin()}<a class="landing-nav-login" href="/admin">{if $language == 'true'}Admin{else}管理后台{/if}</a>{/if}
|
||||
<a class="landing-button landing-button-small landing-button-primary" href="/user">{if $language == 'true'}Open console{else}进入控制台{/if}<i class="mdi mdi-arrow-right" aria-hidden="true"></i></a>
|
||||
{else}
|
||||
<a class="landing-nav-login" href="/auth/login">{if $language == 'true'}Log in{else}登录{/if}</a>
|
||||
<a class="landing-button landing-button-small landing-button-primary" href="/auth/register">{if $language == 'true'}Create account{else}创建账户{/if}<i class="mdi mdi-arrow-right" aria-hidden="true"></i></a>
|
||||
{/if}
|
||||
</div>
|
||||
<button class="landing-mobile-menu" type="button" aria-label="{if $language == 'true'}Open navigation{else}打开导航{/if}" aria-expanded="false" aria-controls="landing-main-nav" data-site-menu>
|
||||
<i class="mdi mdi-menu" aria-hidden="true"></i>
|
||||
</button>
|
||||
</header>
|
||||
@ -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'}
|
||||
<header class="home-nav">
|
||||
<a class="home-brand" href="/">
|
||||
<img src="/theme/venix/images/logo-sm.png" alt="">
|
||||
<span>{$appName}</span>
|
||||
</a>
|
||||
<nav>
|
||||
{if $user->isLogin}
|
||||
<a href="/user">{if $language == 'true'}User dashboard{else}用户中心{/if}</a>
|
||||
{if $user->isAdmin()}<a href="/admin">{if $language == 'true'}Admin panel{else}管理面板{/if}</a>{/if}
|
||||
<a class="home-nav-button" href="/user/logout">{if $language == 'true'}Log out{else}退出{/if}</a>
|
||||
{else}
|
||||
<a href="/auth/login">{if $language == 'true'}Log in{else}登录{/if}</a>
|
||||
<a class="home-nav-button" href="/auth/register">{if $language == 'true'}Register{else}注册{/if}</a>
|
||||
{/if}
|
||||
</nav>
|
||||
</header>
|
||||
<div class="landing-shell">
|
||||
{include file='home/site_header.tpl'}
|
||||
<main class="landing-main">
|
||||
<section class="landing-hero">
|
||||
<div class="landing-hero-copy">
|
||||
<div class="landing-eyebrow"><span></span>{if $language == 'true'}CLEAR FROM DEPLOYMENT TO DAILY OPERATIONS{else}从创建到运行,全程清晰可控{/if}</div>
|
||||
<h1>{if $language == 'true'}Your cloud resources<br><em>should feel simple.</em>{else}你的云资源,<br><em>不该复杂。</em>{/if}</h1>
|
||||
<p>{if $language == 'true'}Create cloud servers and manage networking, traffic, billing, security, recovery, and every operation from one focused control panel.{else}快速创建云服务器,集中管理网络、流量、账单、安全与救援。把繁琐的基础设施,变成一套直观、可靠的日常工作流。{/if}</p>
|
||||
<div class="landing-hero-actions">
|
||||
<a class="landing-button landing-button-primary" href="{if $user->isLogin}/user/cloud/deploy{else}/auth/register{/if}">{if $language == 'true'}Deploy an instance{else}立即创建实例{/if}<i class="mdi mdi-arrow-right" aria-hidden="true"></i></a>
|
||||
<a class="landing-text-link" href="#capabilities">{if $language == 'true'}Explore capabilities{else}了解产品能力{/if}<span aria-hidden="true">↓</span></a>
|
||||
</div>
|
||||
<div class="landing-hero-proof"><span class="landing-proof-mark"><i class="mdi mdi-check" aria-hidden="true"></i></span><span><strong>{if $language == 'true'}A complete service lifecycle{else}完整服务周期{/if}</strong><small>{if $language == 'true'}Orders, resources, tasks, and audit history stay connected.{else}订单、资源、任务与操作记录保持关联{/if}</small></span></div>
|
||||
</div>
|
||||
<div class="landing-console" aria-label="{if $language == 'true'}Cloud console illustration{else}云资源控制台示意图{/if}">
|
||||
<div class="landing-console-top"><span><i></i><i></i><i></i></span><b>{if $language == 'true'}Resource overview{else}资源概览{/if}</b><em>LIVE</em></div>
|
||||
<div class="landing-console-body">
|
||||
<aside><span class="is-active"><i class="mdi mdi-server-outline"></i></span><span><i class="mdi mdi-chart-areaspline"></i></span><span><i class="mdi mdi-shield-outline"></i></span><span><i class="mdi mdi-earth"></i></span></aside>
|
||||
<div class="landing-console-main">
|
||||
<div class="landing-console-heading"><div><small>{if $language == 'true'}Running instances{else}运行中的实例{/if}</small><strong>3</strong></div><span><i></i>{if $language == 'true'}All healthy{else}全部正常{/if}</span></div>
|
||||
<div class="landing-chart"><div><span>{if $language == 'true'}Resource usage{else}资源使用{/if}</span><b>42%</b></div><svg viewBox="0 0 420 120" preserveAspectRatio="none" aria-hidden="true"><defs><linearGradient id="landingArea" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2de2c2" stop-opacity=".34"/><stop offset="1" stop-color="#2de2c2" stop-opacity="0"/></linearGradient></defs><path class="area" d="M0,98 C35,88 48,104 82,77 C112,54 135,69 166,50 C198,32 222,56 250,34 C282,12 306,38 337,28 C372,17 391,28 420,12 L420,120 L0,120 Z"/><path class="line" d="M0,98 C35,88 48,104 82,77 C112,54 135,69 166,50 C198,32 222,56 250,34 C282,12 306,38 337,28 C372,17 391,28 420,12"/></svg></div>
|
||||
<div class="landing-instance-row"><span>VC</span><div><strong>production-01</strong><small>2 vCPU · 4 GB · 80 GB</small></div><code>203.0.113.18</code><i></i></div>
|
||||
<div class="landing-instance-row"><span class="is-alt">VC</span><div><strong>database-01</strong><small>4 vCPU · 8 GB · 160 GB</small></div><code>203.0.113.26</code><i></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="landing-float landing-float-traffic"><span>{if $language == 'true'}Current traffic period{else}本周期流量{/if}</span><strong>1.28 <small>TB</small></strong><i><b></b></i><em>{if $language == 'true'}68% remaining{else}剩余 68%{/if}</em></div>
|
||||
<div class="landing-float landing-float-ready"><i class="mdi mdi-check" aria-hidden="true"></i><span><strong>{if $language == 'true'}Instance ready{else}实例已就绪{/if}</strong><small>{if $language == 'true'}Deployment completed{else}开通任务已完成{/if}</small></span></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<main>
|
||||
<section class="home-hero">
|
||||
<div class="home-hero-copy">
|
||||
<p class="home-kicker">Secure Network Workspace</p>
|
||||
<h1>{$appName}</h1>
|
||||
<p class="home-lead">{if $language == 'true'}{$appName} offers lightweight, reliable network access with stronger interference resistance and faster, more stable connections.{else}{$appName},全新一代的轻型加速服务。抗干扰性更强,数据传输速度更快更稳定。{/if}</p>
|
||||
<div class="home-actions">
|
||||
{if $user->isLogin}
|
||||
<a class="home-button" href="/user"><i class="mdi mdi-view-dashboard-outline"></i>{if $language == 'true'}Open dashboard{else}进入用户中心{/if}</a>
|
||||
{if $user->isAdmin()}<a class="home-button home-button-ghost" href="/admin"><i class="mdi mdi-shield-account-outline"></i>{if $language == 'true'}Admin panel{else}管理面板{/if}</a>{/if}
|
||||
{else}
|
||||
<a class="home-button" href="/auth/register"><i class="mdi mdi-account-plus-outline"></i>{if $language == 'true'}Get started{else}立即开始{/if}</a>
|
||||
<a class="home-button home-button-ghost" href="/auth/login"><i class="mdi mdi-login-variant"></i>{if $language == 'true'}Log in to your account{else}已有账户登录{/if}</a>
|
||||
{/if}
|
||||
<section class="landing-signal" aria-label="{if $language == 'true'}Platform capabilities{else}平台能力摘要{/if}"><p>{if $language == 'true'}DESIGNED FOR CONTROLLED OPERATIONS{else}为稳定运行而设计{/if}</p><div><span><i class="mdi mdi-flash-outline"></i>{if $language == 'true'}Queued delivery{else}队列化交付{/if}</span><span><i class="mdi mdi-shield-check-outline"></i>{if $language == 'true'}Network protection{else}网络防护{/if}</span><span><i class="mdi mdi-lifebuoy"></i>{if $language == 'true'}Rescue mode{else}救援模式{/if}</span><span><i class="mdi mdi-chart-box-outline"></i>{if $language == 'true'}Visible usage{else}用量可见{/if}</span></div></section>
|
||||
|
||||
<section class="landing-section landing-capabilities" id="capabilities">
|
||||
<div class="landing-section-heading"><div><span>01</span><p>{if $language == 'true'}CORE CAPABILITIES{else}核心能力{/if}</p></div><h2>{if $language == 'true'}One console for the complete instance lifecycle.{else}一套控制台,<br>覆盖实例的完整生命周期。{/if}</h2><p>{if $language == 'true'}Purchasing, delivery, renewal, upgrades, rescue, and recovery all retain clear state and operation history.{else}从购买、交付到续费、升级、救援与故障核对,每一步都保留清晰状态和操作记录。{/if}</p></div>
|
||||
<div class="landing-feature-grid">
|
||||
<article><span>01</span><div><i class="mdi mdi-server-network-outline"></i></div><h3>{if $language == 'true'}Flexible compute{else}灵活计算{/if}</h3><p>{if $language == 'true'}Choose an appropriate plan and upgrade CPU, memory, storage, and traffic to a larger eligible plan.{else}按业务需要选择配置,并可升级 CPU、内存、磁盘与流量到符合条件的更高套餐。{/if}</p><a href="/user/cloud/deploy">{if $language == 'true'}View plans{else}查看实例计划{/if}<i class="mdi mdi-arrow-right"></i></a></article>
|
||||
<article><span>02</span><div><i class="mdi mdi-earth"></i></div><h3>{if $language == 'true'}Managed networking{else}独立网络{/if}</h3><p>{if $language == 'true'}Public addresses, traffic periods, firewall policy, and network state are visible in one place.{else}公网地址、流量周期、防火墙策略与网络状态集中呈现。{/if}</p><a href="/user/cloud/instances">{if $language == 'true'}Open instances{else}管理实例网络{/if}<i class="mdi mdi-arrow-right"></i></a></article>
|
||||
<article><span>03</span><div><i class="mdi mdi-shield-refresh-outline"></i></div><h3>{if $language == 'true'}Safety and recovery{else}安全与恢复{/if}</h3><p>{if $language == 'true'}Rescue media, snapshots, operation reconciliation, and logs keep failures observable and recoverable.{else}救援镜像、快照、任务核对与操作日志,让异常可见并保留恢复路径。{/if}</p><a href="/user/cloud/instances">{if $language == 'true'}View operations{else}查看资源状态{/if}<i class="mdi mdi-arrow-right"></i></a></article>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</section>
|
||||
|
||||
<section class="landing-section landing-workflow" aria-labelledby="landing-workflow-title">
|
||||
<div class="landing-workflow-copy"><span>02 · WORKFLOW</span><h2 id="landing-workflow-title">{if $language == 'true'}Every operation has a visible result.{else}每一次操作,<br>都有明确结果。{/if}</h2><p>{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}</p></div>
|
||||
<ol><li><span>01</span><div><strong>{if $language == 'true'}Choose resources{else}选择资源{/if}</strong><small>{if $language == 'true'}Plan, image, region, and billing period{else}套餐、镜像、地区与账期{/if}</small></div></li><li><span>02</span><div><strong>{if $language == 'true'}Confirm the invoice{else}确认账单{/if}</strong><small>{if $language == 'true'}Pricing and payment deadline stay explicit{else}费用与支付截止时间清晰可见{/if}</small></div></li><li><span>03</span><div><strong>{if $language == 'true'}Track delivery{else}跟踪交付{/if}</strong><small>{if $language == 'true'}Task state and operation history are retained{else}任务状态与操作日志完整保留{/if}</small></div></li></ol>
|
||||
</section>
|
||||
|
||||
<footer class="home-footer">
|
||||
<span>© {$appName}</span>
|
||||
</footer>
|
||||
<section class="landing-cta"><div><div class="landing-eyebrow"><span></span>READY WHEN YOU ARE</div><h2>{if $language == 'true'}Ready to launch your next instance?{else}准备好启动下一台实例了吗?{/if}</h2><p>{if $language == 'true'}Create an account and choose the resources your workload needs today.{else}注册账户,选择适合当前业务的资源计划。{/if}</p></div><a class="landing-button landing-button-light" href="{if $user->isLogin}/user/cloud/deploy{else}/auth/register{/if}">{if $language == 'true'}Open console{else}打开控制台{/if}<i class="mdi mdi-arrow-right"></i></a></section>
|
||||
</main>
|
||||
{include file='home/site_footer.tpl'}
|
||||
</div>
|
||||
{include file='home/layout_scripts.tpl'}
|
||||
<script>
|
||||
(function () {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.indexOf('micromessenger') !== -1) {
|
||||
document.body.innerHTML = '<div style="padding:24px;font-size:16px;line-height:1.7">{if $language == 'true'}This site cannot be opened in WeChat.<br>Use the top-right menu to open it in your browser.{else}不支持在微信内访问<br>请点击右上角菜单<br>选择浏览器打开{/if}</div>';
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script>if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) document.body.classList.add('is-wechat');</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -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'}
|
||||
|
||||
@ -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'}
|
||||
<div class="landing-shell">
|
||||
{include file='home/site_header.tpl'}
|
||||
<main class="legal-page">
|
||||
<section class="legal-hero">
|
||||
<div><span>{if $legal_slug == 'terms'}TERMS OF SERVICE{else}PRIVACY POLICY{/if}</span><h1>{$legal_document.title|escape:'html'}</h1><p>{if $legal_slug == 'terms'}{if $language == 'true'}These rules explain the service relationship between you and the platform.{else}这些规则说明你与平台之间的服务关系。{/if}{else}{if $language == 'true'}This policy explains how information connected to you is handled.{else}这份政策说明我们如何处理与你有关的信息。{/if}{/if}</p></div>
|
||||
<dl><div><dt>{if $language == 'true'}Effective date{else}生效日期{/if}</dt><dd>{$legal_document.effective_date|escape:'html'}</dd></div><div><dt>{if $language == 'true'}Current version{else}当前版本{/if}</dt><dd>v{$legal_document.version|escape:'html'}</dd></div></dl>
|
||||
</section>
|
||||
{if $legal_document.fallback}
|
||||
<div class="legal-fallback-notice" role="note"><i class="mdi mdi-information-outline" aria-hidden="true"></i><p><strong>{if $language == 'true'}Default published copy{else}当前为平台默认内容{/if}</strong><span>{if $language == 'true'}An administrator can review and publish the formal version from the control panel.{else}管理员可在后台完成审核并发布正式版本;草稿不会在此页面显示。{/if}</span></p></div>
|
||||
{/if}
|
||||
<div class="legal-layout">
|
||||
<aside aria-label="{if $language == 'true'}Table of contents{else}页面目录{/if}"><span>{if $language == 'true'}CONTENTS{else}目录{/if}</span>{foreach $legal_document.outline as $item}<a class="{if $item.level == 'h3'}is-subsection{/if}" href="#{$item.id|escape:'url'}"><b>{($item@iteration|string_format:'%02d')}</b>{$item.title|escape:'html'}</a>{/foreach}</aside>
|
||||
<article class="legal-content">{$legal_document.content_html nofilter}</article>
|
||||
</div>
|
||||
<section class="legal-contact"><div><span>{if $language == 'true'}QUESTIONS ABOUT THIS DOCUMENT?{else}对本页面仍有疑问?{/if}</span><h2>{if $language == 'true'}We are ready to explain the details clearly.{else}我们愿意把规则解释清楚。{/if}</h2></div><a class="landing-button landing-button-primary" href="{if $user->isLogin}/user/ticket/create{else}/auth/login{/if}">{if $language == 'true'}Contact support{else}联系支持{/if}<i class="mdi mdi-arrow-right"></i></a></section>
|
||||
</main>
|
||||
{include file='home/site_footer.tpl'}
|
||||
</div>
|
||||
{include file='home/layout_scripts.tpl'}
|
||||
</body>
|
||||
</html>
|
||||
@ -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;
|
||||
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
use App\Services\Cloud\CloudError;
|
||||
use App\Services\LegalDocumentService;
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
$assert = static function (bool $condition, string $message): void {
|
||||
if (!$condition) {
|
||||
throw new RuntimeException($message);
|
||||
}
|
||||
};
|
||||
$reject = static function (callable $call, int $status) use ($assert): void {
|
||||
try {
|
||||
$call();
|
||||
} catch (CloudError $exception) {
|
||||
$assert($exception->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' => '<h2 onclick="alert(1)">范围</h2><p>使用 {{site_name}}。</p>'
|
||||
. '<script>alert(1)</script><a href="javascript:alert(1)">危险链接</a>'
|
||||
. '<img src=x onerror=alert(1)><blockquote style="color:red">说明</blockquote>',
|
||||
]);
|
||||
$assert($draft['draft_version'] === 1 && !str_contains($draft['content_html'], '<script')
|
||||
&& !str_contains($draft['content_html'], 'onclick') && !str_contains($draft['content_html'], 'href=')
|
||||
&& !str_contains($draft['content_html'], '<img') && !str_contains($draft['content_html'], 'style='),
|
||||
'Draft sanitizer retained executable markup or attributes.');
|
||||
$stillFallback = LegalDocumentService::published('terms', 'zh-CN', '测试云');
|
||||
$assert($stillFallback['fallback'] === true && !str_contains($stillFallback['content_html'], '危险链接'),
|
||||
'An unpublished draft leaked to the public page.');
|
||||
|
||||
$publishedState = LegalDocumentService::publish($super, 'terms', [
|
||||
'locale' => 'zh-CN',
|
||||
'title' => '平台服务条款',
|
||||
'effective_date' => '2026-11-01',
|
||||
'draft_version' => '1',
|
||||
'content_html' => '<h2>适用范围</h2><p>{{site_name}} 为你提供云服务。</p><h3>账户</h3><p>请保护凭据。</p>',
|
||||
]);
|
||||
$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' => '<h2>更新范围</h2><p>第二版正文。</p>',
|
||||
]);
|
||||
$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' => '<p>陈旧版本。</p>',
|
||||
]), 409);
|
||||
$reject(static fn () => LegalDocumentService::saveDraft($admin, 'terms', [
|
||||
'locale' => 'zh-CN', 'title' => '无权限', 'effective_date' => '2026-12-01',
|
||||
'draft_version' => '3', 'content_html' => '<p>无权限。</p>',
|
||||
]), 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' => '<p>Body</p>',
|
||||
], '站点'), 400);
|
||||
$reject(static fn () => LegalDocumentService::preview($admin, 'terms', [
|
||||
'locale' => 'en', 'title' => 'Title', 'effective_date' => '2026-02-30', 'content_html' => '<p>Body</p>',
|
||||
], '站点'), 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' => '<h2 onmouseover="x">数据库异常内容</h2><script>alert(1)</script><p>仍可显示。</p>',
|
||||
]);
|
||||
$sanitizedRead = LegalDocumentService::published('terms', 'zh-CN', '站点');
|
||||
$assert(!str_contains($sanitizedRead['content_html'], '<script')
|
||||
&& !str_contains($sanitizedRead['content_html'], 'onmouseover')
|
||||
&& str_contains($sanitizedRead['content_html'], '仍可显示'),
|
||||
'Public reads trusted unsafe database HTML.');
|
||||
|
||||
$assert(!$schema->hasColumn('legal_documents', 'domain') && !$schema->hasColumn('legal_documents', 'host'),
|
||||
'Legal content was accidentally scoped per domain.');
|
||||
|
||||
echo "Legal document service tests passed.\n";
|
||||
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
$root = dirname(__DIR__, 2);
|
||||
$read = static function (string $path) use ($root): string {
|
||||
$content = file_get_contents($root . '/' . $path);
|
||||
if ($content === false) throw new RuntimeException('Cannot read ' . $path);
|
||||
return $content;
|
||||
};
|
||||
$assert = static function (bool $condition, string $message): void {
|
||||
if (!$condition) throw new RuntimeException($message);
|
||||
};
|
||||
|
||||
$routes = $read('web/config/routes.php');
|
||||
$assert(str_contains($routes, "'/terms', 'App\\Controllers\\LegalController:terms'")
|
||||
&& str_contains($routes, "'/privacy', 'App\\Controllers\\LegalController:privacy'"),
|
||||
'Public legal routes are missing.');
|
||||
foreach (['draft', 'publish'] as $action) {
|
||||
$pattern = "#post\\('/legal/\\{slug:terms\\|privacy\\}/{$action}'.*?LegalController:{$action}'\\)->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";
|
||||
Loading…
Reference in New Issue