Add Obsidian vault import feature (#8)

- New 'Import Obsidian' action on site settings page
- Upload a zip file of an Obsidian vault to import all notes as posts
- Markdown notes imported with title from filename, published date from
  file timestamp, and body with front-matter stripped
- Images and other attachments saved as Upload records
- New obsimport service handles zip traversal and import logic
- Unit tests for front-matter stripping

Co-authored-by: Shelley <shelley@exe.dev>

Co-authored-by: exe.dev user <exedev@kernel-leviathan.exe.xyz>
Reviewed-on: #8
This commit is contained in:
lmika 2026-04-09 11:40:52 +00:00
parent d21aeadd56
commit a3197f9b11
8 changed files with 376 additions and 0 deletions

View file

@ -115,6 +115,7 @@ Starting weiro without any arguments will start the server.
ssh := handlers.SiteSettingsHandler{SiteService: svcs.Sites}
ch := handlers.CategoriesHandler{CategoryService: svcs.Categories}
pgh := handlers.PagesHandler{PageService: svcs.Pages}
oih := handlers.ObsImportHandler{ObsImportService: svcs.ObsImport, ScratchDir: cfg.ScratchDir}
app.Get("/login", lh.Login)
app.Post("/login", lh.DoLogin)
@ -162,6 +163,9 @@ Starting weiro without any arguments will start the server.
siteGroup.Get("/settings", ssh.General)
siteGroup.Post("/settings", ssh.UpdateGeneral)
siteGroup.Get("/import/obsidian", oih.Form)
siteGroup.Post("/import/obsidian", oih.Upload)
siteGroup.Get("/categories", ch.Index)
siteGroup.Get("/categories/new", ch.New)
siteGroup.Get("/categories/:categoryID", ch.Edit)