types.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. import type * as consts from "./constants.js";
  2. import type { scriptInfo } from "./constants.js";
  3. import type { addSelectorListener } from "./observers.js";
  4. import type resources from "../assets/resources.json";
  5. import type locales from "../assets/locales.json";
  6. import type { getResourceUrl, getSessionId, getVideoTime, TrLocale, t, tp, NanoEmitter, fetchVideoVotes, onInteraction, getThumbnailUrl, getBestThumbnailUrl, getLocale, hasKey, hasKeyFor } from "./utils/index.js";
  7. import type { SiteEventsMap } from "./siteEvents.js";
  8. import type { InterfaceEventsMap, getAutoLikeDataInterface, getFeaturesInterface, getPluginInfo, registerPlugin, saveAutoLikeDataInterface, saveFeaturesInterface, setLocaleInterface } from "./interface.js";
  9. import type { BytmDialog, ExImDialog, createCircularBtn, createHotkeyInput, createRipple, createToggleInput, showIconToast, showToast } from "./components/index.js";
  10. import type { fetchLyricsUrlTop, sanitizeArtists, sanitizeSong } from "./features/lyrics.js";
  11. import type { getLyricsCacheEntry } from "./features/lyricsCache.js";
  12. //#region other
  13. /** Custom CLI args passed to rollup */
  14. export type RollupArgs = Partial<{
  15. "config-mode": "development" | "production";
  16. "config-branch": "main" | "develop";
  17. "config-host": "greasyfork" | "github" | "openuserjs";
  18. "config-assetSource": "local" | "github";
  19. "config-suffix": string;
  20. }>;
  21. // I know TS enums are impure but it doesn't really matter here, plus imo they are cooler than pure enums anyway
  22. export enum LogLevel {
  23. Debug,
  24. Info,
  25. }
  26. /** Which domain this script is currently running on */
  27. export type Domain = "yt" | "ytm";
  28. /** A selection option between one of the supported domains, or all of them */
  29. export type SiteSelection = Domain | "all";
  30. /** A selection option between one of the supported domains, or none of them */
  31. export type SiteSelectionOrNone = SiteSelection | "none";
  32. /** Key of a resource in `assets/resources.json` and extra keys defined by `tools/post-build.ts` */
  33. export type ResourceKey = keyof typeof resources | `trans-${keyof typeof locales}` | "changelog" | "css-bundle";
  34. /** Describes a single hotkey */
  35. export type HotkeyObj = {
  36. code: string,
  37. shift: boolean,
  38. ctrl: boolean,
  39. alt: boolean,
  40. };
  41. export type LyricsCacheEntry = {
  42. artist: string;
  43. song: string;
  44. url: string;
  45. viewed: number;
  46. added: number;
  47. };
  48. export type AutoLikeData = {
  49. channels: {
  50. /** 24-character channel ID or user ID including the @ prefix */
  51. id: string;
  52. /** Channel name (for display purposes only) */
  53. name: string;
  54. /** Whether the channel should be auto-liked */
  55. enabled: boolean;
  56. }[];
  57. };
  58. export type RYDVotesObj = {
  59. /** The watch ID of the video */
  60. id: string;
  61. /** ISO timestamp of when the video was uploaded */
  62. dateCreated: string;
  63. /** Amount of likes */
  64. likes: number;
  65. /** Amount of dislikes */
  66. dislikes: number;
  67. /** Like to dislike ratio from 0.0 to 5.0 */
  68. rating: number;
  69. /** Amount of views */
  70. viewCount: number;
  71. /** Whether the video was deleted */
  72. deleted: boolean;
  73. };
  74. export type VideoVotesObj = {
  75. /** The watch ID of the video */
  76. id: string;
  77. /** Amount of likes */
  78. likes: number;
  79. /** Amount of dislikes */
  80. dislikes: number;
  81. /** Like to dislike ratio from 0.0 to 5.0 */
  82. rating: number;
  83. /** Timestamp of when the data was fetched */
  84. timestamp: number;
  85. };
  86. export type NumberNotation = "short" | "long";
  87. //#region global
  88. /** All properties of the `unsafeWindow.BYTM` object (also called "plugin interface") */
  89. export type BytmObject =
  90. {
  91. [key: string]: unknown;
  92. locale: TrLocale;
  93. logLevel: LogLevel;
  94. }
  95. // information from the userscript header
  96. & typeof scriptInfo
  97. // certain variables from `src/constants.ts`
  98. & Pick<typeof consts, "mode" | "branch" | "host" | "buildNumber" | "compressionFormat">
  99. // global functions exposed through the interface in `src/interface.ts`
  100. & InterfaceFunctions
  101. // others
  102. & {
  103. NanoEmitter: typeof NanoEmitter;
  104. BytmDialog: typeof BytmDialog;
  105. ExImDialog: typeof ExImDialog;
  106. // the entire UserUtils library
  107. UserUtils: typeof import("@sv443-network/userutils");
  108. // the entire compare-versions library
  109. compareVersions: typeof import("compare-versions");
  110. };
  111. declare global {
  112. interface Window {
  113. // to see the expanded type, install the VS Code extension "MylesMurphy.prettify-ts" and hover over the property below
  114. // alternatively navigate with ctrl+click to find the types
  115. BYTM: BytmObject;
  116. }
  117. }
  118. //#region plugins
  119. /**
  120. * Intents (permissions) BYTM has to grant your plugin for it to be able to access certain features.
  121. * TODO: this feature is unfinished, but you should still specify the intents your plugin needs.
  122. * Never request more permissions than you need, as this is a bad practice and can lead to your plugin being rejected.
  123. */
  124. export enum PluginIntent {
  125. /** Plugin has access to hidden config values */
  126. HiddenConfigValues = 1,
  127. /** Plugin can write to the feature configuration */
  128. WriteFeatureConfig = 2,
  129. /** Plugin can write to the lyrics cache */
  130. WriteLyricsCache = 4,
  131. /** Plugin can add new translations and overwrite existing ones */
  132. WriteTranslations = 8,
  133. /** Plugin can create modal dialogs */
  134. CreateModalDialogs = 16,
  135. /** Plugin can read and write auto-like data */
  136. ReadAndWriteAutoLikeData = 32,
  137. }
  138. /** Result of a plugin registration */
  139. export type PluginRegisterResult = {
  140. /** Public info about the registered plugin */
  141. info: PluginInfo;
  142. /** NanoEmitter instance for plugin events - see {@linkcode PluginEventMap} for a list of events */
  143. events: NanoEmitter<PluginEventMap>;
  144. /** Authentication token for the plugin to use in certain restricted function calls */
  145. token: string;
  146. }
  147. /** Minimal object that describes a plugin - this is all info the other installed plugins can see */
  148. export type PluginInfo = {
  149. /** Name of the plugin */
  150. name: string;
  151. /**
  152. * Adding the namespace and the name property makes the unique identifier for a plugin.
  153. * If one exists with the same name and namespace as this plugin, it may be overwritten at registration.
  154. * I recommend to set this value to a URL pointing to your homepage, or the author's username.
  155. */
  156. namespace: string;
  157. /** Version of the plugin as a semver-compliant string */
  158. version: string;
  159. };
  160. /** Minimum part of the PluginDef object needed to make up the resolvable plugin identifier */
  161. export type PluginDefResolvable = PluginDef | { plugin: Pick<PluginDef["plugin"], "name" | "namespace"> };
  162. /** An object that describes a BYTM plugin */
  163. export type PluginDef = {
  164. plugin: PluginInfo & {
  165. /**
  166. * Descriptions of at least en_US and optionally any other locale supported by BYTM.
  167. * When an untranslated locale is set, the description will default to the value of en_US
  168. */
  169. description: Partial<Record<keyof typeof locales, string>> & {
  170. en_US: string;
  171. };
  172. /** URL to the plugin's icon - recommended size: 48x48 to 128x128 */
  173. iconUrl?: string;
  174. license?: {
  175. /** License name */
  176. name: string;
  177. /** URL to the license text */
  178. url: string;
  179. };
  180. /** Homepage URLs for the plugin */
  181. homepage: {
  182. /** URL to the plugin's source code (i.e. Git repo) - closed source plugins are not officially accepted at the moment. */
  183. source: string;
  184. /** Any other homepage URL */
  185. other?: string;
  186. /** URL to the plugin's bug tracker page, like GitHub issues */
  187. bug?: string;
  188. /** URL to the plugin's GreasyFork page */
  189. greasyfork?: string;
  190. /** URL to the plugin's OpenUserJS page */
  191. openuserjs?: string;
  192. };
  193. };
  194. /** Intents (permissions) BYTM has to grant the plugin for it to work */
  195. intents?: number;
  196. /** Info about the plugin contributors */
  197. contributors?: Array<{
  198. /** Name of this contributor */
  199. name: string;
  200. /** (optional) Email address of this contributor */
  201. email?: string;
  202. /** (optional) URL to this plugin contributor's homepage / GitHub profile */
  203. url?: string;
  204. }>;
  205. };
  206. /** All events that are dispatched to plugins individually, including everything in {@linkcode SiteEventsMap} and {@linkcode InterfaceEventsMap} - these don't have a prefix since they can't conflict with other events */
  207. export type PluginEventMap =
  208. // These are emitted on each plugin individually, with individual data:
  209. & {
  210. /** Emitted when the plugin is fully registered on BYTM's side and can use authenticated API calls */
  211. pluginRegistered: (info: PluginInfo) => void;
  212. }
  213. // These are emitted on every plugin simultaneously, with the same or similar data:
  214. & SiteEventsMap
  215. & InterfaceEventsMap;
  216. /** A plugin in either the queue or registered map */
  217. export type PluginItem =
  218. & {
  219. def: PluginDef;
  220. }
  221. & Pick<PluginRegisterResult, "events">;
  222. /** All functions exposed by the interface on the global `BYTM` object */
  223. export type InterfaceFunctions = {
  224. // meta:
  225. /** Registers a plugin with BYTM. Needed to receive the token for making authenticated function calls. */
  226. registerPlugin: typeof registerPlugin;
  227. /** 🔒 Checks if the plugin with the given name and namespace is registered and returns an info object about it */
  228. getPluginInfo: typeof getPluginInfo;
  229. // bytm-specific:
  230. /**
  231. * Returns the URL of a resource as defined in `assets/resources.json`
  232. * There are also some resources like translation files that get added by `tools/post-build.ts`
  233. *
  234. * The returned URL is a `blob:` URL served up by the userscript extension
  235. * This makes the resource fast to fetch and also prevents CORS issues
  236. */
  237. getResourceUrl: typeof getResourceUrl;
  238. /** Returns the unique session ID for the current tab */
  239. getSessionId: typeof getSessionId;
  240. // dom:
  241. /** Adds a listener to one of the already present SelectorObserver instances */
  242. addSelectorListener: typeof addSelectorListener;
  243. /** Registers accessible interaction listeners (click, enter, space) on the provided element */
  244. onInteraction: typeof onInteraction;
  245. /**
  246. * Returns the current video time (on both YT and YTM)
  247. * In case it can't be determined on YT, mouse movement is simulated to bring up the video time
  248. * In order for that edge case not to error out, the function would need to be called in response to a user interaction event (e.g. click) due to the strict autoplay policy in browsers
  249. */
  250. getVideoTime: typeof getVideoTime;
  251. /** Returns the thumbnail URL for the provided video ID and thumbnail quality */
  252. getThumbnailUrl: typeof getThumbnailUrl;
  253. /** Returns the thumbnail URL with the best quality for the provided video ID */
  254. getBestThumbnailUrl: typeof getBestThumbnailUrl;
  255. // translations:
  256. /** 🔒 Sets the locale for all new translations */
  257. setLocale: typeof setLocaleInterface;
  258. /** Returns the current locale */
  259. getLocale: typeof getLocale;
  260. /** Returns whether a translation key exists for the set locale */
  261. hasKey: typeof hasKey;
  262. /** Returns whether a translation key exists for the provided locale */
  263. hasKeyFor: typeof hasKeyFor;
  264. /** Returns the translation for the provided translation key and set locale (check the files in the folder `assets/translations`) */
  265. t: typeof t;
  266. /** Returns the translation for the provided translation key, including pluralization identifier and set locale (check the files in the folder `assets/translations`) */
  267. tp: typeof tp;
  268. // feature config:
  269. /** 🔒 Returns the current feature configuration */
  270. getFeatures: typeof getFeaturesInterface;
  271. /** 🔒 Overwrites the feature configuration with the provided one */
  272. saveFeatures: typeof saveFeaturesInterface;
  273. // lyrics:
  274. /** Sanitizes the provided artist string - this needs to be done before calling other lyrics related functions! */
  275. sanitizeArtists: typeof sanitizeArtists;
  276. /** Sanitizes the provided song title string - this needs to be done before calling other lyrics related functions! */
  277. sanitizeSong: typeof sanitizeSong;
  278. /** Fetches the lyrics URL of the top search result for the provided song and artist. Before a request is sent, the cache is checked for a match. */
  279. fetchLyricsUrlTop: typeof fetchLyricsUrlTop;
  280. /** Returns the lyrics cache entry for the provided song and artist, if there is one. Never sends a request on its own. */
  281. getLyricsCacheEntry: typeof getLyricsCacheEntry;
  282. // auto-like:
  283. /** 🔒 Returns the current auto-like data */
  284. getAutoLikeData: typeof getAutoLikeDataInterface;
  285. /** 🔒 Overwrites the auto-like data */
  286. saveAutoLikeData: typeof saveAutoLikeDataInterface;
  287. /** Returns the votes for the provided video ID from the ReturnYoutubeDislike API */
  288. fetchVideoVotes: typeof fetchVideoVotes;
  289. // components:
  290. /** Creates a new hotkey input component */
  291. createHotkeyInput: typeof createHotkeyInput;
  292. /** Creates a new toggle input component */
  293. createToggleInput: typeof createToggleInput;
  294. /** Creates a new circular button component */
  295. createCircularBtn: typeof createCircularBtn;
  296. /** Creates a new ripple effect on the provided element or creates an empty element that has the effect */
  297. createRipple: typeof createRipple;
  298. /** Shows a toast with the provided text */
  299. showToast: typeof showToast;
  300. /** Shows a toast with the provided text and an icon */
  301. showIconToast: typeof showIconToast;
  302. };
  303. //#region feature defs
  304. export type FeatureKey = keyof FeatureConfig;
  305. export type FeatureCategory =
  306. | "layout"
  307. | "volume"
  308. | "songLists"
  309. | "behavior"
  310. | "input"
  311. | "lyrics"
  312. | "general";
  313. type SelectOption = {
  314. value: string | number;
  315. label: string;
  316. };
  317. type FeatureTypeProps = ({
  318. type: "toggle";
  319. default: boolean;
  320. } & FeatureFuncProps)
  321. | ({
  322. type: "number";
  323. default: number;
  324. min: number;
  325. max?: number;
  326. step?: number;
  327. unit?: string | ((val: number) => string);
  328. } & FeatureFuncProps)
  329. | ({
  330. type: "select";
  331. default: string | number;
  332. options: SelectOption[] | (() => SelectOption[]);
  333. } & FeatureFuncProps)
  334. | ({
  335. type: "slider";
  336. default: number;
  337. min: number;
  338. max: number;
  339. step?: number;
  340. unit?: string | ((val: number) => string);
  341. } & FeatureFuncProps)
  342. | ({
  343. type: "hotkey";
  344. default: HotkeyObj;
  345. } & FeatureFuncProps)
  346. | ({
  347. type: "text";
  348. default: string;
  349. normalize?: (val: string) => string;
  350. } & FeatureFuncProps)
  351. | {
  352. type: "button";
  353. default?: undefined;
  354. click: () => Promise<void | unknown> | void | unknown;
  355. }
  356. type FeatureFuncProps = (
  357. {
  358. /** Whether the feature requires a page reload to take effect */
  359. reloadRequired: false;
  360. /** Called to instantiate the feature on the page */
  361. enable: (featCfg: FeatureConfig) => void,
  362. }
  363. | {
  364. /** Whether the feature requires a page reload to take effect */
  365. reloadRequired?: true;
  366. /** Called to instantiate the feature on the page */
  367. enable?: undefined;
  368. }
  369. ) & (
  370. {
  371. /** Called to remove all traces of the feature from the page and memory (includes event listeners) */
  372. disable?: (feats: FeatureConfig) => void,
  373. }
  374. | {
  375. /** Called to update the feature's behavior when the config changes */
  376. change?: (key: FeatureKey, initialVal: number | boolean | Record<string, unknown>, newVal: number | boolean | Record<string, unknown>) => void,
  377. }
  378. );
  379. /**
  380. * The feature info object that contains all properties necessary to construct the config menu and the feature config object.
  381. * All values are loosely typed so try to only use this with the `satisfies` keyword.
  382. * Use `typeof featInfo` (from `src/features/index.ts`) instead for full type safety.
  383. */
  384. export type FeatureInfo = Record<
  385. keyof FeatureConfig,
  386. {
  387. category: FeatureCategory;
  388. /**
  389. * HTML string that will be the help text for this feature
  390. * Specifying a function is useful for pluralizing or inserting values into the translation at runtime
  391. */
  392. helpText?: string | (() => string);
  393. /** Whether the value should be hidden in the config menu and from plugins */
  394. valueHidden?: boolean;
  395. /** Transformation function called before the value is rendered in the config menu */
  396. renderValue?: (value: string) => string | Promise<string>;
  397. /** HTML string that is appended to the end of a feature's text description */
  398. textAdornment?: () => (Promise<string | undefined> | string | undefined);
  399. /** Whether to only show this feature when advanced mode is activated (default false) */
  400. advanced?: boolean;
  401. }
  402. & FeatureTypeProps
  403. >;
  404. //#region feature config
  405. /** Feature configuration */
  406. export interface FeatureConfig {
  407. //#region layout
  408. /** Show a BetterYTM watermark under the YTM logo */
  409. watermarkEnabled: boolean;
  410. /** Remove the "si" tracking parameter from links in the share menu? */
  411. removeShareTrackingParam: boolean;
  412. /** On which sites to remove the "si" tracking parameter from links in the share menu */
  413. removeShareTrackingParamSites: SiteSelection;
  414. /** Enable skipping to a specific time in the video by pressing a number key (0-9) */
  415. numKeysSkipToTime: boolean;
  416. /** Fix spacing issues in the layout */
  417. fixSpacing: boolean;
  418. /** Where to show a thumbnail overlay over the video element and whether to show it at all */
  419. thumbnailOverlayBehavior: "never" | "videosOnly" | "songsOnly" | "always";
  420. /** Whether to show a button to toggle the thumbnail overlay in the media controls */
  421. thumbnailOverlayToggleBtnShown: boolean;
  422. /** Whether to show an indicator on the thumbnail overlay when it is active */
  423. thumbnailOverlayShowIndicator: boolean;
  424. /** The opacity of the thumbnail overlay indicator element */
  425. thumbnailOverlayIndicatorOpacity: number;
  426. /** How to fit the thumbnail overlay image */
  427. thumbnailOverlayImageFit: "cover" | "contain" | "fill";
  428. /** Hide the cursor when it's idling on the video element for a while */
  429. hideCursorOnIdle: boolean;
  430. /** Delay in seconds after which the cursor should be hidden */
  431. hideCursorOnIdleDelay: number;
  432. /** Whether to fix various issues in the layout when HDR is supported and active */
  433. fixHdrIssues: boolean;
  434. /** On which sites to disable Dark Reader - does nothing if the extension is not installed */
  435. disableDarkReaderSites: SiteSelectionOrNone;
  436. /** Whether to show the like/dislike ratio on the currently playing song */
  437. showVotes: boolean;
  438. /** Which format to use for the like/dislike ratio on the currently playing song */
  439. showVotesFormat: NumberNotation;
  440. //#region volume
  441. /** Add a percentage label to the volume slider */
  442. volumeSliderLabel: boolean;
  443. /** The width of the volume slider in pixels */
  444. volumeSliderSize: number;
  445. /** Volume slider sensitivity - the smaller this number, the finer the volume control */
  446. volumeSliderStep: number;
  447. /** Volume slider scroll wheel sensitivity */
  448. volumeSliderScrollStep: number;
  449. /** Whether the volume should be locked to the same level across all tabs (changing in one changes in all others too) */
  450. volumeSharedBetweenTabs: boolean;
  451. /** Whether to set an initial volume level for each new session */
  452. setInitialTabVolume: boolean;
  453. /** The initial volume level to set for each new session */
  454. initialTabVolumeLevel: number;
  455. //#region song lists
  456. /** Add a button to each song in the queue to quickly open its lyrics page */
  457. lyricsQueueButton: boolean;
  458. /** Add a button to each song in the queue to quickly remove it */
  459. deleteFromQueueButton: boolean;
  460. /** Where to place the buttons in the queue */
  461. listButtonsPlacement: "queueOnly" | "everywhere";
  462. /** Add a button above the queue to scroll to the currently playing song */
  463. scrollToActiveSongBtn: boolean;
  464. /** Add a button above the queue to clear it */
  465. clearQueueBtn: boolean;
  466. //#region behavior
  467. /** Whether to completely disable the popup that sometimes appears before leaving the site */
  468. disableBeforeUnloadPopup: boolean;
  469. /** After how many milliseconds to close permanent toasts */
  470. closeToastsTimeout: number;
  471. /** Remember the last song's time when reloading or restoring the tab */
  472. rememberSongTime: boolean;
  473. /** Where to remember the song time */
  474. rememberSongTimeSites: SiteSelection;
  475. /** Time in seconds to remember the song time for */
  476. rememberSongTimeDuration: number;
  477. /** Time in seconds to subtract from the remembered song time */
  478. rememberSongTimeReduction: number;
  479. /** Minimum time in seconds the song needs to be played before it is remembered */
  480. rememberSongTimeMinPlayTime: number;
  481. //#region input
  482. /** Arrow keys skip forwards and backwards */
  483. arrowKeySupport: boolean;
  484. /** By how many seconds to skip when pressing the arrow keys */
  485. arrowKeySkipBy: number;
  486. /** Add a hotkey to switch between the YT and YTM sites on a video / song */
  487. switchBetweenSites: boolean;
  488. /** The hotkey that needs to be pressed to initiate the site switch */
  489. switchSitesHotkey: HotkeyObj;
  490. /** Make it so middle clicking a song to open it in a new tab (through thumbnail and song title) is easier */
  491. anchorImprovements: boolean;
  492. /** Whether to auto-like all played videos of configured channels */
  493. autoLikeChannels: boolean;
  494. /** Whether to show toggle buttons on the channel page to enable/disable auto-liking for that channel */
  495. autoLikeChannelToggleBtn: boolean;
  496. // TODO(v2.2):
  497. // /** Whether to show a toggle button in the media controls to enable/disable auto-liking for those channel(s) */
  498. // autoLikePlayerBarToggleBtn: boolean;
  499. /** How long to wait after a video has started playing to auto-like it */
  500. autoLikeTimeout: number;
  501. /** Whether to show a toast when a video is auto-liked */
  502. autoLikeShowToast: boolean;
  503. /** Opens the auto-like channels management dialog */
  504. autoLikeOpenMgmtDialog: undefined;
  505. //#region lyrics
  506. /** Add a button to the media controls to open the current song's lyrics on genius.com in a new tab */
  507. geniusLyrics: boolean;
  508. /** Base URL to use for GeniURL */
  509. geniUrlBase: string;
  510. /** Token to use for GeniURL */
  511. geniUrlToken: string;
  512. /** Max size of lyrics cache */
  513. lyricsCacheMaxSize: number;
  514. /** Max TTL of lyrics cache entries, in ms */
  515. lyricsCacheTTL: number;
  516. /** Button to clear lyrics cache */
  517. clearLyricsCache: undefined;
  518. // /** Whether to use advanced filtering when searching for lyrics (exact, exact-ish) */
  519. // advancedLyricsFilter: boolean;
  520. //#region misc
  521. /** The locale to use for translations */
  522. locale: TrLocale;
  523. /** Whether to default to US-English if the translation for the set locale is missing */
  524. localeFallback: boolean;
  525. /** Whether to check for updates to the script */
  526. versionCheck: boolean;
  527. /** Button to check for updates */
  528. checkVersionNow: undefined;
  529. /** The console log level - 0 = Debug, 1 = Info */
  530. logLevel: LogLevel;
  531. /** Amount of seconds until the feature initialization times out */
  532. initTimeout: number;
  533. /** Amount of seconds to show BYTM's toasts for */
  534. toastDuration: number;
  535. /** Button that resets the config to the default state */
  536. resetConfig: undefined;
  537. /** Whether to show advanced settings in the config menu */
  538. advancedMode: boolean;
  539. }