Add comprehensive documentation and download feature (#83)

* fix: markdown files now default to rendered view and render properly

- Add .md and .mdx MIME type support in backend (files.ts, defaults.ts)
- Add key props to FilePreview components to force proper remounting when switching files
- Fix markdown file detection with case-insensitive extension check
- Reset markdownPreview state when file changes to ensure correct default view
- Add onContentLoaded callback to VirtualizedTextView for reactive content updates
- Add fullContent state to properly handle large markdown file rendering
- Add error handling for async content loading to prevent blank screens
- Reduce loading timeout from 50ms to 0ms for more responsive loading

Fixes issues where:
- Markdown files opened in raw view instead of rendered view
- Large markdown files (12k+ lines) showed blank after loading completed
- State persisted incorrectly when switching between different file types

* Add directory download feature with ZIP archive support

* Improve voice recording UX with loading states and better transcript handling

* Fix auth config for prod/dev ports and add documentation

Update AUTH_TRUSTED_ORIGINS and PASSKEY_ORIGIN to use backend port 5003 (frontend uses 5173 in dev). Add comprehensive auth documentation covering secrets, trusted origins, admin reset, and passkeys. Update README and add mkdocs config.

* Remove roadmap section from README
This commit is contained in:
Chris Scott authored and GitHub committed 2026-01-26 23:09:27 -05:00
1 parent 358abbf20e
commit da6cad8b3a
51 files changed
+4276 -353

No files matched your search

+40
View File
@@ -1,12 +1,52 @@
import { Hono } from 'hono'
import type { ContentfulStatusCode } from 'hono/utils/http-status'
import * as fileService from '../services/files'
import * as archiveService from '../services/archive'
import { logger } from '../utils/logger'
import { getErrorMessage, getStatusCode } from '../utils/error-utils'
export function createFileRoutes() {
const app = new Hono()
app.get('/*/download-zip', async (c) => {
try {
const userPath = c.req.path.replace(/^\/api\/files\/(.*)\/download-zip$/, '$1')
if (!userPath) {
return c.json({ error: 'No path provided' }, 400)
}
logger.info(`Starting ZIP archive creation for ${userPath}`)
const archivePath = await archiveService.createDirectoryArchive(userPath)
const archiveSize = await archiveService.getArchiveSize(archivePath)
const archiveStream = archiveService.getArchiveStream(archivePath)
const dirName = userPath.split('/').pop() || 'download'
logger.info(`ZIP archive created: ${archivePath} (${archiveSize} bytes)`)
archiveStream.on('end', () => {
archiveService.deleteArchive(archivePath)
})
archiveStream.on('error', () => {
archiveService.deleteArchive(archivePath)
})
return new Response(archiveStream as unknown as ReadableStream, {
status: 200,
headers: {
'Content-Type': 'application/zip',
'Content-Disposition': `attachment; filename="${dirName}.zip"`,
'Content-Length': archiveSize.toString(),
},
})
} catch (error: unknown) {
logger.error('Failed to create directory archive:', error)
return c.json({ error: getErrorMessage(error) || 'Failed to create archive' }, getStatusCode(error) as ContentfulStatusCode)
}
})
app.get('/*', async (c) => {
try {
const userPath = c.req.path.replace(/^\/api\/files\//, '') || ''
+38
View File
@@ -153,6 +153,44 @@ export async function createRepoArchive(repoPath: string): Promise<string> {
})
}
export async function createDirectoryArchive(directoryPath: string, archiveName?: string): Promise<string> {
const dirName = archiveName || path.basename(directoryPath)
const tempFile = path.join(os.tmpdir(), `${dirName}-${Date.now()}.zip`)
logger.info(`Creating archive for directory ${directoryPath} at ${tempFile}`)
const allPaths = await collectFiles(directoryPath)
const filteredPaths = await filterIgnoredPaths(directoryPath, allPaths)
const output = createWriteStream(tempFile)
const archive = archiver('zip', { zlib: { level: 5 } })
return new Promise((resolve, reject) => {
output.on('close', () => {
logger.info(`Archive created: ${tempFile} (${archive.pointer()} bytes)`)
resolve(tempFile)
})
archive.on('error', (err) => {
logger.error('Archive error:', err)
reject(err)
})
archive.pipe(output)
for (const relativePath of filteredPaths) {
if (relativePath.endsWith('/')) continue
const fullPath = path.join(directoryPath, relativePath)
const archivePath = path.join(dirName, relativePath)
archive.file(fullPath, { name: archivePath })
}
archive.finalize()
})
}
export async function deleteArchive(filePath: string): Promise<void> {
try {
await unlink(filePath)
+2
View File
@@ -267,6 +267,8 @@ function getMimeType(filePath: string): AllowedMimeType {
'.svg': 'image/svg+xml',
'.pdf': 'application/pdf',
'.zip': 'application/zip',
'.md': 'text/markdown',
'.mdx': 'text/markdown',
}
return mimeTypes[ext] || 'text/plain'