1
0
Fork 0

Manual backup: 2024-01-19 17:36:23

This commit is contained in:
Alexander Schäferdiek 2024-01-19 17:36:23 +01:00
parent 600d4143c3
commit 05e27deb22
5 changed files with 199 additions and 61 deletions

View file

@ -29417,6 +29417,11 @@ function getDisplayPath(path2) {
return path2;
return path2.split("/").last().replace(".md", "");
}
function formatMinutes(minutes) {
if (minutes === 1)
return "1 minute";
return `${minutes} minutes`;
}
// src/gitManager/gitManager.ts
init_polyfill_buffer();
@ -29942,10 +29947,15 @@ var SimpleGit = class extends GitManager {
};
}
async getRemoteUrl(remote) {
return await this.git.remote(
["get-url", remote],
(err, url) => this.onError(err)
) || void 0;
try {
await this.git.remote(["get-url", remote]);
} catch (error) {
if (error.toString().contains(remote)) {
return void 0;
} else {
this.onError(error);
}
}
}
// https://github.com/kometenstaub/obsidian-version-history-diff/issues/3
async log(file, relativeToVault = true, limit) {
@ -31280,7 +31290,7 @@ var IsomorphicGit = class extends GitManager {
await this.checkAuthorInfo();
this.plugin.setState(4 /* commit */);
const formatMessage = await this.formatCommitMessage(message);
const hadConflict = this.plugin.localStorage.getConflict() === "true";
const hadConflict = this.plugin.localStorage.getConflict();
let parent = void 0;
if (hadConflict) {
const branchInfo = await this.branchInfo();
@ -31293,7 +31303,7 @@ var IsomorphicGit = class extends GitManager {
parent
})
);
this.plugin.localStorage.setConflict("false");
this.plugin.localStorage.setConflict(false);
return;
} catch (error) {
this.plugin.displayError(error);
@ -32167,7 +32177,9 @@ var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab {
plugin.settings.autoSaveInterval
);
new import_obsidian8.Notice(
`Automatic ${commitOrBackup} enabled! Every ${plugin.settings.autoSaveInterval} minutes.`
`Automatic ${commitOrBackup} enabled! Every ${formatMinutes(
plugin.settings.autoSaveInterval
)}.`
);
} else if (plugin.settings.autoSaveInterval <= 0) {
plugin.clearAutoBackup() && new import_obsidian8.Notice(
@ -32180,8 +32192,12 @@ var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab {
})
);
if (!plugin.settings.setLastSaveToLastCommit)
new import_obsidian8.Setting(containerEl).setName(`Auto Backup after stop editing any file`).setDesc(
`Requires the ${commitOrBackup} interval not to be 0. If turned on, do auto ${commitOrBackup} every ${plugin.settings.autoSaveInterval} minutes after stop editing any file. This also prevents auto ${commitOrBackup} while editing a file. If turned off, it's independent from the last change.`
new import_obsidian8.Setting(containerEl).setName(`Auto Backup after stopping file edits`).setDesc(
`Requires the ${commitOrBackup} interval not to be 0.
If turned on, do auto ${commitOrBackup} every ${formatMinutes(
plugin.settings.autoSaveInterval
)} after stopping file edits.
This also prevents auto ${commitOrBackup} while editing a file. If turned off, it's independent from the last change.`
).addToggle(
(toggle) => toggle.setValue(plugin.settings.autoBackupAfterFileChange).onChange((value) => {
plugin.settings.autoBackupAfterFileChange = value;
@ -32221,7 +32237,9 @@ var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab {
plugin.settings.autoPushInterval
);
new import_obsidian8.Notice(
`Automatic push enabled! Every ${plugin.settings.autoPushInterval} minutes.`
`Automatic push enabled! Every ${formatMinutes(
plugin.settings.autoPushInterval
)}.`
);
} else if (plugin.settings.autoPushInterval <= 0) {
plugin.clearAutoPush() && new import_obsidian8.Notice(
@ -32249,7 +32267,9 @@ var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab {
plugin.settings.autoPullInterval
);
new import_obsidian8.Notice(
`Automatic pull enabled! Every ${plugin.settings.autoPullInterval} minutes.`
`Automatic pull enabled! Every ${formatMinutes(
plugin.settings.autoPullInterval
)}.`
);
} else if (plugin.settings.autoPullInterval <= 0) {
plugin.clearAutoPull() && new import_obsidian8.Notice("Automatic pull disabled!");
@ -32413,7 +32433,7 @@ var ObsidianGitSettingsTab = class extends import_obsidian8.PluginSettingTab {
plugin.saveSettings();
})
);
new import_obsidian8.Setting(containerEl).setName("Show changes files count in status bar").addToggle(
new import_obsidian8.Setting(containerEl).setName("Show the count of modified files in the status bar").addToggle(
(toggle) => toggle.setValue(plugin.settings.changedFilesInStatusBar).onChange((value) => {
plugin.settings.changedFilesInStatusBar = value;
plugin.saveSettings();
@ -33972,6 +33992,7 @@ var StatusBar = class {
this.messages = [];
this.base = "obsidian-git-statusbar-";
this.statusBarEl.setAttribute("aria-label-position", "top");
this.statusBarEl.setAttribute("data-tooltip-position", "top");
addEventListener("git-refresh", this.refreshCommitTimestamp.bind(this));
}
displayMessage(message, timeout) {
@ -34224,7 +34245,7 @@ async function getData(manager) {
`remote.${remote}.url`
);
const [isGitHub, httpsUser, httpsRepo, sshUser, sshRepo] = remoteUrl.match(
/(?:^https:\/\/github\.com\/(.*)\/(.*)\.git$)|(?:^git@github\.com:(.*)\/(.*)\.git$)/
/(?:^https:\/\/github\.com\/(.*)\/(.*)\.git$)|(?:^[a-zA-Z]+@github\.com:(.*)\/(.*)\.git$)/
);
return {
result: "success",
@ -34282,10 +34303,10 @@ var LocalStorageSettings = class {
return app.saveLocalStorage(this.prefix + "hostname", value);
}
getConflict() {
return app.loadLocalStorage(this.prefix + "conflict");
return app.loadLocalStorage(this.prefix + "conflict") == "true";
}
setConflict(value) {
return app.saveLocalStorage(this.prefix + "conflict", value);
return app.saveLocalStorage(this.prefix + "conflict", `${value}`);
}
getLastAutoPull() {
return app.loadLocalStorage(this.prefix + "lastAutoPull");
@ -37069,6 +37090,12 @@ function create_fragment(ctx) {
/*side*/
ctx[3]
);
attr(
div3,
"data-tooltip-position",
/*side*/
ctx[3]
);
attr(div3, "aria-label", div3_aria_label_value = /*diff*/
ctx[0].vault_path);
toggle_class(
@ -37164,6 +37191,15 @@ function create_fragment(ctx) {
ctx2[3]
);
}
if (dirty & /*side*/
8) {
attr(
div3,
"data-tooltip-position",
/*side*/
ctx2[3]
);
}
if (dirty & /*diff*/
1 && div3_aria_label_value !== (div3_aria_label_value = /*diff*/
ctx2[0].vault_path)) {
@ -37330,6 +37366,12 @@ function create_else_block(ctx) {
/*side*/
ctx[5]
);
attr(
div3,
"data-tooltip-position",
/*side*/
ctx[5]
);
attr(div3, "aria-label", div3_aria_label_value = /*entity*/
ctx[8].vaultPath);
attr(div4, "class", "tree-item nav-folder");
@ -37389,6 +37431,15 @@ function create_else_block(ctx) {
ctx[5]
);
}
if (!current || dirty & /*side*/
32) {
attr(
div3,
"data-tooltip-position",
/*side*/
ctx[5]
);
}
if (!current || dirty & /*hierarchy*/
1 && div3_aria_label_value !== (div3_aria_label_value = /*entity*/
ctx[8].vaultPath)) {
@ -38178,6 +38229,12 @@ function create_fragment3(ctx) {
/*side*/
ctx[5]
);
attr(
div1,
"data-tooltip-position",
/*side*/
ctx[5]
);
attr(div3, "class", "tree-item-self is-clickable nav-folder-title");
attr(div4, "class", "tree-item nav-folder");
toggle_class(
@ -38256,6 +38313,15 @@ function create_fragment3(ctx) {
ctx2[5]
);
}
if (!current || dirty & /*side*/
32) {
attr(
div1,
"data-tooltip-position",
/*side*/
ctx2[5]
);
}
if (!/*isCollapsed*/
ctx2[4]) {
if (if_block1) {
@ -39038,6 +39104,12 @@ function create_fragment5(ctx) {
/*side*/
ctx[3]
);
attr(
div6,
"data-tooltip-position",
/*side*/
ctx[3]
);
attr(div6, "aria-label", div6_aria_label_value = /*change*/
ctx[0].vault_path);
toggle_class(
@ -39154,6 +39226,15 @@ function create_fragment5(ctx) {
ctx2[3]
);
}
if (dirty & /*side*/
8) {
attr(
div6,
"data-tooltip-position",
/*side*/
ctx2[3]
);
}
if (dirty & /*change*/
1 && div6_aria_label_value !== (div6_aria_label_value = /*change*/
ctx2[0].vault_path)) {
@ -39349,6 +39430,12 @@ function create_fragment6(ctx) {
/*side*/
ctx[1]
);
attr(
div2,
"data-tooltip-position",
/*side*/
ctx[1]
);
attr(div2, "aria-label", div2_aria_label_value = /*change*/
ctx[0].vault_path);
attr(main, "class", "tree-item nav-file svelte-1wbh8tp");
@ -39418,6 +39505,15 @@ function create_fragment6(ctx) {
ctx2[1]
);
}
if (dirty & /*side*/
2) {
attr(
div2,
"data-tooltip-position",
/*side*/
ctx2[1]
);
}
if (dirty & /*change*/
1 && div2_aria_label_value !== (div2_aria_label_value = /*change*/
ctx2[0].vault_path)) {
@ -39585,6 +39681,12 @@ function create_fragment7(ctx) {
/*side*/
ctx[3]
);
attr(
div5,
"data-tooltip-position",
/*side*/
ctx[3]
);
attr(div5, "aria-label", div5_aria_label_value = /*change*/
ctx[0].vault_path);
toggle_class(
@ -39694,6 +39796,15 @@ function create_fragment7(ctx) {
ctx2[3]
);
}
if (dirty & /*side*/
8) {
attr(
div5,
"data-tooltip-position",
/*side*/
ctx2[3]
);
}
if (dirty & /*change*/
1 && div5_aria_label_value !== (div5_aria_label_value = /*change*/
ctx2[0].vault_path)) {
@ -39727,7 +39838,6 @@ function create_fragment7(ctx) {
};
}
function instance7($$self, $$props, $$invalidate) {
let formattedPath;
let side;
let { change } = $$props;
let { view } = $$props;
@ -39783,11 +39893,6 @@ function instance7($$self, $$props, $$invalidate) {
$$invalidate(8, manager = $$props2.manager);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*change*/
1) {
$:
formattedPath = change.vault_path;
}
if ($$self.$$.dirty & /*view*/
2) {
$:
@ -39920,6 +40025,12 @@ function create_else_block3(ctx) {
/*side*/
ctx[6]
);
attr(
div6,
"data-tooltip-position",
/*side*/
ctx[6]
);
attr(div6, "aria-label", div6_aria_label_value = /*entity*/
ctx[15].vaultPath);
attr(div7, "class", "tree-item nav-folder");
@ -39995,6 +40106,15 @@ function create_else_block3(ctx) {
ctx[6]
);
}
if (!current || dirty & /*side*/
64) {
attr(
div6,
"data-tooltip-position",
/*side*/
ctx[6]
);
}
if (!current || dirty & /*hierarchy*/
1 && div6_aria_label_value !== (div6_aria_label_value = /*entity*/
ctx[15].vaultPath)) {
@ -43597,7 +43717,7 @@ var ObsidianGit = class extends import_obsidian30.Plugin {
}) {
if (!await this.isAllInitialized())
return false;
let hadConflict = this.localStorage.getConflict() === "true";
let hadConflict = this.localStorage.getConflict();
let changedFiles;
let status2;
let unstagedFiles;
@ -43605,7 +43725,7 @@ var ObsidianGit = class extends import_obsidian30.Plugin {
this.mayDeleteConflictFile();
status2 = await this.updateCachedStatus();
if (status2.conflicted.length == 0) {
this.localStorage.setConflict("false");
this.localStorage.setConflict(false);
hadConflict = false;
}
if (fromAutoBackup && status2.conflicted.length > 0) {
@ -43671,7 +43791,7 @@ var ObsidianGit = class extends import_obsidian30.Plugin {
}
if (this.gitManager instanceof SimpleGit) {
if ((await this.updateCachedStatus()).conflicted.length == 0) {
this.localStorage.setConflict("false");
this.localStorage.setConflict(false);
}
}
let roughly = false;
@ -43723,7 +43843,7 @@ var ObsidianGit = class extends import_obsidian30.Plugin {
if (!await this.remotesAreSet()) {
return false;
}
const hadConflict = this.localStorage.getConflict() === "true";
const hadConflict = this.localStorage.getConflict();
if (this.gitManager instanceof SimpleGit)
await this.mayDeleteConflictFile();
let status2;
@ -43786,7 +43906,8 @@ var ObsidianGit = class extends import_obsidian30.Plugin {
);
if (file) {
this.app.workspace.iterateAllLeaves((leaf) => {
if (leaf.view instanceof import_obsidian30.MarkdownView && leaf.view.file.path == file.path) {
var _a2;
if (leaf.view instanceof import_obsidian30.MarkdownView && ((_a2 = leaf.view.file) == null ? void 0 : _a2.path) == file.path) {
leaf.detach();
}
});
@ -43909,7 +44030,7 @@ var ObsidianGit = class extends import_obsidian30.Plugin {
}
}
if (!this.timeoutIDBackup && !this.onFileModifyEventRef) {
const lastAutos = await this.loadLastAuto();
const lastAutos = this.loadLastAuto();
if (this.settings.autoSaveInterval > 0) {
const now2 = /* @__PURE__ */ new Date();
const diff2 = this.settings.autoSaveInterval - Math.round(
@ -43921,7 +44042,7 @@ var ObsidianGit = class extends import_obsidian30.Plugin {
}
async setUpAutos() {
this.setUpAutoBackup();
const lastAutos = await this.loadLastAuto();
const lastAutos = this.loadLastAuto();
if (this.settings.differentIntervalCommitAndPush && this.settings.autoPushInterval > 0) {
const now2 = /* @__PURE__ */ new Date();
const diff2 = this.settings.autoPushInterval - Math.round(
@ -44044,7 +44165,7 @@ var ObsidianGit = class extends import_obsidian30.Plugin {
}
async handleConflict(conflicted) {
this.setState(6 /* conflicted */);
this.localStorage.setConflict("true");
this.localStorage.setConflict(true);
let lines;
if (conflicted !== void 0) {
lines = [

View file

@ -5,5 +5,5 @@
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"js": "main.js",
"version": "2.22.0"
"version": "2.22.1"
}

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,9 @@
{
"id": "templater-obsidian",
"name": "Templater",
"version": "1.18.3",
"version": "2.1.1",
"description": "Create and use templates",
"minAppVersion": "0.11.13",
"minAppVersion": "1.5.0",
"author": "SilentVoid",
"authorUrl": "https://github.com/SilentVoid13",
"helpUrl": "https://silentvoid13.github.io/Templater/",

View file

@ -4,11 +4,11 @@
"type": "split",
"children": [
{
"id": "d847a69113acf89d",
"id": "47897c4d1315cd5a",
"type": "tabs",
"children": [
{
"id": "5808c3dac7e7fb1f",
"id": "7af4969d59fe9883",
"type": "leaf",
"state": {
"type": "empty",
@ -128,7 +128,7 @@
"templater-obsidian:Templater": false
}
},
"active": "5808c3dac7e7fb1f",
"active": "7af4969d59fe9883",
"lastOpenFiles": [
"KB/Linux/Desktop/ArchLinux/Theming Qt and Gtk.md",
"KB/Linux/Desktop/ArchLinux/sway.md",