coffee v0.0.2

main
Mel 3 years ago
parent 7636445ed5
commit fc52f0bc6a

@ -23,6 +23,6 @@
"customjs", "customjs",
"obsidian42-brat", "obsidian42-brat",
"code-block-copy", "code-block-copy",
"obsidian-crypto-lookup", "obsidian-lineup-builder",
"obsidian-lineup-builder" "obsidian-crypto-lookup"
] ]

@ -69,9 +69,16 @@
"a": 1, "a": 1,
"rgb": 5055154 "rgb": 5055154
} }
},
{
"query": "line:(DocType: \"Recipe\") ",
"color": {
"a": 1,
"rgb": 14701138
}
} }
], ],
"collapse-display": true, "collapse-display": false,
"showArrow": true, "showArrow": true,
"textFadeMultiplier": 0, "textFadeMultiplier": 0,
"nodeSizeMultiplier": 1, "nodeSizeMultiplier": 1,
@ -81,6 +88,6 @@
"repelStrength": 10, "repelStrength": 10,
"linkStrength": 1, "linkStrength": 1,
"linkDistance": 250, "linkDistance": 250,
"scale": 0.277223726779554, "scale": 0.3408463758608929,
"close": true "close": true
} }

File diff suppressed because one or more lines are too long

@ -1,8 +1,8 @@
{ {
"id": "obsidian-tasks-plugin", "id": "obsidian-tasks-plugin",
"name": "Tasks", "name": "Tasks",
"version": "1.3.0", "version": "1.4.1",
"minAppVersion": "0.12.3", "minAppVersion": "0.12.17",
"description": "Task management for Obsidian", "description": "Task management for Obsidian",
"author": "Martin Schenck", "author": "Martin Schenck",
"authorUrl": "https://github.com/schemar", "authorUrl": "https://github.com/schemar",

@ -16,13 +16,23 @@
cursor: pointer; cursor: pointer;
} }
.tasks-list-text {
position: relative;
}
.tasks-list-text .tooltip {
position: absolute;
top: 0px;
left: 0px;
white-space: nowrap;
}
.tasks-setting-important { .tasks-setting-important {
color: red; color: red;
font-weight: bold; font-weight: bold;
} }
.tasks-modal label { .tasks-modal label {
display: block;
margin: 5px 0 5px 0; margin: 5px 0 5px 0;
} }
@ -31,9 +41,9 @@
} }
.tasks-modal hr { .tasks-modal hr {
margin: 0; margin: 10px 0 10px 0;
} }
.tasks-modal-section { .tasks-modal-date {
margin-bottom: 1rem; margin-bottom: 10px;
} }

