fix cwd loading, cat imgs

This commit is contained in:
Chris Wanstrath 2025-09-28 16:05:58 -07:00
parent d3504d09f3
commit bdb6fcdf05
2 changed files with 4 additions and 3 deletions

View File

@ -36,7 +36,7 @@ async function readFile(path: string): Promise<CommandOutput> {
switch (ext) {
case "jpeg": case "jpg": case "png": case "gif": case "webp":
const img = await file.arrayBuffer()
return { html: `<img src="data:image/${ext};base64,${Buffer.from(img).toString('base64')}" />` }
return { html: `<img src="data:image/${ext};base64,${Buffer.from(img).toString('base64')}" style="max-height:270px;max-width:480px;" />` }
case "mp3": case "wav":
case "mp4": case "mov": case "avi": case "mkv": case "webm":
return "Not implemented"

View File

@ -6,7 +6,8 @@ export default function (project: string) {
if (state && apps().includes(project)) {
state.project = project
state.cwd = ""
} else {
return { error: `failed to load ${project}` }
}
return state?.project ? `loaded ${project}` : { error: `failed to load ${project}` }
}