types.ts 23 KB

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