Files
tajniak81andClaude Opus 5.5 40d515d15b Add toggles, embeds, link cards, block links, archive, version diff, space export and desktop 1.0
Editor:
- Toggles (Tiptap Details). Open state is per reader, not saved.
- Embeds for YouTube, Vimeo, Loom, Figma, CodePen, Spotify, Google Docs
  and Maps, in sandboxed frames. Other addresses become link cards.
- Link cards with title, description and picture read by docwell-server
  (GET /link-preview). The fetcher refuses private, loopback, link-local
  and CGNAT addresses after DNS resolution, redirects included.
- Block links: a margin button gives a block a short id and copies
  /p/<id>#b-<block>. Opening one jumps to the block and flashes it.
- Markdown, HTML and PDF exports handle the new blocks; HTML import reads
  <details> as a toggle.

Pages and spaces:
- History gets a Changes view: block and word diff against the previous
  version or the page as it is now.
- Archive: archived pages leave the tree and become read-only but stay
  readable; a space's Archive lists them with Unarchive. New migration
  (pages.archived_at) and page.archived / page.unarchived webhook events.
- Full space export (GET /spaces/{id}/export): a zip of Markdown or HTML
  files with subpages in folders, an index, and attachments under _files/.
  Links between exported pages and to attachments become relative paths.

Desktop 1.0:
- Several servers, each with its own sign-in; old settings files carry over.
- Session tokens in the system keychain (go-keyring), moved out of
  localStorage on first start.
- Native menu bar (File, Edit, View, Window, Help) with a Server submenu.
- docwell:// links may point at a block.
- Release workflow builds Windows NSIS, macOS DMG and Linux deb, rpm and
  AppImage installers and attaches them to the release;
  build/set-version.mjs stamps the version into their metadata.

Not yet run: the release workflow, the desktop menus by eye, and macOS or
Linux builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 14:14:14 +01:00

102 lines
2.7 KiB
Go

// SPDX-License-Identifier: AGPL-3.0-or-later
// Command docwell-desktop is the Docwell desktop app (Wails v3). It hosts the
// same Vue app as Web-App and connects to a docwell-server chosen by the user.
package main
import (
"embed"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/events"
)
//go:embed all:frontend/dist
var assets embed.FS
func main() {
settings, err := NewSettingsService()
if err != nil {
log.Fatal(err)
}
tokens := NewTokenService()
links := &LinkService{}
updates, updatesOn, err := updateConfig(updateManifestURL, updatePublicKey)
if err != nil {
log.Fatal(err)
}
app := application.New(application.Options{
Name: "Docwell",
Description: "Docwell desktop app",
Services: []application.Service{
application.NewService(settings),
application.NewService(tokens),
application.NewService(links),
},
// A docwell:// link starts a second process on Windows and Linux; it
// hands the link to the running app and exits.
SingleInstance: &application.SingleInstanceOptions{
UniqueID: "app.docwell.desktop",
OnSecondInstanceLaunch: func(d application.SecondInstanceData) {
if link, ok := deepLinkFromArgs(d.Args); ok {
links.open(link)
}
},
},
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
})
win := app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Docwell",
Width: 1280,
Height: 800,
MinWidth: 720,
MinHeight: 480,
Mac: application.MacWindow{
InvisibleTitleBarHeight: 48,
Backdrop: application.MacBackdropTranslucent,
TitleBar: application.MacTitleBarHiddenInset,
},
BackgroundColour: application.NewRGB(255, 255, 255),
URL: "/",
UseApplicationMenu: true,
})
links.setEmitter(func(route string) {
showWindow(win)
app.Event.Emit(openRouteEvent, route)
})
// The link the app was launched with (an Apple Event on macOS, an
// argument on Windows and Linux).
app.Event.OnApplicationEvent(events.Common.ApplicationLaunchedWithUrl, func(e *application.ApplicationEvent) {
links.open(e.Context().URL())
})
if updatesOn {
if err := app.Updater.Init(updates); err != nil {
log.Fatal(err)
}
}
newTray(app, win, updatesOn)
menu := newAppMenu(app, win, settings, updatesOn)
settings.changed = func(_ Settings, removed []string) {
// The Server menu lists the saved servers.
application.InvokeSync(menu.build)
for _, id := range removed {
tokens.forget(id)
}
}
if err := app.Run(); err != nil {
log.Fatal(err)
}
}