Browse Source

feat: added new plugin intents and reordered them

Sv443 7 months ago
parent
commit
c42b7af875
2 changed files with 14 additions and 8 deletions
  1. 2 0
      changelog.md
  2. 12 8
      src/types.ts

+ 2 - 0
changelog.md

@@ -72,6 +72,8 @@
   - Changed components:
     - BytmDialog now has the option `removeListenersOnDestroy` (true by default) to configure removing all event listeners when the dialog is destroyed
     - BytmDialog's private members and methods have been changed to protected for easier extension (when using TypeScript)
+  - Plugin definition changes:
+    - Some intents were added or moved around in their order. See the new values in `src/types.ts -> enum PluginIntent`
   - Added interface functions:
     - `setInnerHtml()` to set the innerHTML property of an element to a sanitized string using the [Trusted Types API](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API) and the library [DOMPurify](https://github.com/cure53/DOMPurify)
     - `getAutoLikeData()` to return the current auto-like data (authenticated function)

+ 12 - 8
src/types.ts

@@ -158,18 +158,22 @@ declare global {
  * Never request more permissions than you need, as this is a bad practice and can lead to your plugin being rejected.
  */
 export enum PluginIntent {
-  /** Plugin has access to hidden config values */
-  HiddenConfigValues = 1,
+  /** Plugin can read the feature configuration */
+  ReadConfig = 1,
   /** Plugin can write to the feature configuration */
-  WriteFeatureConfig = 2,
+  WriteConfig = 2,
+  /** Plugin has access to hidden config values */
+  SeeHiddenConfigValues = 4,
   /** Plugin can write to the lyrics cache */
-  WriteLyricsCache = 4,
+  WriteLyricsCache = 8,
   /** Plugin can add new translations and overwrite existing ones */
-  WriteTranslations = 8,
+  WriteTranslations = 16,
   /** Plugin can create modal dialogs */
-  CreateModalDialogs = 16,
-  /** Plugin can read and write auto-like data */
-  ReadAndWriteAutoLikeData = 32,
+  CreateModalDialogs = 32,
+  /** Plugin can read auto-like data */
+  ReadAutoLikeData = 64,
+  /** Plugin can write to auto-like data */
+  WriteAutoLikeData = 128,
 }
 
 /** Result of a plugin registration */