isLoggedIn()) { $authenticated = true; } else { // Fallback to Basic Auth for environment variables if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { $users = StorageConfig::getUsers(); $username = $_SERVER['PHP_AUTH_USER']; $password = $_SERVER['PHP_AUTH_PW']; if (isset($users[$username]) && $users[$username] === $password) { $authenticated = true; } } } if (!$authenticated) { header('WWW-Authenticate: Basic realm="VvvebJs Configuration"'); header('HTTP/1.0 401 Unauthorized'); die('Authentication required'); } ?> VvvebJs Configuration

🔧 VvvebJs 配置状态

👥 用户管理系统

✅ 环境变量用户系统 (简单高效)
'; echo '
📊 已配置 ' . count($envUsers) . ' 个用户账号
'; foreach ($envUsers as $username => $password) { echo '
👤 用户: ' . htmlspecialchars($username) . '
'; } if ($userManager->isLoggedIn()) { echo '
🔐 当前登录用户: ' . htmlspecialchars($userManager->getCurrentUser()) . '
'; } } else { echo '
❌ 未找到用户配置
'; echo '
请检查环境变量 USER_1_NAME, USER_1_PASSWORD 等设置
'; } ?>

💡 用户管理特性

  • ✅ 基于环境变量配置,安全可靠
  • ✅ 用户数据按账号隔离存储
  • ✅ GitHub仓库按用户目录分类
  • ✅ 支持session登录,用户体验良好
  • ✅ 无注册功能,管理员完全控制

💾 存储配置

📁 Storage Type: ' . htmlspecialchars($storageType) . '
'; if (in_array($storageType, ['github', 'both'])) { echo '

GitHub Storage

'; $github = StorageConfig::getGitHubConfig(); if (empty($github['token'])) { echo '
❌ GitHub token not configured
'; $configOk = false; $errors[] = 'GitHub token missing'; } else { echo '
✅ GitHub token configured
'; } if (empty($github['owner']) || empty($github['repo'])) { echo '
❌ GitHub owner/repo not configured
'; $configOk = false; $errors[] = 'GitHub repository not configured'; } else { echo '
✅ Repository: ' . htmlspecialchars($github['owner']) . '/' . htmlspecialchars($github['repo']) . '
'; echo '
🌿 Branch: ' . htmlspecialchars($github['branch']) . '
'; echo '
📂 Path: ' . htmlspecialchars($github['path']) . '
'; echo '
🔗 用户文件存储结构: ' . htmlspecialchars($github['path']) . 'users/{username}/*.html
'; } } if (in_array($storageType, ['kv', 'both'])) { echo '

EdgeOne KV Storage

'; $kv = StorageConfig::getKVConfig(); if (empty($kv['api_key'])) { echo '
⚠️ EdgeOne KV API key not configured
'; } else { echo '
✅ EdgeOne KV configured
'; } } ?>

⚙️ 系统状态

✅ 系统配置正常
'; } else { echo '
❌ 系统配置有问题
'; foreach ($errors as $error) { echo '
 - ' . htmlspecialchars($error) . '
'; } } ?>

🚀 快速操作

📁 文件结构说明

GitHub 存储结构
pages/
├── users/
│   ├── PS01/
│   │   ├── index.html
│   │   └── about.html
│   ├── PS02/
│   │   ├── portfolio.html
│   │   └── contact.html
│   ├── PS03/
│   │   └── blog.html
│   └── PS04/
│       └── products.html

说明: 每个用户只能访问和编辑自己目录下的文件,实现完全的数据隔离。