types.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  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. export type ColorLightness = "darker" | "normal" | "lighter";
  89. //#region global
  90. /** All properties of the `unsafeWindow.BYTM` object (also called "plugin interface") */
  91. export type BytmObject =
  92. {
  93. [key: string]: unknown;
  94. locale: TrLocale;
  95. logLevel: LogLevel;
  96. }
  97. // information from the userscript header
  98. & typeof scriptInfo
  99. // certain variables from `src/constants.ts`
  100. & Pick<typeof consts, "mode" | "branch" | "host" | "buildNumber" | "compressionFormat">
  101. // global functions exposed through the interface in `src/interface.ts`
  102. & InterfaceFunctions
  103. // others
  104. & {
  105. NanoEmitter: typeof NanoEmitter;
  106. BytmDialog: typeof BytmDialog;
  107. ExImDialog: typeof ExImDialog;
  108. // the entire UserUtils library
  109. UserUtils: typeof import("@sv443-network/userutils");
  110. // the entire compare-versions library
  111. compareVersions: typeof import("compare-versions");
  112. };
  113. declare global {
  114. interface Window {
  115. // to see the expanded type, install the VS Code extension "MylesMurphy.prettify-ts" and hover over the property below
  116. // alternatively navigate with ctrl+click to find the types
  117. BYTM: BytmObject;
  118. }
  119. }
  120. //#region plugins
  121. /**
  122. * Intents (permissions) BYTM has to grant your plugin for it to be able to access certain features.
  123. * TODO: this feature is unfinished, but you should still specify the intents your plugin needs.
  124. * Never request more permissions than you need, as this is a bad practice and can lead to your plugin being rejected.
  125. */
  126. export enum PluginIntent {
  127. /** Plugin has access to hidden config values */
  128. HiddenConfigValues = 1,
  129. /** Plugin can write to the feature configuration */
  130. WriteFeatureConfig = 2,
  131. /** Plugin can write to the lyrics cache */
  132. WriteLyricsCache = 4,
  133. /** Plugin can add new translations and overwrite existing ones */
  134. WriteTranslations = 8,
  135. /** Plugin can create modal dialogs */
  136. CreateModalDialogs = 16,
  137. /** Plugin can read and write auto-like data */
  138. ReadAndWriteAutoLikeData = 32,
  139. }
  140. /** Result of a plugin registration */
  141. export type PluginRegisterResult = {
  142. /** Public info about the registered plugin */
  143. info: PluginInfo;
  144. /** NanoEmitter instance for plugin events - see {@linkcode PluginEventMap} for a list of events */
  145. events: NanoEmitter<PluginEventMap>;
  146. /** Authentication token for the plugin to use in certain restricted function calls */
  147. token: string;
  148. }
  149. /** Minimal object that describes a plugin - this is all info the other installed plugins can see */
  150. export type PluginInfo = {
  151. /** Name of the plugin */
  152. name: string;
  153. /**
  154. * Adding the namespace and the name property makes the unique identifier for a plugin.
  155. * If one exists with the same name and namespace as this plugin, it may be overwritten at registration.
  156. * I recommend to set this value to a URL pointing to your homepage, or the author's username.
  157. */
  158. namespace: string;
  159. /** Version of the plugin as a semver-compliant string */
  160. version: string;
  161. };
  162. /** Minimum part of the PluginDef object needed to make up the resolvable plugin identifier */
  163. export type PluginDefResolvable = PluginDef | { plugin: Pick<PluginDef["plugin"], "name" | "namespace"> };
  164. /** An object that describes a BYTM plugin */
  165. export type PluginDef = {
  166. plugin: PluginInfo & {
  167. /**
  168. * Descriptions of at least en_US and optionally any other locale supported by BYTM.
  169. * When an untranslated locale is set, the description will default to the value of en_US
  170. */
  171. description: Partial<Record<keyof typeof locales, string>> & {
  172. en_US: string;
  173. };
  174. /** URL to the plugin's icon - recommended size: 48x48 to 128x128 */
  175. iconUrl?: string;
  176. license?: {
  177. /** License name */
  178. name: string;
  179. /** URL to the license text */
  180. url: string;
  181. };
  182. /** Homepage URLs for the plugin */
  183. homepage: {
  184. /** URL to the plugin's source code (i.e. Git repo) - closed source plugins are not officially accepted at the moment. */
  185. source: string;
  186. /** Any other homepage URL */
  187. other?: string;
  188. /** URL to the plugin's bug tracker page, like GitHub issues */
  189. bug?: string;
  190. /** URL to the plugin's GreasyFork page */
  191. greasyfork?: string;
  192. /** URL to the plugin's OpenUserJS page */
  193. openuserjs?: string;
  194. };
  195. };
  196. /** Intents (permissions) BYTM has to grant the plugin for it to work */
  197. intents?: number;
  198. /** Info about the plugin contributors */
  199. contributors?: Array<{
  200. /** Name of this contributor */
  201. name: string;
  202. /** (optional) Email address of this contributor */
  203. email?: string;
  204. /** (optional) URL to this plugin contributor's homepage / GitHub profile */
  205. url?: string;
  206. }>;
  207. };
  208. /** 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 */
  209. export type PluginEventMap =
  210. // These are emitted on each plugin individually, with individual data:
  211. & {
  212. /** Emitted when the plugin is fully registered on BYTM's side and can use authenticated API calls */
  213. pluginRegistered: (info: PluginInfo) => void;
  214. }
  215. // These are emitted on every plugin simultaneously, with the same or similar data:
  216. & SiteEventsMap
  217. & InterfaceEventsMap;
  218. /** A plugin in either the queue or registered map */
  219. export type PluginItem =
  220. & {
  221. def: PluginDef;
  222. }
  223. & Pick<PluginRegisterResult, "events">;
  224. /** All functions exposed by the interface on the global `BYTM` object */
  225. export type InterfaceFunctions = {
  226. // meta:
  227. /** Registers a plugin with BYTM. Needed to receive the token for making authenticated function calls. */
  228. registerPlugin: typeof registerPlugin;
  229. /** 🔒 Checks if the plugin with the given name and namespace is registered and returns an info object about it */
  230. getPluginInfo: typeof getPluginInfo;
  231. // bytm-specific:
  232. /** Returns the current domain as a constant string representation */
  233. getDomain: typeof getDomain;
  234. /**
  235. * Returns the URL of a resource as defined in `assets/resources.json`
  236. * There are also some resources like translation files that get added by `tools/post-build.ts`
  237. *
  238. * The returned URL is a `blob:` URL served up by the userscript extension
  239. * This makes the resource fast to fetch and also prevents CORS issues
  240. */
  241. getResourceUrl: typeof getResourceUrl;
  242. /** Returns the unique session ID for the current tab */
  243. getSessionId: typeof getSessionId;
  244. // dom:
  245. /** Adds a listener to one of the already present SelectorObserver instances */
  246. addSelectorListener: typeof addSelectorListener;
  247. /** Registers accessible interaction listeners (click, enter, space) on the provided element */
  248. onInteraction: typeof onInteraction;
  249. /**
  250. * Returns the current video time (on both YT and YTM)
  251. * In case it can't be determined on YT, mouse movement is simulated to bring up the video time
  252. * 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
  253. */
  254. getVideoTime: typeof getVideoTime;
  255. /** Returns the thumbnail URL for the provided video ID and thumbnail quality */
  256. getThumbnailUrl: typeof getThumbnailUrl;
  257. /** Returns the thumbnail URL with the best quality for the provided video ID */
  258. getBestThumbnailUrl: typeof getBestThumbnailUrl;
  259. /** Resolves the returned promise when the video element is queryable in the DOM */
  260. waitVideoElementReady: typeof waitVideoElementReady;
  261. // translations:
  262. /** 🔒 Sets the locale for all new translations */
  263. setLocale: typeof setLocaleInterface;
  264. /** Returns the current locale */
  265. getLocale: typeof getLocale;
  266. /** Returns whether a translation key exists for the set locale */
  267. hasKey: typeof hasKey;
  268. /** Returns whether a translation key exists for the provided locale */
  269. hasKeyFor: typeof hasKeyFor;
  270. /** Returns the translation for the provided translation key and set locale (check the files in the folder `assets/translations`) */
  271. t: typeof t;
  272. /** Returns the translation for the provided translation key, including pluralization identifier and set locale (check the files in the folder `assets/translations`) */
  273. tp: typeof tp;
  274. // feature config:
  275. /** 🔒 Returns the current feature configuration */
  276. getFeatures: typeof getFeaturesInterface;
  277. /** 🔒 Overwrites the feature configuration with the provided one */
  278. saveFeatures: typeof saveFeaturesInterface;
  279. // lyrics:
  280. /** Sanitizes the provided artist string - this needs to be done before calling other lyrics related functions! */
  281. sanitizeArtists: typeof sanitizeArtists;
  282. /** Sanitizes the provided song title string - this needs to be done before calling other lyrics related functions! */
  283. sanitizeSong: typeof sanitizeSong;
  284. /** 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. */
  285. fetchLyricsUrlTop: typeof fetchLyricsUrlTop;
  286. /** Returns the lyrics cache entry for the provided song and artist, if there is one. Never sends a request on its own. */
  287. getLyricsCacheEntry: typeof getLyricsCacheEntry;
  288. // auto-like:
  289. /** 🔒 Returns the current auto-like data */
  290. getAutoLikeData: typeof getAutoLikeDataInterface;
  291. /** 🔒 Overwrites the auto-like data */
  292. saveAutoLikeData: typeof saveAutoLikeDataInterface;
  293. /** Returns the votes for the provided video ID from the ReturnYoutubeDislike API */
  294. fetchVideoVotes: typeof fetchVideoVotes;
  295. // components:
  296. /** Creates a new hotkey input component */
  297. createHotkeyInput: typeof createHotkeyInput;
  298. /** Creates a new toggle input component */
  299. createToggleInput: typeof createToggleInput;
  300. /** Creates a new circular button component */
  301. createCircularBtn: typeof createCircularBtn;
  302. /** Creates a new ripple effect on the provided element or creates an empty element that has the effect */
  303. createRipple: typeof createRipple;
  304. /** Shows a toast with the provided text */
  305. showToast: typeof showToast;
  306. /** Shows a toast with the provided text and an icon */
  307. showIconToast: typeof showIconToast;
  308. };
  309. //#region feature defs
  310. export type FeatureKey = keyof FeatureConfig;
  311. export type FeatureCategory =
  312. | "layout"
  313. | "volume"
  314. | "songLists"
  315. | "behavior"
  316. | "input"
  317. | "lyrics"
  318. | "integrations"
  319. | "general";
  320. type SelectOption = {
  321. value: string | number;
  322. label: string;
  323. };
  324. type FeatureTypeProps = ({
  325. type: "toggle";
  326. default: boolean;
  327. } & FeatureFuncProps)
  328. | ({
  329. type: "number";
  330. default: number;
  331. min: number;
  332. max?: number;
  333. step?: number;
  334. unit?: string | ((val: number) => string);
  335. } & FeatureFuncProps)
  336. | ({
  337. type: "select";
  338. default: string | number;
  339. options: SelectOption[] | (() => SelectOption[]);
  340. } & FeatureFuncProps)
  341. | ({
  342. type: "slider";
  343. default: number;
  344. min: number;
  345. max: number;
  346. step?: number;
  347. unit?: string | ((val: number) => string);
  348. } & FeatureFuncProps)
  349. | ({
  350. type: "hotkey";
  351. default: HotkeyObj;
  352. } & FeatureFuncProps)
  353. | ({
  354. type: "text";
  355. default: string;
  356. normalize?: (val: string) => string;
  357. } & FeatureFuncProps)
  358. | {
  359. type: "button";
  360. default?: undefined;
  361. click: () => Promise<void | unknown> | void | unknown;
  362. }
  363. type FeatureFuncProps = (
  364. {
  365. /** Whether the feature requires a page reload to take effect */
  366. reloadRequired: false;
  367. /** Called to instantiate the feature on the page */
  368. enable: (featCfg: FeatureConfig) => void,
  369. }
  370. | {
  371. /** Whether the feature requires a page reload to take effect */
  372. reloadRequired?: true;
  373. /** Called to instantiate the feature on the page */
  374. enable?: undefined;
  375. }
  376. ) & (
  377. {
  378. /** Called to remove all traces of the feature from the page and memory (includes event listeners) */
  379. disable?: (feats: FeatureConfig) => void,
  380. }
  381. | {
  382. /** Called to update the feature's behavior when the config changes */
  383. change?: (key: FeatureKey, initialVal: number | boolean | Record<string, unknown>, newVal: number | boolean | Record<string, unknown>) => void,
  384. }
  385. );
  386. /**
  387. * The feature info object that contains all properties necessary to construct the config menu and the feature config object.
  388. * All values are loosely typed so try to only use this with the `satisfies` keyword.
  389. * Use `typeof featInfo` (from `src/features/index.ts`) instead for full type safety.
  390. */
  391. export type FeatureInfo = Record<
  392. keyof FeatureConfig,
  393. {
  394. category: FeatureCategory;
  395. /**
  396. * HTML string that will be the help text for this feature
  397. * Specifying a function is useful for pluralizing or inserting values into the translation at runtime
  398. */
  399. helpText?: string | (() => string);
  400. /** Whether the value should be hidden in the config menu and from plugins */
  401. valueHidden?: boolean;
  402. /** Transformation function called before the value is rendered in the config menu */
  403. renderValue?: (value: string) => string | Promise<string>;
  404. /** HTML string that is appended to the end of a feature's text description */
  405. textAdornment?: () => (Promise<string | undefined> | string | undefined);
  406. /** Whether to only show this feature when advanced mode is activated (default false) */
  407. advanced?: boolean;
  408. }
  409. & FeatureTypeProps
  410. >;
  411. //#region feature config
  412. /** Feature configuration */
  413. export interface FeatureConfig {
  414. //#region layout
  415. /** Show a BetterYTM watermark under the YTM logo */
  416. watermarkEnabled: boolean;
  417. /** Remove the "si" tracking parameter from links in the share menu? */
  418. removeShareTrackingParam: boolean;
  419. /** On which sites to remove the "si" tracking parameter from links in the share menu */
  420. removeShareTrackingParamSites: SiteSelection;
  421. /** Enable skipping to a specific time in the video by pressing a number key (0-9) */
  422. numKeysSkipToTime: boolean;
  423. /** Fix spacing issues in the layout */
  424. fixSpacing: boolean;
  425. /** Where to show a thumbnail overlay over the video element and whether to show it at all */
  426. thumbnailOverlayBehavior: "never" | "videosOnly" | "songsOnly" | "always";
  427. /** Whether to show a button to toggle the thumbnail overlay in the media controls */
  428. thumbnailOverlayToggleBtnShown: boolean;
  429. /** Whether to show an indicator on the thumbnail overlay when it is active */
  430. thumbnailOverlayShowIndicator: boolean;
  431. /** The opacity of the thumbnail overlay indicator element */
  432. thumbnailOverlayIndicatorOpacity: number;
  433. /** How to fit the thumbnail overlay image */
  434. thumbnailOverlayImageFit: "cover" | "contain" | "fill";
  435. /** Hide the cursor when it's idling on the video element for a while */
  436. hideCursorOnIdle: boolean;
  437. /** Delay in seconds after which the cursor should be hidden */
  438. hideCursorOnIdleDelay: number;
  439. /** Whether to fix various issues in the layout when HDR is supported and active */
  440. fixHdrIssues: boolean;
  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 integrations
  526. /** On which sites to disable Dark Reader - does nothing if the extension is not installed */
  527. disableDarkReaderSites: SiteSelectionOrNone;
  528. /** Whether to fix the styling of some elements from the SponsorBlock extension - does nothing if the extension is not installed */
  529. sponsorBlockIntegration: boolean;
  530. /** Whether to adjust styles so they look better when using the ThemeSong extension */
  531. themeSongIntegration: boolean;
  532. /** Lightness of the color used when ThemeSong is enabled */
  533. themeSongLightness: ColorLightness;
  534. //#region misc
  535. /** The locale to use for translations */
  536. locale: TrLocale;
  537. /** Whether to default to US-English if the translation for the set locale is missing */
  538. localeFallback: boolean;
  539. /** Whether to check for updates to the script */
  540. versionCheck: boolean;
  541. /** Button to check for updates */
  542. checkVersionNow: undefined;
  543. /** The console log level - 0 = Debug, 1 = Info */
  544. logLevel: LogLevel;
  545. /** Amount of seconds until the feature initialization times out */
  546. initTimeout: number;
  547. /** Amount of seconds to show BYTM's toasts for */
  548. toastDuration: number;
  549. /** Whether to show a toast on generic errors */
  550. showToastOnGenericError: boolean;
  551. /** Button that resets the config to the default state */
  552. resetConfig: undefined;
  553. /** Whether to show advanced settings in the config menu */
  554. advancedMode: boolean;
  555. }