@ -21,6 +21,26 @@ var __reExport = (target, module2, desc) => {
var __toModule = (module2) => { var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
}; };
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/main.ts // src/main.ts
__export(exports, { __export(exports, {
@ -41,10 +61,10 @@ var SettingsTab = class extends import_obsidian.PluginSettingTab {
containerEl.createEl("h2", { text: this.plugin.appName }); containerEl.createEl("h2", { text: this.plugin.appName });
new import_obsidian.Setting(containerEl).setName("Auto-update at startup").setDesc("If enabled all beta plugins will be checked for updates each time Obsidian starts.").addToggle((cb) => { new import_obsidian.Setting(containerEl).setName("Auto-update at startup").setDesc("If enabled all beta plugins will be checked for updates each time Obsidian starts.").addToggle((cb) => {
cb.setValue(this.plugin.settings.updateAtStartup); cb.setValue(this.plugin.settings.updateAtStartup);
cb.onChange(async (value) => { cb.onChange((value) => __async(this, null, function* () {
this.plugin.settings.updateAtStartup = value; this.plugin.settings.updateAtStartup = value;
await this.plugin.saveSettings(); yield this.plugin.saveSettings();
}); }));
}); });
containerEl.createEl("hr"); containerEl.createEl("hr");
containerEl.createEl("h2", { text: "Beta Plugin List" }); containerEl.createEl("h2", { text: "Beta Plugin List" });
@ -56,23 +76,23 @@ var SettingsTab = class extends import_obsidian.PluginSettingTab {
containerEl.createSpan({ text: "This does not delete the plugin, this should be done from the Community Plugins tab in Settings." }); containerEl.createSpan({ text: "This does not delete the plugin, this should be done from the Community Plugins tab in Settings." });
new import_obsidian.Setting(containerEl).addButton((cb) => { new import_obsidian.Setting(containerEl).addButton((cb) => {
cb.setButtonText("Add Beta plugin"); cb.setButtonText("Add Beta plugin");
cb.onClick(async () => { cb.onClick(() => __async(this, null, function* () {
this.plugin.app.setting.close(); this.plugin.app.setting.close();
await this.plugin.betaPlugins.displayAddNewPluginModal(true); yield this.plugin.betaPlugins.displayAddNewPluginModal(true);
}); }));
}); });
for (const bp of this.plugin.settings.pluginList) { for (const bp of this.plugin.settings.pluginList) {
new import_obsidian.Setting(containerEl).setName(bp).addButton((btn) => { new import_obsidian.Setting(containerEl).setName(bp).addButton((btn) => {
btn.setIcon("cross"); btn.setIcon("cross");
btn.setTooltip("Delete this beta plugin"); btn.setTooltip("Delete this beta plugin");
btn.onClick(async () => { btn.onClick(() => __async(this, null, function* () {
if (btn.buttonEl.textContent === "") if (btn.buttonEl.textContent === "")
btn.setButtonText("Click once more to confirm removal"); btn.setButtonText("Click once more to confirm removal");
else { else {
btn.buttonEl.parentElement.parentElement.remove(); btn.buttonEl.parentElement.parentElement.remove();
await this.plugin.betaPlugins.deletePlugin(bp); yield this.plugin.betaPlugins.deletePlugin(bp);
} }
}); }));
}); });
} }
} }
@ -83,14 +103,18 @@ var DEFAULT_SETTINGS = {
pluginList: [], pluginList: [],
updateAtStartup: false updateAtStartup: false
}; };
async function addBetaPluginToList(plugin, repositoryPath) { function addBetaPluginToList(plugin, repositoryPath) {
return __async(this, null, function* () {
if (!plugin.settings.pluginList.contains(repositoryPath)) { if (!plugin.settings.pluginList.contains(repositoryPath)) {
plugin.settings.pluginList.unshift(repositoryPath); plugin.settings.pluginList.unshift(repositoryPath);
plugin.saveSettings(); plugin.saveSettings();
} }
});
} }
async function existBetaPluginInList(plugin, repositoryPath) { function existBetaPluginInList(plugin, repositoryPath) {
return __async(this, null, function* () {
return plugin.settings.pluginList.contains(repositoryPath); return plugin.settings.pluginList.contains(repositoryPath);
});
} }
// src/AddNewPluginModal.ts // src/AddNewPluginModal.ts
@ -103,19 +127,21 @@ var AddNewPluginModal = class extends import_obsidian2.Modal {
this.address = ""; this.address = "";
this.openSettingsTabAfterwards = openSettingsTabAfterwards; this.openSettingsTabAfterwards = openSettingsTabAfterwards;
} }
async submitForm() { submitForm() {
return __async(this, null, function* () {
if (this.address === "") if (this.address === "")
return; return;
const scrubbedAddress = this.address.replace("https://github.com/", ""); const scrubbedAddress = this.address.replace("https://github.com/", "");
if (await existBetaPluginInList(this.plugin, scrubbedAddress)) { if (yield existBetaPluginInList(this.plugin, scrubbedAddress)) {
new import_obsidian2.Notice(`BRAT new import_obsidian2.Notice(`BRAT
This plugin is already in the list for beta testing`, 1e4); This plugin is already in the list for beta testing`, 1e4);
return; return;
} }
const result = await this.betaPlugins.addPlugin(scrubbedAddress); const result = yield this.betaPlugins.addPlugin(scrubbedAddress);
if (result) { if (result) {
this.close(); this.close();
} }
});
} }
onOpen() { onOpen() {
this.contentEl.createEl("h4", { text: "Github repository for beta plugin:" }); this.contentEl.createEl("h4", { text: "Github repository for beta plugin:" });
@ -125,12 +151,12 @@ This plugin is already in the list for beta testing`, 1e4);
textEl.onChange((value) => { textEl.onChange((value) => {
this.address = value.trim(); this.address = value.trim();
}); });
textEl.inputEl.addEventListener("keydown", async (e) => { textEl.inputEl.addEventListener("keydown", (e) => __async(this, null, function* () {
if (e.key === "Enter" && this.address !== " ") { if (e.key === "Enter" && this.address !== " ") {
e.preventDefault(); e.preventDefault();
await this.submitForm(); yield this.submitForm();
} }
}); }));
textEl.inputEl.style.width = "100%"; textEl.inputEl.style.width = "100%";
window.setTimeout(() => { window.setTimeout(() => {
const title = document.querySelector(".setting-item-info"); const title = document.querySelector(".setting-item-info");
@ -147,51 +173,53 @@ This plugin is already in the list for beta testing`, 1e4);
text: "Add Plugin" text: "Add Plugin"
}); });
}); });
formEl.addEventListener("submit", async (e) => { formEl.addEventListener("submit", (e) => __async(this, null, function* () {
e.preventDefault(); e.preventDefault();
if (this.address !== "") if (this.address !== "")
await this.submitForm(); yield this.submitForm();
}); }));
}); });
} }
async onClose() { onClose() {
return __async(this, null, function* () {
if (this.openSettingsTabAfterwards) { if (this.openSettingsTabAfterwards) {
await this.plugin.app.setting.open(); yield this.plugin.app.setting.open();
await this.plugin.app.setting.openTabById("obsidian42-brat"); yield this.plugin.app.setting.openTabById("obsidian42-brat");
} }
});
} }
}; };
// src/githubUtils.ts // src/githubUtils.ts
var import_obsidian3 = __toModule(require("obsidian")); var import_obsidian3 = __toModule(require("obsidian"));
var GITHUB_RAW_USERCONTENT_PATH = "https://raw.githubusercontent.com/"; var GITHUB_RAW_USERCONTENT_PATH = "https://raw.githubusercontent.com/";
var grabReleaseFileFromRepository = async (repository, version, fileName) => { var grabReleaseFileFromRepository = (repository, version, fileName) => __async(void 0, null, function* () {
const URL = `https://github.com/${repository}/releases/download/${version}/${fileName}`; const URL = `https://github.com/${repository}/releases/download/${version}/${fileName}`;
try { try {
const download = await (0, import_obsidian3.request)({ url: URL }); const download = yield (0, import_obsidian3.request)({ url: URL });
return download === "Not Found" || download === `{"error":"Not Found"}` ? null : download; return download === "Not Found" || download === `{"error":"Not Found"}` ? null : download;
} catch (error) { } catch (error) {
console.log("error in grabReleaseFileFromRepository", URL, error); console.log("error in grabReleaseFileFromRepository", URL, error);
} }
}; });
var grabManifestJsonFromRepository = async (repositoryPath, rootManifest = true) => { var grabManifestJsonFromRepository = (repositoryPath, rootManifest = true) => __async(void 0, null, function* () {
const manifestJsonPath = GITHUB_RAW_USERCONTENT_PATH + repositoryPath + (rootManifest === true ? "/HEAD/manifest.json" : "/HEAD/manifest-beta.json"); const manifestJsonPath = GITHUB_RAW_USERCONTENT_PATH + repositoryPath + (rootManifest === true ? "/HEAD/manifest.json" : "/HEAD/manifest-beta.json");
try { try {
const response = await (0, import_obsidian3.request)({ url: manifestJsonPath }); const response = yield (0, import_obsidian3.request)({ url: manifestJsonPath });
return response === "404: Not Found" ? null : await JSON.parse(response); return response === "404: Not Found" ? null : yield JSON.parse(response);
} catch (error) { } catch (error) {
console.log("error in grabManifestJsonFromRepository", error); console.log(`error in grabManifestJsonFromRepository for ${manifestJsonPath}`, error);
} }
}; });
var grabCommmunityPluginList = async () => { var grabCommmunityPluginList = () => __async(void 0, null, function* () {
const pluginListURL = `https://raw.githubusercontent.com/obsidianmd/obsidian-releases/HEAD/community-plugins.json`; const pluginListURL = `https://raw.githubusercontent.com/obsidianmd/obsidian-releases/HEAD/community-plugins.json`;
try { try {
const response = await (0, import_obsidian3.request)({ url: pluginListURL }); const response = yield (0, import_obsidian3.request)({ url: pluginListURL });
return response === "404: Not Found" ? null : await JSON.parse(response); return response === "404: Not Found" ? null : yield JSON.parse(response);
} catch (error) { } catch (error) {
console.log("error in grabCommmunityPluginList", error); console.log("error in grabCommmunityPluginList", error);
} }
}; });
// src/BetaPlugins.ts // src/BetaPlugins.ts
var import_obsidian4 = __toModule(require("obsidian")); var import_obsidian4 = __toModule(require("obsidian"));
@ -199,13 +227,16 @@ var BetaPlugins = class {
constructor(plugin) { constructor(plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
async displayAddNewPluginModal(openSettingsTabAfterwards = false) { displayAddNewPluginModal(openSettingsTabAfterwards = false) {
return __async(this, null, function* () {
const newPlugin = new AddNewPluginModal(this.plugin, this, openSettingsTabAfterwards); const newPlugin = new AddNewPluginModal(this.plugin, this, openSettingsTabAfterwards);
newPlugin.open(); newPlugin.open();
});
} }
async validateRepository(repositoryPath, getBetaManifest = false, reportIsues = false) { validateRepository(repositoryPath, getBetaManifest = false, reportIsues = false) {
const noticeTimeout = 1e4; return __async(this, null, function* () {
const manifestJson = await grabManifestJsonFromRepository(repositoryPath, !getBetaManifest); const noticeTimeout = 15e3;
const manifestJson = yield grabManifestJsonFromRepository(repositoryPath, !getBetaManifest);
if (!manifestJson) { if (!manifestJson) {
if (reportIsues) if (reportIsues)
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
@ -228,31 +259,38 @@ The version attribute for the release is missing from the manifest file`, notice
return null; return null;
} }
return manifestJson; return manifestJson;
});
} }
async getAllReleaseFiles(repositoryPath, manifest, getManifest) { getAllReleaseFiles(repositoryPath, manifest, getManifest) {
return __async(this, null, function* () {
return { return {
mainJs: await grabReleaseFileFromRepository(repositoryPath, manifest.version, "main.js"), mainJs: yield grabReleaseFileFromRepository(repositoryPath, manifest.version, "main.js"),
manifest: getManifest ? await grabReleaseFileFromRepository(repositoryPath, manifest.version, "manifest.json") : null, manifest: getManifest ? yield grabReleaseFileFromRepository(repositoryPath, manifest.version, "manifest.json") : null,
styles: await grabReleaseFileFromRepository(repositoryPath, manifest.version, "styles.css") styles: yield grabReleaseFileFromRepository(repositoryPath, manifest.version, "styles.css")
}; };
});
} }
async writeReleaseFilesToPluginFolder(betaPluginID, relFiles) { writeReleaseFilesToPluginFolder(betaPluginID, relFiles) {
return __async(this, null, function* () {
const pluginTargetFolderPath = (0, import_obsidian4.normalizePath)(this.plugin.app.vault.configDir + "/plugins/" + betaPluginID) + "/"; const pluginTargetFolderPath = (0, import_obsidian4.normalizePath)(this.plugin.app.vault.configDir + "/plugins/" + betaPluginID) + "/";
const adapter = this.plugin.app.vault.adapter; const adapter = this.plugin.app.vault.adapter;
if (await adapter.exists(pluginTargetFolderPath) === false || !await adapter.exists(pluginTargetFolderPath + "manifest.json")) { if ((yield adapter.exists(pluginTargetFolderPath)) === false || !(yield adapter.exists(pluginTargetFolderPath + "manifest.json"))) {
await adapter.mkdir(pluginTargetFolderPath); yield adapter.mkdir(pluginTargetFolderPath);
} }
await adapter.write(pluginTargetFolderPath + "main.js", relFiles.mainJs); yield adapter.write(pluginTargetFolderPath + "main.js", relFiles.mainJs);
await adapter.write(pluginTargetFolderPath + "manifest.json", relFiles.manifest); yield adapter.write(pluginTargetFolderPath + "manifest.json", relFiles.manifest);
if (relFiles.styles) if (relFiles.styles)
await adapter.write(pluginTargetFolderPath + "styles.css", relFiles.styles); yield adapter.write(pluginTargetFolderPath + "styles.css", relFiles.styles);
});
} }
async addPlugin(repositoryPath, updatePluginFiles = false, seeIfUpdatedOnly = false, reportIfNotUpdted = false) { addPlugin(repositoryPath, updatePluginFiles = false, seeIfUpdatedOnly = false, reportIfNotUpdted = false) {
return __async(this, null, function* () {
var _a;
const noticeTimeout = 1e4; const noticeTimeout = 1e4;
let primaryManifest = await this.validateRepository(repositoryPath, true, false); let primaryManifest = yield this.validateRepository(repositoryPath, true, false);
const usingBetaManifest = primaryManifest ? true : false; const usingBetaManifest = primaryManifest ? true : false;
if (usingBetaManifest === false) if (usingBetaManifest === false)
primaryManifest = await this.validateRepository(repositoryPath, false, true); primaryManifest = yield this.validateRepository(repositoryPath, false, true);
if (primaryManifest === null) { if (primaryManifest === null) {
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
${repositoryPath} ${repositoryPath}
@ -265,8 +303,8 @@ ${repositoryPath}
The manifest${usingBetaManifest ? "-beta" : ""}.json file in the root directory of the repository does not have a version number in the file. This plugin cannot be installed.`, noticeTimeout); The manifest${usingBetaManifest ? "-beta" : ""}.json file in the root directory of the repository does not have a version number in the file. This plugin cannot be installed.`, noticeTimeout);
return false; return false;
} }
const getRelease = async () => { const getRelease = () => __async(this, null, function* () {
const rFiles = await this.getAllReleaseFiles(repositoryPath, primaryManifest, usingBetaManifest); const rFiles = yield this.getAllReleaseFiles(repositoryPath, primaryManifest, usingBetaManifest);
if (usingBetaManifest || rFiles.manifest === null) if (usingBetaManifest || rFiles.manifest === null)
rFiles.manifest = JSON.stringify(primaryManifest); rFiles.manifest = JSON.stringify(primaryManifest);
if (rFiles.mainJs === null) { if (rFiles.mainJs === null) {
@ -276,14 +314,14 @@ The release is not complete and cannot be download. main.js is missing from the
return null; return null;
} }
return rFiles; return rFiles;
}; });
if (updatePluginFiles === false) { if (updatePluginFiles === false) {
const releaseFiles = await getRelease(); const releaseFiles = yield getRelease();
if (releaseFiles === null) if (releaseFiles === null)
return; return;
await this.writeReleaseFilesToPluginFolder(primaryManifest.id, releaseFiles); yield this.writeReleaseFilesToPluginFolder(primaryManifest.id, releaseFiles);
await addBetaPluginToList(this.plugin, repositoryPath); yield addBetaPluginToList(this.plugin, repositoryPath);
await this.plugin.app.plugins.loadManifests(); yield this.plugin.app.plugins.loadManifests();
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
${repositoryPath} ${repositoryPath}
The plugin has been registered with BRAT. You may still need to enable it the Community Plugin List.`, noticeTimeout); The plugin has been registered with BRAT. You may still need to enable it the Community Plugin List.`, noticeTimeout);
@ -291,68 +329,84 @@ The plugin has been registered with BRAT. You may still need to enable it the Co
const pluginTargetFolderPath = this.plugin.app.vault.configDir + "/plugins/" + primaryManifest.id + "/"; const pluginTargetFolderPath = this.plugin.app.vault.configDir + "/plugins/" + primaryManifest.id + "/";
let localManifestContents = null; let localManifestContents = null;
try { try {
localManifestContents = await this.plugin.app.vault.adapter.read(pluginTargetFolderPath + "manifest.json"); localManifestContents = yield this.plugin.app.vault.adapter.read(pluginTargetFolderPath + "manifest.json");
} catch (e) { } catch (e) {
if (e.errno === -4058) { if (e.errno === -4058) {
await this.addPlugin(repositoryPath, false, usingBetaManifest); yield this.addPlugin(repositoryPath, false, usingBetaManifest);
return true; return true;
} else } else
console.log("BRAT - Local Manifest Load", primaryManifest.id, JSON.stringify(e, null, 2)); console.log("BRAT - Local Manifest Load", primaryManifest.id, JSON.stringify(e, null, 2));
} }
const localManifestJSON = await JSON.parse(localManifestContents); const localManifestJSON = yield JSON.parse(localManifestContents);
if (localManifestJSON.version !== primaryManifest.version) { if (localManifestJSON.version !== primaryManifest.version) {
const releaseFiles = await getRelease(); const releaseFiles = yield getRelease();
if (releaseFiles === null) if (releaseFiles === null)
return; return;
if (seeIfUpdatedOnly) { if (seeIfUpdatedOnly) {
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
There is an update available for ${primaryManifest.id}`); There is an update available for ${primaryManifest.id} from version ${localManifestJSON.version} to ${primaryManifest.version}`, 3e4);
} else { } else {
await this.writeReleaseFilesToPluginFolder(primaryManifest.id, releaseFiles); yield this.writeReleaseFilesToPluginFolder(primaryManifest.id, releaseFiles);
await this.plugin.app.plugins.loadManifests(); yield this.plugin.app.plugins.loadManifests();
if (this.plugin.app.plugins.plugins[primaryManifest.id]?.manifest) if ((_a = this.plugin.app.plugins.plugins[primaryManifest.id]) == null ? void 0 : _a.manifest)
await this.reloadPlugin(primaryManifest.id); yield this.reloadPlugin(primaryManifest.id);
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
${primaryManifest.id} ${primaryManifest.id}
Plugin has been updated.`, noticeTimeout); Plugin has been updated from version ${localManifestJSON.version} to ${primaryManifest.version}.`, 3e4);
} }
} else if (reportIfNotUpdted) } else if (reportIfNotUpdted)
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
No update available for ${repositoryPath}`, 3e3); No update available for ${repositoryPath}`, 3e3);
} }
return true; return true;
});
} }
async reloadPlugin(pluginName) { reloadPlugin(pluginName) {
return __async(this, null, function* () {
const plugins = this.plugin.app.plugins; const plugins = this.plugin.app.plugins;
try { try {
await plugins.disablePlugin(pluginName); yield plugins.disablePlugin(pluginName);
await plugins.enablePlugin(pluginName); yield plugins.enablePlugin(pluginName);
} catch (e) { } catch (e) {
console.log("reload plugin", e); console.log("reload plugin", e);
} }
});
} }
async updatePlugin(repositoryPath, onlyCheckDontUpdate = false, reportIfNotUpdted = false) { updatePlugin(repositoryPath, onlyCheckDontUpdate = false, reportIfNotUpdted = false) {
const result = await this.addPlugin(repositoryPath, true, onlyCheckDontUpdate, reportIfNotUpdted); return __async(this, null, function* () {
const result = yield this.addPlugin(repositoryPath, true, onlyCheckDontUpdate, reportIfNotUpdted);
if (result === false && onlyCheckDontUpdate === false) if (result === false && onlyCheckDontUpdate === false)
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
${repositoryPath} ${repositoryPath}
Update of plugin failed.`); Update of plugin failed.`);
return result; return result;
});
} }
async checkForUpdatesAndInstallUpdates(showInfo = false, onlyCheckDontUpdate = false) { checkForUpdatesAndInstallUpdates(showInfo = false, onlyCheckDontUpdate = false) {
return __async(this, null, function* () {
if (showInfo) if (showInfo)
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
Checking for plugin updates STARTED`, 1e4); Checking for plugin updates STARTED`, 1e4);
for (const bp of this.plugin.settings.pluginList) { for (const bp of this.plugin.settings.pluginList) {
await this.updatePlugin(bp, onlyCheckDontUpdate); yield this.updatePlugin(bp, onlyCheckDontUpdate);
} }
if (showInfo) if (showInfo)
new import_obsidian4.Notice(`BRAT new import_obsidian4.Notice(`BRAT
Checking for plugin updates COMPLETED`, 1e4); Checking for plugin updates COMPLETED`, 1e4);
});
} }
async deletePlugin(repositoryPath) { deletePlugin(repositoryPath) {
return __async(this, null, function* () {
this.plugin.settings.pluginList = this.plugin.settings.pluginList.filter((b) => b != repositoryPath); this.plugin.settings.pluginList = this.plugin.settings.pluginList.filter((b) => b != repositoryPath);
this.plugin.saveSettings(); this.plugin.saveSettings();
});
}
getEnabledDisabledPlugins(enabled) {
const pl = this.plugin.app.plugins;
const manifests = Object.values(pl.manifests);
const enabledPlugins = Object.values(pl.plugins).map((p) => p.manifest);
console.log(enabledPlugins);
return enabled ? manifests.filter((manifest) => enabledPlugins.find((pluginName) => manifest.id === pluginName.id)) : manifests.filter((manifest) => !enabledPlugins.find((pluginName) => manifest.id === pluginName.id));
} }
}; };
@ -367,9 +421,11 @@ var GenericFuzzySuggester = class extends import_obsidian5.FuzzySuggestModal {
setSuggesterData(suggesterData) { setSuggesterData(suggesterData) {
this.data = suggesterData; this.data = suggesterData;
} }
async display(callBack) { display(callBack) {
return __async(this, null, function* () {
this.callbackFunction = callBack; this.callbackFunction = callBack;
this.open(); this.open();
});
} }
getItems() { getItems() {
return this.data; return this.data;
@ -406,69 +462,70 @@ var ThePlugin = class extends import_obsidian6.Plugin {
this.appName = "Obsidian42 - Beta Reviewer's Auto-update Tool (BRAT)"; this.appName = "Obsidian42 - Beta Reviewer's Auto-update Tool (BRAT)";
this.appID = "obsidian42-brat"; this.appID = "obsidian42-brat";
} }
async onload() { onload() {
return __async(this, null, function* () {
console.log("loading Obsidian42 - BRAT"); console.log("loading Obsidian42 - BRAT");
await this.loadSettings(); yield this.loadSettings();
this.addSettingTab(new SettingsTab(this.app, this)); this.addSettingTab(new SettingsTab(this.app, this));
this.betaPlugins = new BetaPlugins(this); this.betaPlugins = new BetaPlugins(this);
this.addCommand({ this.addCommand({
id: "BRAT-AddBetaPlugin", id: "BRAT-AddBetaPlugin",
name: "Add a beta plugin for testing", name: "Add a beta plugin for testing",
callback: async () => { callback: () => __async(this, null, function* () {
await this.betaPlugins.displayAddNewPluginModal(); yield this.betaPlugins.displayAddNewPluginModal();
} })
}); });
this.addCommand({ this.addCommand({
id: "BRAT-checkForUpdatesAndUpdate", id: "BRAT-checkForUpdatesAndUpdate",
name: "Check for updates to all beta plugins and UPDATE", name: "Check for updates to all beta plugins and UPDATE",
callback: async () => { callback: () => __async(this, null, function* () {
await this.betaPlugins.checkForUpdatesAndInstallUpdates(true, false); yield this.betaPlugins.checkForUpdatesAndInstallUpdates(true, false);
} })
}); });
this.addCommand({ this.addCommand({
id: "BRAT-checkForUpdatesAndDontUpdate", id: "BRAT-checkForUpdatesAndDontUpdate",
name: "Only check for updates to beta plugins, but don't Update", name: "Only check for updates to beta plugins, but don't Update",
callback: async () => { callback: () => __async(this, null, function* () {
await this.betaPlugins.checkForUpdatesAndInstallUpdates(true, true); yield this.betaPlugins.checkForUpdatesAndInstallUpdates(true, true);
} })
}); });
this.addCommand({ this.addCommand({
id: "BRAT-updateOnePlugin", id: "BRAT-updateOnePlugin",
name: "Choose a single plugin to update", name: "Choose a single plugin to update",
callback: async () => { callback: () => __async(this, null, function* () {
const pluginList = Object.values(this.settings.pluginList).map((m) => { const pluginList = Object.values(this.settings.pluginList).map((m) => {
return { display: m, info: m }; return { display: m, info: m };
}); });
const gfs = new GenericFuzzySuggester(this); const gfs = new GenericFuzzySuggester(this);
gfs.setSuggesterData(pluginList); gfs.setSuggesterData(pluginList);
await gfs.display(async (results) => { yield gfs.display((results) => __async(this, null, function* () {
new import_obsidian6.Notice(`BRAT new import_obsidian6.Notice(`BRAT
Checking for updates for ${results.info}`, 3e3); Checking for updates for ${results.info}`, 3e3);
await this.betaPlugins.updatePlugin(results.info, false, true); yield this.betaPlugins.updatePlugin(results.info, false, true);
}); }));
} })
}); });
this.addCommand({ this.addCommand({
id: "BRAT-restartPlugin", id: "BRAT-restartPlugin",
name: "Restart a plugin that is already installed", name: "Restart a plugin that is already installed",
callback: async () => { callback: () => __async(this, null, function* () {
const pluginList = Object.values(this.app.plugins.manifests).map((m) => { const pluginList = Object.values(this.app.plugins.manifests).map((m) => {
return { display: m.id, info: m.id }; return { display: m.id, info: m.id };
}); });
const gfs = new GenericFuzzySuggester(this); const gfs = new GenericFuzzySuggester(this);
gfs.setSuggesterData(pluginList); gfs.setSuggesterData(pluginList);
await gfs.display(async (results) => { yield gfs.display((results) => __async(this, null, function* () {
new import_obsidian6.Notice(`${results.info} new import_obsidian6.Notice(`${results.info}
Plugin reloading .....`, 5e3); Plugin reloading .....`, 5e3);
await this.betaPlugins.reloadPlugin(results.info); yield this.betaPlugins.reloadPlugin(results.info);
}); }));
} })
}); });
this.addCommand({ this.addCommand({
id: "BRAT-openGitHubRepository", id: "BRAT-openGitHubRepository",
name: "Open the GitHub repository for a plugin", name: "Open the GitHub repository for a plugin",
callback: async () => { callback: () => __async(this, null, function* () {
const communityPlugins = await grabCommmunityPluginList(); const communityPlugins = yield grabCommmunityPluginList();
const communityPluginList = Object.values(communityPlugins).map((p) => { const communityPluginList = Object.values(communityPlugins).map((p) => {
return { display: `Community: ${p.name} (${p.repo})`, info: p.repo }; return { display: `Community: ${p.name} (${p.repo})`, info: p.repo };
}); });
@ -478,26 +535,59 @@ Plugin reloading .....`, 5e3);
communityPluginList.forEach((si) => bratList.push(si)); communityPluginList.forEach((si) => bratList.push(si));
const gfs = new GenericFuzzySuggester(this); const gfs = new GenericFuzzySuggester(this);
gfs.setSuggesterData(bratList); gfs.setSuggesterData(bratList);
await gfs.display(async (results) => { yield gfs.display((results) => __async(this, null, function* () {
if (results.info) if (results.info)
window.open(`https://github.com/${results.info}`); window.open(`https://github.com/${results.info}`);
}));
})
}); });
} this.addCommand({
id: "BRAT-disablePlugin",
name: "Disable a plugin - toggle it off",
callback: () => __async(this, null, function* () {
const pluginList = this.betaPlugins.getEnabledDisabledPlugins(true).map((manifest) => {
return { display: `${manifest.name} (${manifest.id})`, info: manifest.id };
});
const gfs = new GenericFuzzySuggester(this);
gfs.setSuggesterData(pluginList);
yield gfs.display((results) => __async(this, null, function* () {
yield this.app.plugins.disablePlugin(results.info);
}));
})
});
this.addCommand({
id: "BRAT-enablePlugin",
name: "Enable a plugin - toggle it on",
callback: () => __async(this, null, function* () {
const pluginList = this.betaPlugins.getEnabledDisabledPlugins(false).map((manifest) => {
return { display: `${manifest.name} (${manifest.id})`, info: manifest.id };
});
const gfs = new GenericFuzzySuggester(this);
gfs.setSuggesterData(pluginList);
yield gfs.display((results) => __async(this, null, function* () {
yield this.app.plugins.enablePlugin(results.info);
}));
})
}); });
this.app.workspace.onLayoutReady(() => { this.app.workspace.onLayoutReady(() => {
if (this.settings.updateAtStartup) if (this.settings.updateAtStartup)
setTimeout(async () => { setTimeout(() => __async(this, null, function* () {
await this.betaPlugins.checkForUpdatesAndInstallUpdates(false); yield this.betaPlugins.checkForUpdatesAndInstallUpdates(false);
}, 6e4); }), 6e4);
});
}); });
} }
onunload() { onunload() {
console.log("unloading " + this.appName); console.log("unloading " + this.appName);
} }
async loadSettings() { loadSettings() {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); return __async(this, null, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
});
} }
async saveSettings() { saveSettings() {
await this.saveData(this.settings); return __async(this, null, function* () {
yield this.saveData(this.settings);
});
} }
}; };

