mirror of
https://github.com/lajg-dev/Obsidian-Plugin-GPG-Inline-Encrypt.git
synced 2026-07-22 09:20:31 +00:00
44 lines
973 B
TypeScript
44 lines
973 B
TypeScript
import { GpgSettingsTab } from 'src/SettingsTab';
|
|
import { HotKeys } from 'src/HotKeys';
|
|
import { Plugin } from 'obsidian';
|
|
|
|
interface GpgEncryptSettings {
|
|
pgpExecPath: string;
|
|
pgpRequireSign: boolean;
|
|
pgpSignPublicKeyId: string
|
|
}
|
|
|
|
const DEFAULT_SETTINGS: GpgEncryptSettings = {
|
|
pgpExecPath: '/usr/local/bin/gpg',
|
|
pgpRequireSign: false,
|
|
pgpSignPublicKeyId: "0"
|
|
}
|
|
|
|
export default class GpgEncryptPlugin extends Plugin {
|
|
settings: GpgEncryptSettings;
|
|
|
|
async onload() {
|
|
// Load settings variables
|
|
await this.loadSettings();
|
|
|
|
// Add setting tab
|
|
this.addSettingTab(new GpgSettingsTab(this.app, this));
|
|
|
|
// Add hotkeys
|
|
let hotKeys: HotKeys = new HotKeys(this.app, this);
|
|
this.addCommand(hotKeys.GpgEncryptInline);
|
|
this.addCommand(hotKeys.GpgEncryptDocument);
|
|
}
|
|
|
|
onunload() {
|
|
|
|
}
|
|
|
|
async loadSettings() {
|
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
|
}
|
|
|
|
async saveSettings() {
|
|
await this.saveData(this.settings);
|
|
}
|
|
}
|