diff --git a/CHANGELOG.md b/CHANGELOG.md index 396abed..a5e6228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# 0.8.1 + +### New + +- Obsidian Protocol handler for making installing plugins and themes easier by using Obsidian's protocol feature. See https://tfthacker.com/brat-protocol for more information. + This new feature contributed by @mProjectsCode (Thank you!). +- chore: updated all dependencies. + +### Fix + +- Bug introduced with 8.02 when manifest-beta.json is used that a plugin will not installed. (https://github.com/TfTHacker/obsidian42-brat/issues/71) Thank you for reporting this @mProjectsCode. + # 0.8.0 ### New diff --git a/manifest.json b/manifest.json index f5d8704..88a6e5b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian42-brat", "name": "BRAT", - "version": "0.8.0", + "version": "0.8.1", "minAppVersion": "1.4.16", "description": "Easily install a beta version of a plugin for testing.", "author": "TfTHacker", diff --git a/package.json b/package.json index 2cbcea4..ca92c68 100644 --- a/package.json +++ b/package.json @@ -19,14 +19,14 @@ "url": "git://github.com/TfTHacker/obsidian42-brat.git" }, "devDependencies": { - "typescript": "5.3.2", + "typescript": "5.3.3", "tslib": "^2.6.2", - "@types/node": "^20.10.3", - "@typescript-eslint/eslint-plugin": "^6.13.1", - "@typescript-eslint/parser": "^6.13.1", - "@typescript-eslint/utils": "^6.13.1", + "@types/node": "^20.10.4", + "@typescript-eslint/eslint-plugin": "^6.13.2", + "@typescript-eslint/parser": "^6.13.2", + "@typescript-eslint/utils": "^6.13.2", "builtin-modules": "3.3.0", - "esbuild": "0.19.8", + "esbuild": "0.19.9", "eslint": "^8.55.0", "eslint-config-prettier": "^9.0.0", "eslint-import-resolver-typescript": "^3.6.1", @@ -34,22 +34,22 @@ "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsonc": "^2.10.0", - "eslint-plugin-mdx": "^2.2.0", + "eslint-plugin-mdx": "^3.0.0", "eslint-plugin-only-warn": "^1.1.0", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-tsdoc": "^0.2.17", "eslint-plugin-yml": "^1.10.0", - "@html-eslint/eslint-plugin": "^0.21.0", - "@html-eslint/parser": "^0.21.0", + "@html-eslint/eslint-plugin": "^0.22.0", + "@html-eslint/parser": "^0.22.0", "husky": "^8.0.3", "jsdom": "^23.0.0", "lint-staged": "^15.2.0", - "prettier": "^3.1.0", + "prettier": "^3.1.1", "remark-preset-lint-consistent": "^5.1.2", "remark-preset-lint-markdown-style-guide": "^5.1.3", "remark-preset-lint-recommended": "^6.1.3", "remark-preset-prettier": "^2.0.1", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "typedoc": "^0.25.3", "@types/obsidian-typings": "github:Fevol/obsidian-typings", "obsidian": "1.4.11" diff --git a/src/features/BetaPlugins.ts b/src/features/BetaPlugins.ts index b78169c..758869b 100644 --- a/src/features/BetaPlugins.ts +++ b/src/features/BetaPlugins.ts @@ -199,15 +199,16 @@ export default class BetaPlugins { specifyVersion = '', forceReinstall = false ): Promise { - console.log( - 'BRAT: addPlugin', - repositoryPath, - updatePluginFiles, - seeIfUpdatedOnly, - reportIfNotUpdted, - specifyVersion, - forceReinstall - ); + if (this.plugin.settings.debuggingMode) + console.log( + 'BRAT: addPlugin', + repositoryPath, + updatePluginFiles, + seeIfUpdatedOnly, + reportIfNotUpdted, + specifyVersion, + forceReinstall + ); const noticeTimeout = 10; // attempt to get manifest-beta.json @@ -266,7 +267,10 @@ export default class BetaPlugins { if (usingBetaManifest || rFiles.manifest === '') rFiles.manifest = JSON.stringify(primaryManifest); - if (usingBetaManifest || rFiles.mainJs === null) { + if (this.plugin.settings.debuggingMode) + console.log('BRAT: rFiles.manifest', usingBetaManifest, rFiles); + + if (rFiles.mainJs === null) { const msg = `${repositoryPath}\nThe release is not complete and cannot be download. main.js is missing from the Release`; await this.plugin.log(msg, true); toastMessage(this.plugin, `${msg}`, noticeTimeout); @@ -512,4 +516,4 @@ export default class BetaPlugins { !enabledPlugins.find((pluginName) => manifest.id === pluginName.id) ); } -} \ No newline at end of file +} diff --git a/src/features/githubUtils.ts b/src/features/githubUtils.ts index 0e4a908..8f520fc 100644 --- a/src/features/githubUtils.ts +++ b/src/features/githubUtils.ts @@ -47,8 +47,11 @@ export const grabManifestJsonFromRepository = async ( GITHUB_RAW_USERCONTENT_PATH + repositoryPath + (rootManifest ? '/HEAD/manifest.json' : '/HEAD/manifest-beta.json'); + if (debugLogging) + console.log('grabManifestJsonFromRepository manifestJsonPath', manifestJsonPath); try { const response: string = await request({ url: manifestJsonPath }); + if (debugLogging) console.log('grabManifestJsonFromRepository response', response); return response === '404: Not Found' ? null : ( ((await JSON.parse(response)) as PluginManifest) ); diff --git a/src/main.ts b/src/main.ts index 6b50b83..c53b29d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ -import { ObsidianProtocolData, Plugin } from 'obsidian'; +import { Plugin } from 'obsidian'; +import type { ObsidianProtocolData } from 'obsidian'; import { BratSettingsTab } from './ui/SettingsTab'; import type { Settings } from './settings'; import { DEFAULT_SETTINGS } from './settings'; @@ -13,7 +14,7 @@ import AddNewTheme from './ui/AddNewTheme'; import AddNewPluginModal from './ui/AddNewPluginModal'; export default class ThePlugin extends Plugin { - APP_NAME = "Obsidian42 - Beta Reviewer's Auto-update Tool (BRAT)"; + APP_NAME = 'BRAT'; APP_ID = 'obsidian42-brat'; settings: Settings = DEFAULT_SETTINGS; betaPlugins = new BetaPlugins(this); @@ -21,7 +22,7 @@ export default class ThePlugin extends Plugin { bratApi: BratAPI = new BratAPI(this); async onload(): Promise { - console.log('loading Obsidian42 - BRAT'); + console.log('loading ' + this.APP_NAME); await this.loadSettings(); this.addSettingTab(new BratSettingsTab(this.app, this)); @@ -70,23 +71,22 @@ export default class ThePlugin extends Plugin { await this.saveData(this.settings); } - obsidianProtocolHandler = async (params: ObsidianProtocolData) => { + obsidianProtocolHandler = (params: ObsidianProtocolData) => { if (!params.plugin && !params.theme) { - toastMessage( - this, - `Could not locate the repository from the URL.`, - 10 - ); + toastMessage(this, `Could not locate the repository from the URL.`, 10); return; } for (const which of ['plugin', 'theme']) { if (params[which]) { - const modal = which === 'plugin' ? new AddNewPluginModal(this, this.betaPlugins) : new AddNewTheme(this); + const modal = + which === 'plugin' ? + new AddNewPluginModal(this, this.betaPlugins) + : new AddNewTheme(this); modal.address = params[which]; modal.open(); return; } } - } + }; } diff --git a/src/ui/AddNewTheme.ts b/src/ui/AddNewTheme.ts index dfc273d..c2701db 100644 --- a/src/ui/AddNewTheme.ts +++ b/src/ui/AddNewTheme.ts @@ -24,11 +24,7 @@ export default class AddNewTheme extends Modal { if (this.address === '') return; const scrubbedAddress = this.address.replace('https://github.com/', ''); if (existBetaThemeinInList(this.plugin, scrubbedAddress)) { - toastMessage( - this.plugin, - `This theme is already in the list for beta testing`, - 10 - ); + toastMessage(this.plugin, `This theme is already in the list for beta testing`, 10); return; }