@ -1 +1,10 @@
{"id":"obsidian42-brat","name":"Obsidian42 - BRAT","version":"0.4.4","minAppVersion":"0.9.12","description":"Easily install a beta version of a plugin for testing.","author":"TfTHacker","authorUrl":"https://github.com/TfTHacker/obsidian42-brat","isDesktopOnly":false} {
"id": "obsidian42-brat",
"name": "Obsidian42 - BRAT",
"version": "0.5.0",
"minAppVersion": "0.9.12",
"description": "Easily install a beta version of a plugin for testing.",
"author": "TfTHacker",
"authorUrl": "https://github.com/TfTHacker/obsidian42-brat",
"isDesktopOnly": false
}

@ -9,8 +9,8 @@
"state": { "state": {
"type": "markdown", "type": "markdown",
"state": { "state": {
"file": "03.03 Food & Wine/!!Wine.md", "file": "00.01 Admin/Test sheet.md",
"mode": "preview" "mode": "source"
} }
} }
} }
@ -68,7 +68,7 @@
"state": { "state": {
"type": "backlink", "type": "backlink",
"state": { "state": {
"file": "03.03 Food & Wine/!!Wine.md", "file": "00.01 Admin/Test sheet.md",
"collapseAll": false, "collapseAll": false,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical", "sortOrder": "alphabetical",
@ -107,15 +107,15 @@
}, },
"active": "c252d60ecbda6bb3", "active": "c252d60ecbda6bb3",
"lastOpenFiles": [ "lastOpenFiles": [
"03.03 Food & Wine/!!Wine.md",
"03.03 Food & Wine/!!Coffee.md",
"03.03 Food & Wine/Maison Olivier Chanzy Chassagne-Montrachet 1er Cru.md",
"03.03 Food & Wine/Brazil Assodantas.md",
"03.03 Food & Wine/!!Wine 1.md",
"00.01 Admin/Templates/Template Wine 1.md",
"05.02 Networks/Server VPN.md",
"05.02 Networks/Server Cloud.md",
"00.01 Admin/Test sheet.md", "00.01 Admin/Test sheet.md",
"01.01 Life Orga/Finances.md" "01.02 Home/MRCK.md",
"03.03 Food & Wine/Maison Olivier Chanzy Chassagne-Montrachet 1er Cru.md",
"03.03 Food & Wine/!!Wine.md",
"05.02 Networks/Selfhosting.md",
"03.03 Food & Wine/@Side dishes.md",
"03.03 Food & Wine/Vanilla mashed potatoes.md",
"03.03 Food & Wine/@Main dishes.md",
"03.03 Food & Wine/@@Recipes.md",
"03.03 Food & Wine/Beef Noodles with Beans.md"
] ]
} }

