mrmd-server 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/api/file.js +8 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mrmd-server",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "HTTP server for mrmd - run mrmd in any browser, access from anywhere",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/api/file.js CHANGED
@@ -22,9 +22,10 @@ export function createFileRoutes(ctx) {
22
22
  */
23
23
  router.get('/scan', async (req, res) => {
24
24
  try {
25
- // Default to home directory (like Electron's file picker)
25
+ // Default to project dir, then cwd, then home
26
+ // On servers like RunPod, cwd (/workspace) is more useful than home (/root)
26
27
  const os = await import('os');
27
- const root = req.query.root || ctx.projectDir || os.default.homedir();
28
+ const root = req.query.root || ctx.projectDir || process.cwd() || os.default.homedir();
28
29
  const options = {
29
30
  // Default to both .md and .ipynb (like Electron)
30
31
  extensions: req.query.extensions?.split(',') || ['.md', '.ipynb'],
@@ -32,7 +33,11 @@ export function createFileRoutes(ctx) {
32
33
  includeHidden: req.query.includeHidden === 'true',
33
34
  };
34
35
 
35
- const files = await fileService.scan(root, options);
36
+ console.log(`[file:scan] Scanning ${root} with options:`, options);
37
+ const relativeFiles = await fileService.scan(root, options);
38
+ // Convert relative paths to absolute (file picker expects absolute paths)
39
+ const files = relativeFiles.map(f => path.join(root, f));
40
+ console.log(`[file:scan] Found ${files.length} files`);
36
41
  res.json(files);
37
42
  } catch (err) {
38
43
  console.error('[file:scan]', err);