Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ Sync your Obsidian vault with GitHub using the official Octokit API — no Git C
- **Shared config across devices** — additional repo configurations are stored in `.github-sync-repos.json` inside the vault, so they are synced with the primary repo and automatically picked up on other devices
- **Per-repo tokens** — use the main token or a separate PAT for each additional repo

### Settings

- **Declarative settings UI** — built on Obsidian's 1.13.0 declarative Settings API with searchable, keyboard-navigable settings
- **Inline validation** — connection failures and path overlaps shown as inline error messages directly on the setting
- **Confirmation dialogs** — destructive actions (deleting repos, clearing logs) prompt for confirmation via native `ConfirmationModal`

### Security

- **Encrypted token storage** — all GitHub tokens (main and per-repo) are stored in Obsidian's encrypted `SecretStorage`, never in plaintext `data.json`
Expand Down Expand Up @@ -52,7 +58,7 @@ Sync your Obsidian vault with GitHub using the official Octokit API — no Git C

## Prerequisites

- Obsidian v1.12.7 or later
- Obsidian v1.13.0 or later
- A GitHub account with a Personal Access Token

## Installation
Expand Down
11 changes: 1 addition & 10 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SyncService, PersistedSyncState, SyncResult } from './src/services/sync
import { LoggerService } from './src/services/loggerService';
import { DiffView, DIFF_VIEW_TYPE } from './src/views/DiffView';
import { SyncView, SYNC_VIEW_TYPE } from './src/views/SyncView';
import { GitHubOctokitSettingTab, SyncModal } from './src/ui';
import { GitHubOctokitSettingTab } from './src/ui';
import { GitHubOctokitSettings, DEFAULT_SETTINGS, AdditionalRepoConfig, VaultRepoConfig, VAULT_REPOS_CONFIG_PATH } from './src/types/settings';

/** Per-repo runtime state for additional repositories */
Expand Down Expand Up @@ -149,15 +149,6 @@ export default class GitHubOctokitPlugin extends Plugin {
}
});

// Command: Open sync modal
this.addCommand({
id: 'open-sync-modal',
name: 'Open sync modal',
callback: () => {
new SyncModal(this.app).open();
}
});

// Command: Open diff view
this.addCommand({
id: 'open-diff-view',
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "github-octokit",
"name": "GitHub Octokit Sync",
"version": "0.6.0",
"minAppVersion": "1.12.7",
"minAppVersion": "1.13.0",
"description": "Sync your vault with GitHub using the Octokit API.",
"author": "M Rhoades-Brown",
"authorUrl": "https://github.com/rhoades-brown",
Expand Down
41 changes: 25 additions & 16 deletions src/ui/modals/SyncModal.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import { App, Modal } from 'obsidian';
import { App, ConfirmationModal } from 'obsidian';

/**
* Simple sync modal (placeholder for future enhancements)
* Show a confirmation dialog before a destructive action.
*
* @param app The Obsidian App instance
* @param title Heading text shown in the modal
* @param message Body text describing the consequences
* @param confirmText Label for the confirm button (default: "Delete")
* @param onConfirm Callback invoked when the user confirms
*/
export class SyncModal extends Modal {
constructor(app: App) {
super(app);
}

onOpen() {
const { contentEl } = this;
contentEl.setText('Sync in progress');
}

onClose() {
const { contentEl } = this;
contentEl.empty();
}
export function confirmDestructiveAction(
app: App,
title: string,
message: string,
confirmText: string,
onConfirm: () => void,
): void {
const modal = new ConfirmationModal(app);
modal.titleEl.setText(title);
modal.contentEl.createEl('p', { text: message });
modal.addButton(btn => btn
.setButtonText(confirmText)
.setDestructive()
.setCta()
.onClick(onConfirm));
modal.addCancelButton();
modal.open();
}

1 change: 1 addition & 0 deletions src/ui/modals/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './LogViewerModal';
export * from './SyncModal';


Loading
Loading