ckelsoe_obsidian-plaud-impo.../types.d.ts
Charles Kelsoe 82f7844774 Release 0.8.0: one-click in-app Plaud sign-in
- Add an "Automatic sign-in" flow: an embedded window loads Plaud's website, the user logs in normally, and the plugin captures the session token automatically from the live Authorization header. The password is never seen by the plugin; the token is stored via SecretStorage. Desktop only.
- Settings shows whether a token is stored. Manual token entry remains as a fallback.
- README: lead with the sign-in flow; correct the manual-token steps to copy the Authorization header from the Network tab (Plaud no longer keeps a usable token in localStorage); disclose the in-app sign-in under privacy/network use.
2026-06-15 19:20:30 -04:00

77 lines
No EOL
2.5 KiB
TypeScript

import 'obsidian';
declare module 'obsidian' {
interface PluginManifest {
version: string;
}
/**
* Obsidian's internal fold state shape. Not part of the publicly
* documented API — observed from the `liamcain/obsidian-creases`
* plugin's type shim (MIT-licensed) and confirmed against live
* behavior. The plaud-importer plugin uses this to auto-fold the
* per-chapter H3 headings in a generated transcript so the note
* opens with each chapter collapsed by default while real heading
* links still resolve to their targets.
*/
interface FoldPosition {
/** 0-based line number of the fold range start. */
from: number;
/** 0-based line number of the fold range end (inclusive). */
to: number;
}
interface FoldInfo {
folds: FoldPosition[];
/** Total line count of the file the folds belong to. */
lines: number;
}
/**
* Persistent fold-state store. `save` writes the payload to
* Obsidian's per-file fold cache so the next `file-open` applies
* it automatically; `load` reads it back.
*/
interface FoldManager {
load(file: import('obsidian').TFile): Promise<FoldInfo>;
save(file: import('obsidian').TFile, foldInfo: FoldInfo): Promise<void>;
}
interface App {
foldManager: FoldManager;
}
/**
* MarkdownView's per-mode subview (source / live-preview / reading).
* Carries its own fold state separate from the persisted one so a
* plugin can apply fold info to the currently-active view without
* forcing a reload.
*/
interface MarkdownSubView {
applyFoldInfo(foldInfo: FoldInfo): void;
getFoldInfo(): FoldInfo | null;
}
}
declare global {
/**
* Electron <webview> element. Obsidian enables `webviewTag` (its Web
* Viewer core plugin depends on it), so a plugin-created <webview>
* exposes Electron's webview methods at runtime. Only the surface the
* Plaud login capture uses is declared here. Methods may be absent at
* runtime if a future Obsidian build disables the tag, so call sites
* still guard with `typeof`.
*/
interface ElectronWebviewTag extends HTMLElement {
src: string;
partition: string;
executeJavaScript(code: string): Promise<unknown>;
getURL(): string;
reload(): void;
stop(): void;
}
interface HTMLElementTagNameMap {
webview: ElectronWebviewTag;
}
}