feat: refresh admin UI and manage Telegram settings
parent
4c3e98cad7
commit
1e2f8aba60
@ -0,0 +1,460 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Configurations;
|
||||
|
||||
/** Database-backed configuration for the administrator ticket Telegram bot. */
|
||||
final class TicketTelegramConfig
|
||||
{
|
||||
public const ENABLED = 'ticket_telegram_enabled';
|
||||
public const WEBHOOK_BASE_URL = 'ticket_telegram_webhook_base_url';
|
||||
public const BOT_TOKEN = 'ticket_telegram_bot_token_cipher';
|
||||
public const WEBHOOK_SECRET = 'ticket_telegram_webhook_secret_cipher';
|
||||
public const MIGRATION_MARKER = 'ticket_telegram_db_v1';
|
||||
public const BINDING = 'ticket_telegram_binding';
|
||||
|
||||
private const CACHE_KEY = 'ticket_telegram_config_snapshot:v1';
|
||||
private const CACHE_TTL = 60;
|
||||
|
||||
private const KEYS = [
|
||||
self::ENABLED,
|
||||
self::WEBHOOK_BASE_URL,
|
||||
self::BOT_TOKEN,
|
||||
self::WEBHOOK_SECRET,
|
||||
];
|
||||
|
||||
private const SNAPSHOT_KEYS = [
|
||||
self::MIGRATION_MARKER,
|
||||
self::ENABLED,
|
||||
self::WEBHOOK_BASE_URL,
|
||||
self::BOT_TOKEN,
|
||||
self::WEBHOOK_SECRET,
|
||||
];
|
||||
|
||||
public static function publicValues(): array
|
||||
{
|
||||
$rows = self::configurationRows();
|
||||
$enabled = self::truthy($rows[self::ENABLED] ?? 'false');
|
||||
$baseUrl = trim((string) ($rows[self::WEBHOOK_BASE_URL] ?? ''));
|
||||
$tokenConfigured = trim((string) ($rows[self::BOT_TOKEN] ?? '')) !== '';
|
||||
$secretConfigured = trim((string) ($rows[self::WEBHOOK_SECRET] ?? '')) !== '';
|
||||
$configured = false;
|
||||
$configurationError = '';
|
||||
|
||||
if ($tokenConfigured && $secretConfigured && $baseUrl !== '') {
|
||||
try {
|
||||
self::runtimeFromRows($rows, false);
|
||||
$configured = true;
|
||||
} catch (\Throwable $exception) {
|
||||
$configurationError = self::safeConfigurationError($exception);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'enabled' => $enabled,
|
||||
'webhook_base_url' => $baseUrl,
|
||||
'webhook_url' => $baseUrl === '' ? '' : $baseUrl . '/telegram_callback',
|
||||
'bot_token_configured' => $tokenConfigured,
|
||||
'webhook_secret_configured' => $secretConfigured,
|
||||
'configured' => $configured,
|
||||
'configuration_error' => $configurationError,
|
||||
];
|
||||
}
|
||||
|
||||
public static function runtime(bool $requireEnabled = true): array
|
||||
{
|
||||
// Security-critical credential consumers always use the authoritative
|
||||
// database. A stale cache must never revive a rotated webhook secret.
|
||||
$rows = self::authoritativeRows();
|
||||
return self::runtimeFromRows($rows, $requireEnabled);
|
||||
}
|
||||
|
||||
private static function runtimeFromRows(array $rows, bool $requireEnabled): array
|
||||
{
|
||||
$enabled = self::truthy($rows[self::ENABLED] ?? 'false');
|
||||
if ($requireEnabled && !$enabled) {
|
||||
throw new \RuntimeException('Telegram 工单提醒尚未启用');
|
||||
}
|
||||
|
||||
$baseUrl = self::normalizeWebhookBaseUrl($rows[self::WEBHOOK_BASE_URL] ?? '');
|
||||
$token = TicketTelegramCredentialCipher::decrypt((string) ($rows[self::BOT_TOKEN] ?? ''), 'bot_token');
|
||||
$secret = TicketTelegramCredentialCipher::decrypt((string) ($rows[self::WEBHOOK_SECRET] ?? ''), 'webhook_secret');
|
||||
self::assertBotToken($token);
|
||||
self::assertWebhookSecret($secret);
|
||||
if ($baseUrl === '') {
|
||||
throw new \RuntimeException('请在管理员 Telegram 页面配置独立 HTTPS 通信域名');
|
||||
}
|
||||
|
||||
return [
|
||||
'enabled' => $enabled,
|
||||
'webhook_base_url' => $baseUrl,
|
||||
'bot_token' => $token,
|
||||
'webhook_secret' => $secret,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Save non-secret settings and optionally replace the bot token.
|
||||
* An omitted or blank bot_token preserves the existing encrypted token.
|
||||
*/
|
||||
public static function save(array $input): array
|
||||
{
|
||||
self::migrateLegacyOnce(self::readRows(false));
|
||||
$enabled = self::normalizeEnabled($input['enabled'] ?? false);
|
||||
$baseUrl = self::normalizeWebhookBaseUrl($input['webhook_base_url'] ?? '');
|
||||
$newToken = trim((string) ($input['bot_token'] ?? ''));
|
||||
$rotateSecret = self::normalizeEnabled($input['rotate_secret'] ?? false);
|
||||
if ($newToken !== '') {
|
||||
self::assertBotToken($newToken);
|
||||
}
|
||||
|
||||
if ($enabled && $baseUrl === '') {
|
||||
throw new \InvalidArgumentException('启用 Telegram 前必须配置独立 HTTPS 通信域名');
|
||||
}
|
||||
|
||||
$connection = (new Configurations())->getConnection();
|
||||
$connection->transaction(function () use ($enabled, $baseUrl, $newToken, $rotateSecret): void {
|
||||
// The marker is the serialization lock for configuration writes.
|
||||
Configurations::where('name', self::MIGRATION_MARKER)->lockForUpdate()->firstOrFail();
|
||||
// Configuration writes must never depend on a stale Redis snapshot.
|
||||
$rows = self::readRows(false);
|
||||
$existingTokenCipher = trim((string) ($rows[self::BOT_TOKEN] ?? ''));
|
||||
$tokenCipher = $existingTokenCipher;
|
||||
$tokenChanged = false;
|
||||
if ($newToken !== '') {
|
||||
$oldToken = '';
|
||||
if ($existingTokenCipher !== '') {
|
||||
try {
|
||||
$oldToken = TicketTelegramCredentialCipher::decrypt($existingTokenCipher, 'bot_token');
|
||||
} catch (\Throwable $exception) {
|
||||
// Supplying a replacement token must be able to repair unreadable legacy data.
|
||||
$oldToken = '';
|
||||
}
|
||||
}
|
||||
$tokenChanged = $oldToken === '' || !hash_equals($oldToken, $newToken);
|
||||
$tokenCipher = TicketTelegramCredentialCipher::encrypt($newToken, 'bot_token');
|
||||
}
|
||||
if ($tokenCipher === '' && $enabled) {
|
||||
throw new \InvalidArgumentException('启用 Telegram 前必须填写机器人 Token');
|
||||
}
|
||||
if ($enabled) {
|
||||
$finalToken = $newToken !== ''
|
||||
? $newToken
|
||||
: TicketTelegramCredentialCipher::decrypt($tokenCipher, 'bot_token');
|
||||
self::assertBotToken($finalToken);
|
||||
}
|
||||
|
||||
$secretCipher = trim((string) ($rows[self::WEBHOOK_SECRET] ?? ''));
|
||||
if ($secretCipher === '' || $rotateSecret) {
|
||||
$secretCipher = TicketTelegramCredentialCipher::encrypt(self::generateWebhookSecret(), 'webhook_secret');
|
||||
} else {
|
||||
// Refuse to preserve unreadable credentials and report the key problem before writing anything.
|
||||
self::assertWebhookSecret(TicketTelegramCredentialCipher::decrypt($secretCipher, 'webhook_secret'));
|
||||
}
|
||||
self::set(self::ENABLED, $enabled ? 'true' : 'false');
|
||||
self::set(self::WEBHOOK_BASE_URL, $baseUrl);
|
||||
self::set(self::BOT_TOKEN, $tokenCipher);
|
||||
self::set(self::WEBHOOK_SECRET, $secretCipher);
|
||||
self::set(self::MIGRATION_MARKER, '1');
|
||||
if ($tokenChanged) {
|
||||
Configurations::where('name', self::BINDING)->delete();
|
||||
}
|
||||
});
|
||||
self::invalidateCache();
|
||||
|
||||
return self::publicValues();
|
||||
}
|
||||
|
||||
public static function rotateWebhookSecret(): array
|
||||
{
|
||||
self::migrateLegacyOnce(self::readRows(false));
|
||||
$cipher = TicketTelegramCredentialCipher::encrypt(self::generateWebhookSecret(), 'webhook_secret');
|
||||
$connection = (new Configurations())->getConnection();
|
||||
$connection->transaction(function () use ($cipher): void {
|
||||
Configurations::where('name', self::MIGRATION_MARKER)->lockForUpdate()->firstOrFail();
|
||||
self::set(self::WEBHOOK_SECRET, $cipher);
|
||||
self::set(self::MIGRATION_MARKER, '1');
|
||||
});
|
||||
self::invalidateCache();
|
||||
return self::publicValues();
|
||||
}
|
||||
|
||||
private static function migrateLegacyOnce(array $knownRows): void
|
||||
{
|
||||
if (($knownRows[self::MIGRATION_MARKER] ?? '') === '1') {
|
||||
return;
|
||||
}
|
||||
self::ensureRow(self::MIGRATION_MARKER, '0');
|
||||
$connection = (new Configurations())->getConnection();
|
||||
$connection->transaction(function (): void {
|
||||
$marker = Configurations::where('name', self::MIGRATION_MARKER)->lockForUpdate()->firstOrFail();
|
||||
if ((string) $marker->value === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Migration and every transaction deliberately bypass Redis.
|
||||
$existing = self::settingsOnly(self::readRows(false));
|
||||
if ($existing === []) {
|
||||
$enabled = self::truthy(Config::get('enable_telegram', 'false'));
|
||||
$legacyToken = trim((string) Config::get('telegram_token', ''));
|
||||
$legacySecret = trim((string) Config::get('telegram_request_token', ''));
|
||||
$legacyUrl = trim((string) Config::get('tgUrl', ''));
|
||||
$hasLegacy = $enabled || $legacyToken !== '' || $legacySecret !== '' || $legacyUrl !== '';
|
||||
if ($hasLegacy && $legacyUrl === '') {
|
||||
$legacyUrl = trim((string) Config::get('baseUrl', ''));
|
||||
}
|
||||
|
||||
$tokenCipher = '';
|
||||
$secretCipher = '';
|
||||
if ($hasLegacy && self::validBotToken($legacyToken)) {
|
||||
$tokenCipher = TicketTelegramCredentialCipher::encrypt($legacyToken, 'bot_token');
|
||||
}
|
||||
if ($hasLegacy && !self::validWebhookSecret($legacySecret)) {
|
||||
$legacySecret = self::generateWebhookSecret();
|
||||
}
|
||||
if ($hasLegacy) {
|
||||
$secretCipher = TicketTelegramCredentialCipher::encrypt($legacySecret, 'webhook_secret');
|
||||
}
|
||||
$baseUrl = '';
|
||||
if ($hasLegacy) {
|
||||
try {
|
||||
$baseUrl = self::normalizeWebhookBaseUrl($legacyUrl);
|
||||
} catch (\InvalidArgumentException $exception) {
|
||||
// Invalid legacy values must not prevent the administrator from repairing settings.
|
||||
$baseUrl = '';
|
||||
}
|
||||
}
|
||||
|
||||
self::set(self::ENABLED, $enabled ? 'true' : 'false');
|
||||
self::set(self::WEBHOOK_BASE_URL, $baseUrl);
|
||||
self::set(self::BOT_TOKEN, $tokenCipher);
|
||||
self::set(self::WEBHOOK_SECRET, $secretCipher);
|
||||
}
|
||||
$marker->value = '1';
|
||||
$marker->save();
|
||||
});
|
||||
self::invalidateCache();
|
||||
}
|
||||
|
||||
private static function configurationRows(): array
|
||||
{
|
||||
$rows = self::readRows();
|
||||
if (($rows[self::MIGRATION_MARKER] ?? '') !== '1') {
|
||||
self::migrateLegacyOnce($rows);
|
||||
$rows = self::readRows();
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
private static function authoritativeRows(): array
|
||||
{
|
||||
$rows = self::readRows(false);
|
||||
if (($rows[self::MIGRATION_MARKER] ?? '') !== '1') {
|
||||
self::migrateLegacyOnce($rows);
|
||||
$rows = self::readRows(false);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load only raw database values. Secret values remain encrypted in Redis.
|
||||
* Passing false is mandatory inside configuration write transactions.
|
||||
*/
|
||||
private static function readRows(bool $allowCache = true): array
|
||||
{
|
||||
$redis = null;
|
||||
if ($allowCache) {
|
||||
try {
|
||||
$redis = new RedisClient();
|
||||
$cached = $redis->getClient()->get(self::CACHE_KEY);
|
||||
$snapshot = self::decodeCachedSnapshot($cached);
|
||||
if ($snapshot !== null) {
|
||||
return $snapshot;
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
// Redis is an optimization only; the database remains authoritative.
|
||||
}
|
||||
}
|
||||
|
||||
$rows = self::readDatabaseRows();
|
||||
if ($allowCache && self::cacheableSnapshot($rows)) {
|
||||
try {
|
||||
$redis = $redis ?? new RedisClient();
|
||||
$redis->setex(
|
||||
self::CACHE_KEY,
|
||||
self::CACHE_TTL,
|
||||
json_encode($rows, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES)
|
||||
);
|
||||
} catch (\Throwable $exception) {
|
||||
// A cache write failure must not make Telegram configuration unavailable.
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
private static function readDatabaseRows(): array
|
||||
{
|
||||
$rows = [];
|
||||
foreach (Configurations::whereIn('name', self::SNAPSHOT_KEYS)->get(['name', 'value']) as $row) {
|
||||
$rows[(string) $row->name] = (string) $row->value;
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
private static function decodeCachedSnapshot($encoded): ?array
|
||||
{
|
||||
if (!is_string($encoded) || $encoded === '') {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
$rows = json_decode($encoded, true, 16, JSON_THROW_ON_ERROR);
|
||||
} catch (\Throwable $exception) {
|
||||
return null;
|
||||
}
|
||||
return is_array($rows) && self::cacheableSnapshot($rows) ? $rows : null;
|
||||
}
|
||||
|
||||
private static function cacheableSnapshot(array $rows): bool
|
||||
{
|
||||
foreach (self::SNAPSHOT_KEYS as $key) {
|
||||
if (!array_key_exists($key, $rows) || !is_string($rows[$key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $rows[self::MIGRATION_MARKER] === '1'
|
||||
&& TicketTelegramCredentialCipher::isCiphertext($rows[self::BOT_TOKEN])
|
||||
&& TicketTelegramCredentialCipher::isCiphertext($rows[self::WEBHOOK_SECRET]);
|
||||
}
|
||||
|
||||
private static function settingsOnly(array $rows): array
|
||||
{
|
||||
return array_intersect_key($rows, array_fill_keys(self::KEYS, true));
|
||||
}
|
||||
|
||||
private static function invalidateCache(): void
|
||||
{
|
||||
try {
|
||||
(new RedisClient())->del(self::CACHE_KEY);
|
||||
} catch (\Throwable $exception) {
|
||||
// Redis failure cannot roll back a committed database configuration write.
|
||||
}
|
||||
}
|
||||
|
||||
private static function set(string $name, string $value): void
|
||||
{
|
||||
$row = Configurations::where('name', $name)->first();
|
||||
if ($row === null) {
|
||||
$row = new Configurations();
|
||||
$row->name = $name;
|
||||
}
|
||||
$row->value = $value;
|
||||
$row->save();
|
||||
}
|
||||
|
||||
/** Create a configuration row without Eloquent mass assignment. */
|
||||
private static function ensureRow(string $name, string $value): void
|
||||
{
|
||||
if (Configurations::where('name', $name)->first() !== null) {
|
||||
return;
|
||||
}
|
||||
$row = new Configurations();
|
||||
$row->name = $name;
|
||||
$row->value = $value;
|
||||
try {
|
||||
$row->save();
|
||||
} catch (\Throwable $exception) {
|
||||
// A concurrent first request may have inserted the uniquely named row.
|
||||
if (Configurations::where('name', $name)->first() === null) {
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function normalizeEnabled($value): bool
|
||||
{
|
||||
if (is_bool($value)) {
|
||||
return $value;
|
||||
}
|
||||
if (!is_scalar($value) && $value !== null) {
|
||||
throw new \InvalidArgumentException('Telegram 配置字段格式无效');
|
||||
}
|
||||
$value = strtolower(trim((string) $value));
|
||||
if (in_array($value, ['1', 'true', 'yes', 'on'], true)) {
|
||||
return true;
|
||||
}
|
||||
if (in_array($value, ['', '0', 'false', 'no', 'off'], true)) {
|
||||
return false;
|
||||
}
|
||||
throw new \InvalidArgumentException('Telegram 通知开关值无效');
|
||||
}
|
||||
|
||||
private static function truthy($value): bool
|
||||
{
|
||||
return in_array(strtolower(trim((string) $value)), ['1', 'true', 'yes', 'on'], true);
|
||||
}
|
||||
|
||||
private static function normalizeWebhookBaseUrl($value): string
|
||||
{
|
||||
$value = trim((string) $value);
|
||||
if ($value === '') {
|
||||
return '';
|
||||
}
|
||||
if (strlen($value) > 255) {
|
||||
throw new \InvalidArgumentException('Telegram 通信域名不能超过 255 个字符');
|
||||
}
|
||||
if (filter_var($value, FILTER_VALIDATE_URL) === false) {
|
||||
throw new \InvalidArgumentException('Telegram 通信域名必须是有效的 HTTPS 地址');
|
||||
}
|
||||
$parts = parse_url($value);
|
||||
if (!is_array($parts) || strtolower((string) ($parts['scheme'] ?? '')) !== 'https'
|
||||
|| empty($parts['host']) || isset($parts['user']) || isset($parts['pass'])
|
||||
|| isset($parts['query']) || isset($parts['fragment'])
|
||||
|| (!empty($parts['path']) && $parts['path'] !== '/')) {
|
||||
throw new \InvalidArgumentException('Telegram 通信域名仅支持 https://域名[:端口],不要填写路径、账号或参数');
|
||||
}
|
||||
$host = strtolower((string) $parts['host']);
|
||||
if (filter_var($host, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false) {
|
||||
throw new \InvalidArgumentException('Telegram 通信域名中的主机名无效');
|
||||
}
|
||||
$port = isset($parts['port']) ? ':' . (int) $parts['port'] : '';
|
||||
return 'https://' . $host . $port;
|
||||
}
|
||||
|
||||
private static function assertBotToken(string $token): void
|
||||
{
|
||||
if (!self::validBotToken($token)) {
|
||||
throw new \InvalidArgumentException('Telegram 机器人 Token 格式无效');
|
||||
}
|
||||
}
|
||||
|
||||
private static function validBotToken(string $token): bool
|
||||
{
|
||||
return preg_match('/^[1-9][0-9]{4,19}:[A-Za-z0-9_-]{20,128}$/D', $token) === 1;
|
||||
}
|
||||
|
||||
private static function assertWebhookSecret(string $secret): void
|
||||
{
|
||||
if (!self::validWebhookSecret($secret)) {
|
||||
throw new \InvalidArgumentException('Telegram Webhook 密钥格式无效');
|
||||
}
|
||||
}
|
||||
|
||||
private static function validWebhookSecret(string $secret): bool
|
||||
{
|
||||
return preg_match('/^[A-Za-z0-9_-]{16,256}$/D', $secret) === 1;
|
||||
}
|
||||
|
||||
private static function generateWebhookSecret(): string
|
||||
{
|
||||
return rtrim(strtr(base64_encode(random_bytes(32)), '+/', '-_'), '=');
|
||||
}
|
||||
|
||||
private static function safeConfigurationError(\Throwable $exception): string
|
||||
{
|
||||
if (str_contains($exception->getMessage(), 'cloud_payload_key')) {
|
||||
return 'Telegram 凭据无法解密,请检查 cloud_payload_key 配置';
|
||||
}
|
||||
return 'Telegram 配置无效,请在管理员页面重新保存';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Services\Cloud\CloudSecrets;
|
||||
|
||||
/** Encrypts Telegram credentials with a purpose-separated cloud payload key. */
|
||||
final class TicketTelegramCredentialCipher
|
||||
{
|
||||
private const PREFIX = 'sbox:telegram:v1:';
|
||||
private const PURPOSES = ['bot_token', 'webhook_secret'];
|
||||
|
||||
public static function encrypt(string $plainText, string $purpose): string
|
||||
{
|
||||
self::assertPurpose($purpose);
|
||||
if ($plainText === '') {
|
||||
return '';
|
||||
}
|
||||
if (!function_exists('sodium_crypto_secretbox')) {
|
||||
throw new \RuntimeException('PHP sodium 扩展未安装,无法加密 Telegram 凭据');
|
||||
}
|
||||
|
||||
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
|
||||
$cipherText = sodium_crypto_secretbox($plainText, $nonce, self::key($purpose));
|
||||
return self::PREFIX . base64_encode($nonce . $cipherText);
|
||||
}
|
||||
|
||||
public static function decrypt(string $encoded, string $purpose): string
|
||||
{
|
||||
self::assertPurpose($purpose);
|
||||
$encoded = trim($encoded);
|
||||
if ($encoded === '') {
|
||||
return '';
|
||||
}
|
||||
if (!str_starts_with($encoded, self::PREFIX)) {
|
||||
throw new \RuntimeException('Telegram 凭据不是受支持的加密格式,请在后台重新保存');
|
||||
}
|
||||
if (!function_exists('sodium_crypto_secretbox_open')) {
|
||||
throw new \RuntimeException('PHP sodium 扩展未安装,无法解密 Telegram 凭据');
|
||||
}
|
||||
|
||||
$payload = base64_decode(substr($encoded, strlen(self::PREFIX)), true);
|
||||
if ($payload === false || strlen($payload) <= SODIUM_CRYPTO_SECRETBOX_NONCEBYTES) {
|
||||
throw new \RuntimeException('Telegram 凭据密文格式无效,请在后台重新保存');
|
||||
}
|
||||
$plainText = sodium_crypto_secretbox_open(
|
||||
substr($payload, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES),
|
||||
substr($payload, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES),
|
||||
self::key($purpose)
|
||||
);
|
||||
if ($plainText === false) {
|
||||
throw new \RuntimeException('Telegram 凭据解密失败,请检查 cloud_payload_key');
|
||||
}
|
||||
return $plainText;
|
||||
}
|
||||
|
||||
public static function isCiphertext(string $value): bool
|
||||
{
|
||||
return $value === '' || str_starts_with($value, self::PREFIX);
|
||||
}
|
||||
|
||||
private static function key(string $purpose): string
|
||||
{
|
||||
try {
|
||||
$master = CloudSecrets::key('payload_key');
|
||||
} catch (\Throwable $exception) {
|
||||
throw new \RuntimeException(
|
||||
'Telegram 凭据加密密钥不可用,请先配置有效的 cloud_payload_key 或 cloud_payload_key_file'
|
||||
);
|
||||
}
|
||||
return hash_hkdf('sha256', $master, SODIUM_CRYPTO_SECRETBOX_KEYBYTES, 'virt-cloud:telegram:' . $purpose);
|
||||
}
|
||||
|
||||
private static function assertPurpose(string $purpose): void
|
||||
{
|
||||
if (!in_array($purpose, self::PURPOSES, true)) {
|
||||
throw new \InvalidArgumentException('不支持的 Telegram 凭据类型');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,852 @@
|
||||
/* Scoped to cloud admin page content. Never load client styles in venix. */
|
||||
.cloud-admin { margin: 24px 0; }
|
||||
.cloud-admin .cloud-admin-grid { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.5fr); gap: 24px; }
|
||||
.cloud-admin .cloud-admin-imports { display: grid; gap: 24px; align-content: start; }
|
||||
.cloud-admin .cloud-admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
|
||||
.cloud-admin .cloud-admin-full { grid-column: 1 / -1; }
|
||||
.cloud-admin .cloud-admin-host { display: block; width: 100%; text-align: left; margin: 8px 0; }
|
||||
.cloud-admin .cloud-admin-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid #dce3ed; padding: 16px 0; }
|
||||
.cloud-admin .cloud-admin-row input { flex: 1; min-width: 180px; }
|
||||
.cloud-admin .cloud-admin-row .cloud-admin-meta { flex-basis: 100%; overflow-wrap: anywhere; color: #7b8795; }
|
||||
.cloud-admin .cloud-admin-notice { white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.cloud-admin table td { overflow-wrap: anywhere; max-width: 300px; }
|
||||
.cloud-update .cloud-update-details { display: grid; gap: 10px; margin-bottom: 18px; }
|
||||
.cloud-update .cloud-update-details > div { display: grid; grid-template-columns: minmax(110px, .45fr) minmax(0, 1.55fr); gap: 14px; }
|
||||
.cloud-update .cloud-update-details dt { color: #7b8795; font-weight: 500; }
|
||||
.cloud-update .cloud-update-details dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
|
||||
@media (max-width: 900px) { .cloud-admin .cloud-admin-grid, .cloud-admin .cloud-admin-form-grid { grid-template-columns: 1fr; } }
|
||||
/* Venix administrator theme extensions for virtualization pages. */
|
||||
.cloud-admin {
|
||||
padding-bottom: 24px;
|
||||
color: #1d2939;
|
||||
}
|
||||
|
||||
.cloud-admin *,
|
||||
.cloud-admin *::before,
|
||||
.cloud-admin *::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.cloud-admin-page-head {
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.cloud-admin-page-head > .flex-grow-1 {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-page-head h4,
|
||||
.cloud-admin-card-head h5,
|
||||
.cloud-admin-section-title h6 {
|
||||
color: #00081a;
|
||||
}
|
||||
|
||||
.cloud-admin-page-head .text-muted,
|
||||
.cloud-admin-card-head .text-muted {
|
||||
max-width: 840px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.cloud-admin-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.cloud-admin-notice {
|
||||
min-height: 38px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
max-width: min(620px, 100%);
|
||||
margin: 0;
|
||||
padding: 8px 12px;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
font-weight: 800;
|
||||
line-height: 1.4;
|
||||
text-align: left;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.cloud-admin-notice.alert-info {
|
||||
color: #7a4a00;
|
||||
background: rgba(239, 177, 0, 0.16);
|
||||
}
|
||||
|
||||
.cloud-admin-notice.alert-success {
|
||||
color: #08785b;
|
||||
background: rgba(93, 216, 158, 0.16);
|
||||
}
|
||||
|
||||
.cloud-admin-notice.alert-warning {
|
||||
color: #7a4a00;
|
||||
background: rgba(239, 177, 0, 0.18);
|
||||
}
|
||||
|
||||
.cloud-admin-notice.alert-danger {
|
||||
color: #b42318;
|
||||
background: rgba(251, 44, 54, 0.12);
|
||||
}
|
||||
|
||||
.cloud-admin .card {
|
||||
border: 1px solid #e5ebf2;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 8px 28px rgba(0, 8, 26, 0.045);
|
||||
}
|
||||
|
||||
.cloud-admin .card-body {
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.cloud-admin-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(280px, 0.92fr) minmax(420px, 1.35fr);
|
||||
gap: 18px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.cloud-admin-host-layout {
|
||||
grid-template-columns: minmax(260px, 0.68fr) minmax(540px, 1.5fr);
|
||||
}
|
||||
|
||||
.cloud-admin-catalog-layout {
|
||||
grid-template-columns: minmax(360px, 0.95fr) minmax(440px, 1.2fr);
|
||||
}
|
||||
|
||||
.cloud-admin-rescue-layout,
|
||||
.cloud-update-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.cloud-admin-imports,
|
||||
.cloud-admin-side,
|
||||
.cloud-admin-fields {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.cloud-admin-side {
|
||||
position: sticky;
|
||||
top: 92px;
|
||||
}
|
||||
|
||||
.cloud-admin-card-head {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.cloud-admin-card-head > div {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-card-head-compact {
|
||||
align-items: center;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-card-icon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
border-radius: 9px;
|
||||
color: #08785b;
|
||||
background: rgba(93, 216, 158, 0.16);
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.cloud-admin-card-icon.is-warning {
|
||||
color: #9a5d00;
|
||||
background: rgba(239, 177, 0, 0.18);
|
||||
}
|
||||
|
||||
.cloud-admin-guidance {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
margin-bottom: 18px;
|
||||
padding: 14px 16px;
|
||||
border: 1px solid rgba(93, 216, 158, 0.3);
|
||||
border-radius: 9px;
|
||||
color: #315a50;
|
||||
background: rgba(93, 216, 158, 0.09);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.cloud-admin-guidance.alert-warning {
|
||||
border-color: rgba(239, 177, 0, 0.36);
|
||||
color: #6e4b0b;
|
||||
background: rgba(239, 177, 0, 0.11);
|
||||
}
|
||||
|
||||
.cloud-admin-guidance > i {
|
||||
flex: 0 0 auto;
|
||||
margin-top: 1px;
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
.cloud-admin-feature-copy {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.cloud-admin-feature-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.cloud-admin-switch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
margin: 0;
|
||||
color: #344054;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cloud-admin-switch input {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-switch > span {
|
||||
position: relative;
|
||||
width: 42px;
|
||||
height: 24px;
|
||||
flex: 0 0 auto;
|
||||
border-radius: 999px;
|
||||
background: #cbd5e1;
|
||||
transition: background 0.18s ease;
|
||||
}
|
||||
|
||||
.cloud-admin-switch > span::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 4px rgba(0, 8, 26, 0.22);
|
||||
transition: transform 0.18s ease;
|
||||
}
|
||||
|
||||
.cloud-admin-switch input:checked + span {
|
||||
background: #18a87f;
|
||||
}
|
||||
|
||||
.cloud-admin-switch input:checked + span::after {
|
||||
transform: translateX(18px);
|
||||
}
|
||||
|
||||
.cloud-admin-switch input:focus-visible + span {
|
||||
outline: 3px solid rgba(24, 168, 127, 0.2);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.cloud-admin-switch input:disabled ~ * {
|
||||
opacity: 0.58;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.cloud-admin-host-list,
|
||||
.cloud-admin-catalog-list {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.cloud-admin-host-list {
|
||||
max-height: 520px;
|
||||
overflow-y: auto;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
.cloud-admin .cloud-admin-host {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 64px;
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 12px 42px 12px 14px;
|
||||
border: 1px solid #dce5ef;
|
||||
border-radius: 8px;
|
||||
color: #00081a;
|
||||
background: #fbfcfe;
|
||||
text-align: left;
|
||||
transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
|
||||
}
|
||||
|
||||
.cloud-admin .cloud-admin-host::after {
|
||||
content: "\F0142";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 14px;
|
||||
color: #8a99aa;
|
||||
font-family: "Material Design Icons";
|
||||
font-size: 20px;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.cloud-admin .cloud-admin-host:hover,
|
||||
.cloud-admin .cloud-admin-host:focus-visible {
|
||||
border-color: rgba(93, 216, 158, 0.62);
|
||||
color: #08785b;
|
||||
background: rgba(93, 216, 158, 0.08);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.cloud-admin .cloud-admin-host strong {
|
||||
display: block;
|
||||
margin-bottom: 3px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.cloud-admin .cloud-admin-host .text-muted {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.cloud-admin-guide-card {
|
||||
background: linear-gradient(145deg, rgba(93, 216, 158, 0.09), #fff 68%);
|
||||
}
|
||||
|
||||
.cloud-admin-form-section {
|
||||
padding: 20px 0;
|
||||
border-top: 1px solid #e8eef5;
|
||||
}
|
||||
|
||||
.cloud-admin-form-section:first-of-type {
|
||||
padding-top: 2px;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-section-title {
|
||||
display: grid;
|
||||
grid-template-columns: 42px minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.cloud-admin-section-title > span {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8px;
|
||||
color: #08785b;
|
||||
background: rgba(93, 216, 158, 0.14);
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
.cloud-admin-section-title h6,
|
||||
.cloud-admin-section-title p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-section-title h6 {
|
||||
font-size: 15px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.cloud-admin-section-title p {
|
||||
margin-top: 3px;
|
||||
color: #7c8ba0;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.cloud-admin-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.cloud-admin-full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.cloud-admin .form-label {
|
||||
margin-bottom: 7px;
|
||||
color: #344054;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.cloud-admin .form-control,
|
||||
.cloud-admin .form-select {
|
||||
min-height: 44px;
|
||||
border-color: #dce5ef;
|
||||
border-radius: 8px;
|
||||
color: #1d2939;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.cloud-admin textarea.form-control {
|
||||
min-height: 112px;
|
||||
line-height: 1.55;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.cloud-admin .form-control:focus,
|
||||
.cloud-admin .form-select:focus {
|
||||
border-color: rgba(24, 168, 127, 0.62);
|
||||
box-shadow: 0 0 0 3px rgba(24, 168, 127, 0.1);
|
||||
}
|
||||
|
||||
.cloud-admin .form-text {
|
||||
margin-top: 7px;
|
||||
color: #7c8ba0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.cloud-admin-fingerprint-box {
|
||||
padding: 14px;
|
||||
border: 1px solid #dce5ef;
|
||||
border-radius: 8px;
|
||||
background: #fbfcfe;
|
||||
}
|
||||
|
||||
.cloud-admin-fingerprint {
|
||||
min-height: 0;
|
||||
margin: 12px 0;
|
||||
color: #08785b;
|
||||
font-size: 13px;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.cloud-admin-fingerprint:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cloud-admin-form-footer,
|
||||
.cloud-admin-submit,
|
||||
.cloud-admin-form-actions,
|
||||
.cloud-update-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.cloud-admin-form-footer {
|
||||
padding-top: 18px;
|
||||
border-top: 1px solid #e8eef5;
|
||||
}
|
||||
|
||||
.cloud-admin-submit,
|
||||
.cloud-admin-form-actions,
|
||||
.cloud-update-actions {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.cloud-admin-form-actions {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.cloud-admin-submit #host-form-error {
|
||||
max-width: 420px;
|
||||
font-weight: 700;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.cloud-admin-filter-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.cloud-admin-select-wrap {
|
||||
position: relative;
|
||||
width: min(420px, 100%);
|
||||
flex: 0 1 420px;
|
||||
}
|
||||
|
||||
.cloud-admin-select-wrap > i {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 14px;
|
||||
z-index: 2;
|
||||
color: #08785b;
|
||||
font-size: 20px;
|
||||
pointer-events: none;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.cloud-admin-select-wrap .form-select {
|
||||
padding-left: 44px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.cloud-admin-catalog-card {
|
||||
position: sticky;
|
||||
top: 92px;
|
||||
}
|
||||
|
||||
.cloud-admin-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(180px, 1fr) auto auto;
|
||||
gap: 9px;
|
||||
align-items: center;
|
||||
padding: 13px;
|
||||
border: 1px solid #dce5ef;
|
||||
border-radius: 8px;
|
||||
background: #fbfcfe;
|
||||
}
|
||||
|
||||
.cloud-admin-row:hover {
|
||||
border-color: rgba(93, 216, 158, 0.55);
|
||||
background: rgba(93, 216, 158, 0.06);
|
||||
}
|
||||
|
||||
.cloud-admin-row .cloud-admin-meta {
|
||||
grid-column: 1 / -1;
|
||||
color: #7c8ba0;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.cloud-admin-catalog-list > .text-muted {
|
||||
margin: 0;
|
||||
padding: 24px;
|
||||
border: 1px dashed #dce5ef;
|
||||
border-radius: 8px;
|
||||
background: #fbfcfe;
|
||||
text-align: center;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.cloud-admin-support-note,
|
||||
.cloud-update-warning {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 9px;
|
||||
margin: 18px 0 0;
|
||||
padding: 12px 14px;
|
||||
border-radius: 8px;
|
||||
color: #526579;
|
||||
background: #f4f7fa;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.cloud-admin-support-note i,
|
||||
.cloud-update-warning i {
|
||||
flex: 0 0 auto;
|
||||
color: #08785b;
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
.cloud-admin-table-card .card-body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-table-card .cloud-admin-card-head {
|
||||
margin: 0;
|
||||
padding: 22px;
|
||||
border-bottom: 1px solid #e8eef5;
|
||||
}
|
||||
|
||||
.cloud-admin-table-wrap {
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.cloud-admin-table {
|
||||
min-width: 820px;
|
||||
}
|
||||
|
||||
.cloud-admin-table thead th {
|
||||
padding: 13px 16px;
|
||||
border-bottom: 1px solid #e2e9f0;
|
||||
color: #718096;
|
||||
background: #f7f9fc;
|
||||
font-size: 12px;
|
||||
font-weight: 900;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cloud-admin-table td {
|
||||
max-width: 320px;
|
||||
padding: 15px 16px;
|
||||
border-color: #edf1f5;
|
||||
color: #344054;
|
||||
font-weight: 700;
|
||||
line-height: 1.55;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.cloud-admin-table tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-placeholder td {
|
||||
padding: 32px;
|
||||
color: #7c8ba0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cloud-update-details {
|
||||
display: grid;
|
||||
gap: 0;
|
||||
margin: 0 0 20px;
|
||||
border: 1px solid #e5ebf2;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.cloud-update-details > div {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(112px, 0.42fr) minmax(0, 1.58fr);
|
||||
gap: 14px;
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid #e8eef5;
|
||||
background: #fbfcfe;
|
||||
}
|
||||
|
||||
.cloud-update-details > div:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.cloud-update-details dt {
|
||||
color: #7b8795;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.cloud-update-details dd {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
color: #172033;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.cloud-update-credential {
|
||||
padding: 16px;
|
||||
border: 1px solid #e5ebf2;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.cloud-update-job-details {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 1px;
|
||||
border: 0;
|
||||
background: #e8eef5;
|
||||
}
|
||||
|
||||
.cloud-update-job-details > div {
|
||||
grid-template-columns: minmax(90px, 0.38fr) minmax(0, 1fr);
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.cloud-update-warning {
|
||||
color: #6e4b0b;
|
||||
background: rgba(239, 177, 0, 0.11);
|
||||
}
|
||||
|
||||
.cloud-update-warning i {
|
||||
color: #9a5d00;
|
||||
}
|
||||
|
||||
@media (max-width: 1199.98px) {
|
||||
.cloud-admin-host-layout,
|
||||
.cloud-admin-catalog-layout {
|
||||
grid-template-columns: minmax(240px, 0.72fr) minmax(430px, 1.28fr);
|
||||
}
|
||||
|
||||
.cloud-admin-feature-card .cloud-admin-card-head {
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991.98px) {
|
||||
.cloud-admin-grid,
|
||||
.cloud-admin-host-layout,
|
||||
.cloud-admin-catalog-layout,
|
||||
.cloud-admin-rescue-layout,
|
||||
.cloud-update-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.cloud-admin-side,
|
||||
.cloud-admin-catalog-card {
|
||||
position: static;
|
||||
}
|
||||
|
||||
.cloud-admin-host-list {
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.cloud-update-job-details {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
.cloud-admin-page-head {
|
||||
align-items: stretch !important;
|
||||
flex-direction: column !important;
|
||||
}
|
||||
|
||||
.cloud-admin-actions,
|
||||
.cloud-admin-notice {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cloud-admin-actions .btn {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.cloud-admin .card-body,
|
||||
.cloud-admin-table-card .cloud-admin-card-head {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.cloud-admin-feature-card .cloud-admin-card-head,
|
||||
.cloud-admin-feature-actions,
|
||||
.cloud-admin-filter-row {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.cloud-admin-feature-actions,
|
||||
.cloud-admin-feature-actions .btn,
|
||||
.cloud-admin-select-wrap {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cloud-admin-form-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.cloud-admin-full {
|
||||
grid-column: auto;
|
||||
}
|
||||
|
||||
.cloud-admin-table-wrap {
|
||||
padding: 12px;
|
||||
overflow-x: visible;
|
||||
}
|
||||
|
||||
.cloud-admin-table,
|
||||
.cloud-admin-table tbody,
|
||||
.cloud-admin-table tr,
|
||||
.cloud-admin-table td {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cloud-admin-table {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-table thead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cloud-admin-table tr {
|
||||
margin-bottom: 12px;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid #dce5ef;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.cloud-admin-table tr:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-table td {
|
||||
max-width: none;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(92px, 0.36fr) minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
padding: 8px 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.cloud-admin-table td::before {
|
||||
content: attr(data-label);
|
||||
color: #718096;
|
||||
font-size: 12px;
|
||||
font-weight: 900;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.cloud-admin-placeholder td {
|
||||
display: block;
|
||||
padding: 22px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cloud-admin-placeholder td::before {
|
||||
content: none;
|
||||
}
|
||||
|
||||
.cloud-update-details > div,
|
||||
.cloud-update-job-details > div {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 575.98px) {
|
||||
.cloud-admin-card-head:not(.cloud-admin-card-head-compact) {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.cloud-admin-card-icon {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
.cloud-admin-row {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.cloud-admin-row .form-control,
|
||||
.cloud-admin-row .cloud-admin-meta {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.cloud-admin-row .btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cloud-admin-form-footer,
|
||||
.cloud-admin-submit,
|
||||
.cloud-admin-form-actions,
|
||||
.cloud-update-actions {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.cloud-admin-form-footer .btn,
|
||||
.cloud-admin-submit,
|
||||
.cloud-admin-submit .btn,
|
||||
.cloud-admin-form-actions .btn,
|
||||
.cloud-update-actions .btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cloud-admin-feature-copy {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.cloud-admin-table td {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,2 +1,41 @@
|
||||
{assign var=admin_title value='虚拟机实例'}{assign var=admin_active value='cloud_instances'}{include file='admin/static_header.tpl'}
|
||||
<link rel="stylesheet" href="/cloud/admin.css"><section class="cloud-admin" data-cloud-admin="instances"><h4>虚拟机实例</h4><p class="text-muted">跨宿主机查看已关联的实例和所属用户。客户的资源与操作权限由后台校验。</p><p id="cloud-admin-status" class="alert alert-info cloud-admin-notice" role="status">正在加载…</p><button id="admin-records-refresh" class="btn btn-outline-primary mb-3" type="button">刷新</button><div class="card"><div class="card-body table-responsive"><table class="table"><thead><tr><th>实例</th><th>用户</th><th>宿主机</th><th>状态</th><th>公网 IP</th><th>配置</th></tr></thead><tbody id="admin-records"></tbody></table></div></div></section><script type="module" src="/cloud/admin.js?v={$venix_asset_version}"></script>{include file='admin/static_footer.tpl'}
|
||||
{assign var=admin_title value='虚拟机实例'}
|
||||
{assign var=admin_active value='cloud-instances'}
|
||||
{include file='admin/static_header.tpl'}
|
||||
|
||||
<link rel="stylesheet" href="/cloud/admin.css?v={$venix_asset_version}">
|
||||
<section class="cloud-admin" data-cloud-admin="instances">
|
||||
<div class="py-3 d-flex align-items-sm-center flex-sm-row flex-column cloud-admin-page-head">
|
||||
<div class="flex-grow-1">
|
||||
<p class="admin-eyebrow mb-1">Compute</p>
|
||||
<h4 class="fs-20 fw-semibold mb-1">虚拟机实例</h4>
|
||||
<p class="text-muted mb-0">跨宿主机查看已关联的实例、所属用户与资源配置。</p>
|
||||
</div>
|
||||
<div class="text-sm-end mt-3 mt-sm-0 cloud-admin-actions">
|
||||
<p id="cloud-admin-status" class="alert alert-info cloud-admin-notice" role="status" aria-live="polite">正在加载…</p>
|
||||
<button id="admin-records-refresh" class="btn btn-light" type="button">
|
||||
<i class="mdi mdi-refresh me-1"></i>刷新
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card cloud-admin-table-card">
|
||||
<div class="card-body">
|
||||
<div class="cloud-admin-card-head">
|
||||
<div>
|
||||
<p class="admin-eyebrow mb-1">Instances</p>
|
||||
<h5 class="mb-1">实例目录</h5>
|
||||
<p class="text-muted mb-0">客户资源与操作权限仍由后台校验,此页面仅用于集中查看。</p>
|
||||
</div>
|
||||
<span class="cloud-admin-card-icon"><i class="mdi mdi-server-network"></i></span>
|
||||
</div>
|
||||
<div class="table-responsive cloud-admin-table-wrap">
|
||||
<table class="table table-hover align-middle mb-0 cloud-admin-table">
|
||||
<thead><tr><th>实例</th><th>用户</th><th>宿主机</th><th>状态</th><th>公网 IP</th><th>配置</th></tr></thead>
|
||||
<tbody id="admin-records"><tr class="cloud-admin-placeholder"><td colspan="6">实例数据加载中</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script type="module" src="/cloud/admin.js?v={$venix_asset_version}"></script>
|
||||
{include file='admin/static_footer.tpl'}
|
||||
|
||||
@ -1,2 +1,46 @@
|
||||
{assign var=admin_title value='开通任务'}{assign var=admin_active value='cloud-orders'}{include file='admin/static_header.tpl'}
|
||||
<link rel="stylesheet" href="/cloud/admin.css"><section class="cloud-admin" data-cloud-admin="orders"><h4>实例开通任务</h4><p class="text-muted">用户提交部署后先生成开通账单,只有账单支付成功才会在此进入创建队列。失败或不确定的任务需核查实际宿主机状态,不要重复创建或扣款。</p><p id="cloud-admin-status" class="alert alert-info cloud-admin-notice" role="status">正在加载…</p><button id="admin-records-refresh" class="btn btn-outline-primary mb-3" type="button">刷新</button><div class="card"><div class="card-body table-responsive"><table class="table"><thead><tr><th>任务</th><th>用户</th><th>套餐</th><th>金额</th><th>状态</th><th>实例 / 引擎任务</th><th>时间 / 错误</th></tr></thead><tbody id="admin-records"></tbody></table></div></div></section><script type="module" src="/cloud/admin.js?v={$venix_asset_version}"></script>{include file='admin/static_footer.tpl'}
|
||||
{assign var=admin_title value='开通任务'}
|
||||
{assign var=admin_active value='cloud-orders'}
|
||||
{include file='admin/static_header.tpl'}
|
||||
|
||||
<link rel="stylesheet" href="/cloud/admin.css?v={$venix_asset_version}">
|
||||
<section class="cloud-admin" data-cloud-admin="orders">
|
||||
<div class="py-3 d-flex align-items-sm-center flex-sm-row flex-column cloud-admin-page-head">
|
||||
<div class="flex-grow-1">
|
||||
<p class="admin-eyebrow mb-1">Provisioning</p>
|
||||
<h4 class="fs-20 fw-semibold mb-1">实例开通任务</h4>
|
||||
<p class="text-muted mb-0">跟踪账单支付后的创建队列、引擎任务与异常结果。</p>
|
||||
</div>
|
||||
<div class="text-sm-end mt-3 mt-sm-0 cloud-admin-actions">
|
||||
<p id="cloud-admin-status" class="alert alert-info cloud-admin-notice" role="status" aria-live="polite">正在加载…</p>
|
||||
<button id="admin-records-refresh" class="btn btn-light" type="button">
|
||||
<i class="mdi mdi-refresh me-1"></i>刷新
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-warning cloud-admin-guidance" role="note">
|
||||
<i class="mdi mdi-shield-alert-outline"></i>
|
||||
<span>失败或不确定的任务需先核查实际宿主机状态,避免重复创建实例或重复扣款。</span>
|
||||
</div>
|
||||
|
||||
<div class="card cloud-admin-table-card">
|
||||
<div class="card-body">
|
||||
<div class="cloud-admin-card-head">
|
||||
<div>
|
||||
<p class="admin-eyebrow mb-1">Tasks</p>
|
||||
<h5 class="mb-1">任务记录</h5>
|
||||
<p class="text-muted mb-0">只有账单支付成功后,部署请求才会进入创建队列。</p>
|
||||
</div>
|
||||
<span class="cloud-admin-card-icon is-warning"><i class="mdi mdi-progress-wrench"></i></span>
|
||||
</div>
|
||||
<div class="table-responsive cloud-admin-table-wrap">
|
||||
<table class="table table-hover align-middle mb-0 cloud-admin-table">
|
||||
<thead><tr><th>任务</th><th>用户</th><th>套餐</th><th>金额</th><th>状态</th><th>实例 / 引擎任务</th><th>时间 / 错误</th></tr></thead>
|
||||
<tbody id="admin-records"><tr class="cloud-admin-placeholder"><td colspan="7">任务数据加载中</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script type="module" src="/cloud/admin.js?v={$venix_asset_version}"></script>
|
||||
{include file='admin/static_footer.tpl'}
|
||||
|
||||
@ -1 +1 @@
|
||||
{assign var=venix_asset_version value='2026092902' scope='global'}
|
||||
{assign var=venix_asset_version value='2026092903' scope='global'}
|
||||
|
||||
Loading…
Reference in New Issue