# Dragonroll Sync for Obsidian An Obsidian community plugin that imports notes from a Dragonroll campaign and pushes the active Markdown note back to Dragonroll. ## Install from this repository Copy `main.js` and `manifest.json` into: ```text /.obsidian/plugins/dragonroll-sync/ ``` Then enable **Dragonroll Sync** in Obsidian's Community Plugins settings. The plugin is plain JavaScript and does not need a build step. ## Connect your account Open **Settings → Community plugins → Dragonroll Sync**, enter the Dragonroll API URL and sign in with your Dragonroll username/email and password. The default API URL is `https://dragonroll.aranroig.com/api`; a local server can use `http://localhost:5000/api`. Choose a campaign after signing in. The plugin saves the Dragonroll session token in this vault; Dragonroll sessions expire after 48 hours. The password is not saved. ## Commands - **Import or refresh campaign notes** fetches all campaign notes, including notes inside nested Dragonroll folders, into `Dragonroll//`. Imported notes keep their folder hierarchy. - **Push active note to Dragonroll** creates the active Markdown note as a root campaign note, or updates its linked Dragonroll note. A note linked to a different campaign cannot be pushed while another campaign is selected. The import command adds `dragonrollId`, `dragonrollCampaign`, and `dragonrollTitle` properties to each imported note's frontmatter. These properties link the local file to its remote record and are omitted from the Markdown content sent back to Dragonroll. Pushing a new local note adds those properties as well. ## Automatic sync Turn on **Auto-sync changes** in the plugin settings and the plugin follows the vault instead of waiting for the commands: saving an edited note updates its Dragonroll note, a new note created inside `Dragonroll//` becomes a campaign note, and deleting a linked file deletes its Dragonroll note (deleting a folder takes the notes under it along). Notes that are not linked to the selected campaign are never touched, and the toggle is off by default. Import protects local edits. It updates a linked note only when the local copy still matches the last imported/pushed version. If the local copy changed, or both copies changed since the last sync, the plugin keeps the local file and reports it for review. Push is explicit and updates Dragonroll with the active note's current title and content. Without automatic sync this is an explicit import/push workflow; it does not delete notes.