saveFile('README.md', $pagesReadme); $setupResults['pages_dir'] = [ 'success' => $result1, 'path' => 'pages/README.md', 'message' => $result1 ? 'Pages directory created successfully' : 'Failed to create pages directory' ]; // 2. 创建 users 目录 if ($result1) { $usersReadme = "# VvvebJs Users Directory This directory contains individual user folders for VvvebJs. ## User Isolation Each user gets their own directory to store HTML pages: - User directories are named after the username - Files are automatically organized by user - No user can access another user's files Generated: " . date('Y-m-d H:i:s') . " UTC "; $result2 = $githubStorage->saveFile('users/README.md', $usersReadme); $setupResults['users_dir'] = [ 'success' => $result2, 'path' => 'pages/users/README.md', 'message' => $result2 ? 'Users directory created successfully' : 'Failed to create users directory' ]; // 3. 创建当前用户目录 if ($result2) { $userReadme = "# VvvebJs User Directory: $currentUser This is your personal directory for HTML pages created with VvvebJs. ## Your Information - Username: $currentUser - Directory: pages/$userPath - Created: " . date('Y-m-d H:i:s') . " UTC ## Usage All your HTML files will be saved in this directory automatically. You can only access and modify files in your own directory. Happy building! 🚀 "; $result3 = $githubStorage->saveFile($userPath . 'README.md', $userReadme); $setupResults['user_dir'] = [ 'success' => $result3, 'path' => 'pages/' . $userPath . 'README.md', 'message' => $result3 ? "Personal directory created for user: $currentUser" : 'Failed to create personal directory' ]; // 4. 创建一个示例 HTML 文件 if ($result3) { $sampleHtml = '
✅ Your VvvebJs environment is now ready!
Personal Directory: pages/' . htmlspecialchars($userPath) . '
Repository: ' . htmlspecialchars($github['owner']) . '/' . htmlspecialchars($github['repo']) . '
Branch: ' . htmlspecialchars($github['branch']) . '
Created: ' . date('Y-m-d H:i:s') . ' UTC
File: welcome-sample.html
Status: Active
根据日志信息,GitHub API 返回 404 错误,表示 pages/ 目录在仓库中不存在。
此工具将自动创建所需的目录结构来解决这个问题。
GitHub 仓库: = htmlspecialchars($github['owner']) ?>/= htmlspecialchars($github['repo']) ?>
分支: = htmlspecialchars($github['branch']) ?>
基础路径: = htmlspecialchars($github['path']) ?>
当前用户: = htmlspecialchars($currentUser) ?>
用户路径: = htmlspecialchars($userPath) ?>
完整路径: = htmlspecialchars($github['path'] . $userPath) ?>
pages/
pages/users/
pages/= htmlspecialchars(trim($userPath, '/')) ?>/
= htmlspecialchars($setupResults['overall']['message']) ?>
= htmlspecialchars($result['path'] ?? '') ?>
= htmlspecialchars($result['message']) ?>
= htmlspecialchars($setupResults['error']['message']) ?>
GitHub API 在访问不存在的路径时会返回 404 错误。VvvebJs 需要特定的目录结构:
pages/ - 所有HTML页面的基础目录pages/users/ - 用户隔离目录pages/users/用户名/ - 每个用户的个人目录创建这些目录后,VvvebJs 就能正常保存和读取文件了。
常见原因和解决方案:
repo权限可以使用其他测试工具进一步诊断问题。