Quellcode durchsuchen

fix: made defaultConfig no longer include the value-less options

Sv443 vor 10 Monaten
Ursprung
Commit
a56c9604b1
4 geänderte Dateien mit 13 neuen und 12 gelöschten Zeilen
  1. 7 7
      assets/translations/README.md
  2. 1 1
      assets/translations/en_US.json
  3. 2 1
      src/config.ts
  4. 3 3
      src/observers.ts

+ 7 - 7
assets/translations/README.md

@@ -72,7 +72,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
 | `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
 | `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
-| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being auto-liked` |
 | `feature_desc_autoLikeShowToast` | `Show a toast notification when a song is auto-liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
@@ -115,7 +115,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
 | `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
 | `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
-| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being auto-liked` |
 | `feature_desc_autoLikeShowToast` | `Show a toast notification when a song is auto-liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
@@ -158,7 +158,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
 | `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
 | `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
-| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being auto-liked` |
 | `feature_desc_autoLikeShowToast` | `Show a toast notification when a song is auto-liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
@@ -201,7 +201,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
 | `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
 | `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
-| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being auto-liked` |
 | `feature_desc_autoLikeShowToast` | `Show a toast notification when a song is auto-liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
@@ -244,7 +244,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
 | `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
 | `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
-| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being auto-liked` |
 | `feature_desc_autoLikeShowToast` | `Show a toast notification when a song is auto-liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
@@ -287,7 +287,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
 | `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
 | `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
-| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being auto-liked` |
 | `feature_desc_autoLikeShowToast` | `Show a toast notification when a song is auto-liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |
@@ -330,7 +330,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `feature_helpText_autoLikeChannels` | `Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.` |
 | `feature_desc_autoLikeChannelToggleBtn` | `Add a button to each channel page to enable or disable auto-liking` |
 | `feature_desc_autoLikePlayerBarToggleBtn` | `Add a button to the media controls to enable or disable auto-liking` |
-| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being liked` |
+| `feature_desc_autoLikeTimeout` | `How many seconds a song needs to play before being auto-liked` |
 | `feature_desc_autoLikeShowToast` | `Show a toast notification when a song is auto-liked` |
 | `feature_desc_autoLikeOpenMgmtDialog` | `Open the dialog to manage auto-liked channels` |
 | `feature_btn_autoLikeOpenMgmtDialog` | `Open dialog` |

+ 1 - 1
assets/translations/en_US.json

@@ -223,7 +223,7 @@
     "feature_helpText_autoLikeChannels": "Once enabled, you can enable this feature for certain channels by opening their page and clicking the toggle button. Afterwards, any song you play of that channel will be liked automatically.\nUse the option below to open a dialog to manage the channels.",
     "feature_desc_autoLikeChannelToggleBtn": "Add a button to each channel page to enable or disable auto-liking",
     "feature_desc_autoLikePlayerBarToggleBtn": "Add a button to the media controls to enable or disable auto-liking",
-    "feature_desc_autoLikeTimeout": "How many seconds a song needs to play before being liked",
+    "feature_desc_autoLikeTimeout": "How many seconds a song needs to play before being auto-liked",
     "feature_desc_autoLikeShowToast": "Show a toast notification when a song is auto-liked",
     "feature_desc_autoLikeOpenMgmtDialog": "Open the dialog to manage auto-liked channels",
     "feature_btn_autoLikeOpenMgmtDialog": "Open dialog",

+ 2 - 1
src/config.ts

@@ -11,6 +11,8 @@ import type { FeatureConfig, FeatureKey } from "./types.js";
 export const formatVersion = 6;
 
 export const defaultData = (Object.keys(featInfo) as (keyof typeof featInfo)[])
+  // @ts-ignore
+  .filter((ftKey) => featInfo?.[ftKey]?.default !== undefined)
   .reduce<Partial<FeatureConfig>>((acc, key) => {
     // @ts-ignore
     acc[key] = featInfo?.[key]?.default as unknown as undefined;
@@ -166,7 +168,6 @@ export function fixMissingCfgKeys(cfg: Partial<FeatureConfig>): FeatureConfig {
   const defaultKeys = Object.keys(defaultData);
   const missingKeys = defaultKeys.filter(k => !passedKeys.includes(k));
   if(missingKeys.length > 0) {
-    info("Fixed missing feature config keys:", missingKeys);
     for(const key of missingKeys)
       cfg[key as keyof FeatureConfig] = defaultData[key as keyof FeatureConfig] as never;
   }

+ 3 - 3
src/observers.ts

@@ -3,9 +3,9 @@ import { emitInterface } from "./interface.js";
 import { error, getDomain } from "./utils/index.js";
 import type { Domain } from "./types.js";
 
-// >> If you came here looking for which observer to use, start out by looking at the types `YTMObserverName` and `YTObserverName`
-// >> Once you found a fitting observer, go to the `initObservers()` function and search for `observerName = new SelectorObserver`
-// >> Just above that line, you'll find the selector to that observer's base element. Make sure all your selectors start **below** that element!
+// !> If you came here looking for which observer to use, start out by looking at the types `YTMObserverName` and `YTObserverName`
+// !> Once you found a fitting observer, go to the `initObservers()` function and search for `observerName = new SelectorObserver`
+// !> Just above that line, you'll find the selector to that observer's base element. Make sure all your selectors start **below** that element!
 
 
 //#region types