@ -27,6 +27,8 @@ color blue
templater true templater true
``` ```
const {templaterFunc} = this.app.plugins.plugins["customjs"].api const {templaterFunc} = this.app.plugins.plugins["customjs"].api
templaterFunc.createNewFile(tp, tp.frontmatter.ChildrenType) templaterFunc.createNewFile(tp, tp.frontmatter.ChildrenType)
tp.file.content.replace(/[\w\W]+?\n+?/,"") tp.file.content.replace(/[\w\W]+?\n+?/,"")

@ -296,7 +296,7 @@ class globalFunc {
TempData = ["Name", "Type", "Vintage", "Country", "Terroir", "Appellation"] TempData = ["Name", "Type", "Vintage", "Country", "Terroir", "Appellation"]
break; break;
case 'extended': case 'extended':
TempData = ["Name", "Type", "Vintage", "Country", "Region", "Terroir", "Appellation", "Vineyard", "Variety", "Producer"] TempData = ["Name", "Type", "Vintage", "Country", "Region", "Terroir", "Appellation", "Vineyard", "Variety", "Notes"]
break; break;
} }
@ -404,7 +404,7 @@ class globalFunc {
TempData = [p.file.link, this.GetPoint(p, DataT, "type"), this.GetPoint(p, DataT, "vintage"), this.toEmoji(this.GetPoint(p, DataT, "country")), this.GetPoint(p, DataT, "subregion"), this.GetPoint(p, DataT, "appellation")] TempData = [p.file.link, this.GetPoint(p, DataT, "type"), this.GetPoint(p, DataT, "vintage"), this.toEmoji(this.GetPoint(p, DataT, "country")), this.GetPoint(p, DataT, "subregion"), this.GetPoint(p, DataT, "appellation")]
break; break;
case 'extended': case 'extended':
TempData = [p.file.link, this.GetPoint(p, DataT, "type"), this.GetPoint(p, DataT, "vintage"), this.toEmoji(this.GetPoint(p, DataT, "country")), this.GetPoint(p, DataT, "region"), this.GetPoint(p, DataT, "subregion"), this.GetPoint(p, DataT, "appellation"), this.GetPoint(p, DataT, "vineyard"), this.GetPoint(p, DataT, "varietal"), this.GetPoint(p, DataT, "producer")] TempData = [p.file.link, this.GetPoint(p, DataT, "type"), this.GetPoint(p, DataT, "vintage"), this.toEmoji(this.GetPoint(p, DataT, "country")), this.GetPoint(p, DataT, "region"), this.GetPoint(p, DataT, "subregion"), this.GetPoint(p, DataT, "appellation"), this.GetPoint(p, DataT, "vineyard"), this.GetPoint(p, DataT, "varietal"), this.GetPoint(p, "main", "tag")]
break; break;
} }
@ -515,6 +515,9 @@ class globalFunc {
case 'Brazil': case 'Brazil':
tempresult = "🇧🇷" tempresult = "🇧🇷"
break; break;
case 'Colombia':
tempresult = "🇨🇴"
break;
case 'Pub': case 'Pub':
tempresult = "🍺" tempresult = "🍺"
break; break;

@ -37,6 +37,8 @@ id CreateNote
```button ```button
name Save name Save
type command type command
@ -120,6 +122,16 @@ dv.view("00.01 Admin/dv-views/query_coffee", {type: "Arabica"})
#### By Geography #### By Geography
[[#^Top|TOP]] [[#^Top|TOP]]
##### Colombia
 
```dataviewjs
dv.view("00.01 Admin/dv-views/query_coffee", {country: "Colombia"})
```
 
##### Brazil ##### Brazil
   

@ -40,6 +40,8 @@ id CreateNote
```button ```button
name Save name Save
type command type command

@ -57,7 +57,7 @@ style: number
   
```dataviewjs ```dataviewjs
dv.view("00.01 Admin/dv-views/query_recipe", {course: "Side Dish", category: "Vegetable"}) dv.view("00.01 Admin/dv-views/query_recipe", {course: "Side Dish", category: ["Vegetable", "Potato"]})
``` ```
   

@ -0,0 +1,77 @@
---
Tag: ["Nutty", "Caramel", "Apricot", "Sugar Cane"]
Date: 2021-10-31
DocType: "Coffee"
Hierarchy: "NonRoot"
TimeStamp:
location:
CollapseMetaTable: Yes
Source:
cssclass: recipeTable
Coffee:
Brand: Jaramillo
Type: Arabica
Roast: Medium
Strength: 3
Country: Colombia
---
parent:: [[!!Coffee|Coffee]]
---
 
```button
name Save
type command
action Save current file
id Save
```
^button-JaramilloEspecialesNSave
# Jaramillo Especiales
 
```ad-abstract
title: Summary
collapse: open
Description
```
 
```toc
style: number
```
 
---
 
### Summary
 
| |
|-|-
| **Coffee type**: | `$=dv.current().Coffee.Type`
| **Strength**: | `$=dv.current().Coffee.Strength`
| **Country**: | `$=dv.current().Coffee.Country`
| **Roast**: | `$=dv.current().Coffee.Roast`
| **Brand**: | `$=dv.current().Coffee.Brand`
 
---
 
### Notes
 

@ -0,0 +1,135 @@
---
ServingSize: 4
cssclass: recipeTable
Tag: []
Date: 2021-09-21
DocType: "Recipe"
Hierarchy: "NonRoot"
location: [51.514678599999996, -0.18378583926867909]
CollapseMetaTable: Yes
Meta:
IsFavourite: False
Rating: 4
Recipe:
Courses: "Side Dish"
Categories: Potato
Collections: "French"
Source: https://www.sel-deguerande.fr/puree-vanille-lignac/
PreparationTime:
CookingTime: 45
OServingSize: 4
Ingredients:
- 1 kg pommes de terre
- 1 gousse vanille
- 20 cl crème liquide
- 90 gramme(s) beurre doux
- 20 cl lait
---
Parent:: [[@@Recipes]], [[Le Bar des Prés]]
---
 
```button
name Edit Recipe parameters
type command
action MetaEdit: Run MetaEdit
id EditMetaData
```
^button-VanillamashedpotatoesEdit
```button
name Save
type command
action Save current file
id Save
```
^button-VanillamashedpotatoesNSave
 
# Vanilla mashed potatoes
 
```toc
style: number
```
 
---
 
### Practical Informations
| |
|-|-
**Courses**: | `$=dv.current().Recipe.Courses`
**Categories**: | `$=dv.current().Recipe.Categories`
**Collections**: | `$=dv.current().Recipe.Collections`
**Serving size**: | `$=dv.current().ServingSize`
**Cooking time**: | `$=dv.current().Recipe.CookingTime` min
 
---
 
### Ingredients
 
```dataviewjs
dv.view("00.01 Admin/dv-views/query_ingredient", {ingredients: dv.current().Ingredients, originalportioncount: dv.current().Recipe.OServingSize})
```
 
---
 
### Instructions
1. Lavez et épluchez les pommes de terre (préférez des grosses pommes de terre pour purée pour cette recette).
 
2. Découpez les pommes de terre en dés et plongez-les dans une casserole deau bouillante salée.
 
3. Laissez cuire pendant environ 20 à 30 mn.
 
4. Versez la crème fraîche liquide avec la gousse de vanille dans une petite casserole : faites infuser pendant environ 2/3 minutes.
 
5. Égouttez les pommes de terre puis écrasez-les à laide dun presse-purée.
 
6. Découpez le beurre doux en petits dés : incorporez-le à votre purée encore chaude ainsi que la crème à la vanille.
 
7. Si votre purée nest pas assez « lisse » à votre goût, ajoutez un peu de lait chaud.
 
8. Servez la purée dans chaque assiette : parsemez de fleur de sel de Guérande et régalez-vous !
 
 
Loading…
Cancel
Save