mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-01-07 13:59:17 +00:00
- (Beta) ignore files handling Fixed: - Buttons on lock-detected-dialogue now can be shown in narrow-width devices. Improved: - Some constant has been flattened to be evaluated. - The usage of the deprecated API of obsidian has been reduced. - Now the indexedDB adapter will be enabled while the importing configuration. Misc: - Compiler, framework, and dependencies have been upgraded. - Due to standing for these impacts (especially in esbuild and svelte,) terser has been introduced. Feel free to notify your opinion to me! I do not like to obfuscate the code too.
83 lines
1.9 KiB
TypeScript
83 lines
1.9 KiB
TypeScript
import { type PluginManifest, TFile } from "./deps";
|
|
import { type DatabaseEntry, type EntryBody, type FilePath } from "./lib/src/types";
|
|
|
|
export interface PluginDataEntry extends DatabaseEntry {
|
|
deviceVaultName: string;
|
|
mtime: number;
|
|
manifest: PluginManifest;
|
|
mainJs: string;
|
|
manifestJson: string;
|
|
styleCss?: string;
|
|
// it must be encrypted.
|
|
dataJson?: string;
|
|
_conflicts?: string[];
|
|
type: "plugin";
|
|
}
|
|
|
|
export interface PluginList {
|
|
[key: string]: PluginDataEntry[];
|
|
}
|
|
|
|
export interface DevicePluginList {
|
|
[key: string]: PluginDataEntry;
|
|
}
|
|
export const PERIODIC_PLUGIN_SWEEP = 60;
|
|
|
|
export interface InternalFileInfo {
|
|
path: FilePath;
|
|
mtime: number;
|
|
ctime: number;
|
|
size: number;
|
|
deleted?: boolean;
|
|
}
|
|
|
|
export interface FileInfo {
|
|
path: FilePath;
|
|
mtime: number;
|
|
ctime: number;
|
|
size: number;
|
|
deleted?: boolean;
|
|
file: TFile;
|
|
}
|
|
|
|
export type queueItem = {
|
|
entry: EntryBody;
|
|
missingChildren: string[];
|
|
timeout?: number;
|
|
done?: boolean;
|
|
warned?: boolean;
|
|
};
|
|
|
|
export type CacheData = string | ArrayBuffer;
|
|
export type FileEventType = "CREATE" | "DELETE" | "CHANGED" | "RENAME" | "INTERNAL";
|
|
export type FileEventArgs = {
|
|
file: FileInfo | InternalFileInfo;
|
|
cache?: CacheData;
|
|
oldPath?: string;
|
|
ctx?: any;
|
|
}
|
|
export type FileEventItem = {
|
|
type: FileEventType,
|
|
args: FileEventArgs,
|
|
key: string,
|
|
}
|
|
|
|
// Hidden items (Now means `chunk`)
|
|
export const CHeader = "h:";
|
|
|
|
// Plug-in Stored Container (Obsolete)
|
|
export const PSCHeader = "ps:";
|
|
export const PSCHeaderEnd = "ps;";
|
|
|
|
// Internal data Container
|
|
export const ICHeader = "i:";
|
|
export const ICHeaderEnd = "i;";
|
|
export const ICHeaderLength = ICHeader.length;
|
|
|
|
// Internal data Container (eXtended)
|
|
export const ICXHeader = "ix:";
|
|
|
|
export const FileWatchEventQueueMax = 10;
|
|
export const configURIBase = "obsidian://setuplivesync?settings=";
|
|
|