mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
- Introduced a new GitHubSetupStep component for GitHub CLI configuration during the setup process. - Updated SetupView to include the GitHub step in the setup flow, allowing users to skip or proceed based on their GitHub CLI status. - Enhanced state management to track GitHub CLI installation and authentication status. - Added logging for transitions between setup steps to improve user feedback. - Updated related files to ensure cross-platform path normalization and compatibility.
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
/**
|
|
* POST /delete-board-background endpoint - Delete board background image
|
|
*/
|
|
|
|
import type { Request, Response } from "express";
|
|
import fs from "fs/promises";
|
|
import path from "path";
|
|
import { getErrorMessage, logError } from "../common.js";
|
|
import { getBoardDir } from "../../../lib/automaker-paths.js";
|
|
|
|
export function createDeleteBoardBackgroundHandler() {
|
|
return async (req: Request, res: Response): Promise<void> => {
|
|
try {
|
|
const { projectPath } = req.body as { projectPath: string };
|
|
|
|
if (!projectPath) {
|
|
res.status(400).json({
|
|
success: false,
|
|
error: "projectPath is required",
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Get board directory
|
|
const boardDir = getBoardDir(projectPath);
|
|
|
|
try {
|
|
// Try to remove all background files in the board directory
|
|
const files = await fs.readdir(boardDir);
|
|
for (const file of files) {
|
|
if (file.startsWith("background")) {
|
|
await fs.unlink(path.join(boardDir, file));
|
|
}
|
|
}
|
|
} catch {
|
|
// Directory may not exist, that's fine
|
|
}
|
|
|
|
res.json({ success: true });
|
|
} catch (error) {
|
|
logError(error, "Delete board background failed");
|
|
res.status(500).json({ success: false, error: getErrorMessage(error) });
|
|
}
|
|
};
|
|
}
|