diff --git a/.gitmodules b/.gitmodules index 19ee9032..69f902d5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "maze-utils"] path = maze-utils url = https://github.com/ajayyy/maze-utils +[submodule "title-formatting"] + path = title-formatting + url = https://github.com/ajayyy/DeArrowFormatting.git diff --git a/jest.config.js b/jest.config.js index fa09797e..2fb35da3 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,8 +5,5 @@ module.exports = { "transform": { "^.+\\.ts$": "ts-jest" }, - "reporters": ["default", "github-actions"], - "globals": { - "LOAD_CLD": false - } -}; + "reporters": ["default", "github-actions"] +}; diff --git a/package-lock.json b/package-lock.json index dc9ec884..52b8e618 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ ], "license": "GPL-3.0", "dependencies": { - "cld3-asm": "^3.1.1", "react": "^18.2.0", "react-dom": "^18.2.0", "seedrandom": "^3.0.5" @@ -3499,17 +3498,6 @@ "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", "dev": true }, - "node_modules/cld3-asm": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/cld3-asm/-/cld3-asm-3.1.1.tgz", - "integrity": "sha512-MINJMrEyidUXG3PmunceuG7CnnTZNzTaYhjjIE93lz1Ku5gthfVhKThb1IH68OYTgk1BrgHa7BUrbrJvxJgA8Q==", - "dependencies": { - "emscripten-wasm-loader": "^3.0.3" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/cli-boxes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", @@ -4385,24 +4373,6 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, - "node_modules/emscripten-wasm-loader": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/emscripten-wasm-loader/-/emscripten-wasm-loader-3.0.3.tgz", - "integrity": "sha512-fyq2maBt5LOou27LEBlL5H6G04BxgSamXkvmMsAuIT6rd8ioH4BxNQhuyl6jVPeODh6U8Wk1BoFZxzHpg3o8wA==", - "dependencies": { - "getroot": "^1.0.0", - "nanoid": "^2.0.3", - "unixify": "^1.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/emscripten-wasm-loader/node_modules/nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -5604,23 +5574,6 @@ "assert-plus": "^1.0.0" } }, - "node_modules/getroot": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/getroot/-/getroot-1.0.0.tgz", - "integrity": "sha512-W9Q31kOv921dQuZBeAbK4R/dAPbC0WkhZD3alLcdVwjSkEtS1aX8twrzG3I5yo0sQ88M/d4JOqVbRiCuI/XPNA==", - "dependencies": { - "tslib": "^1.7.1" - }, - "engines": { - "node": ">=4.2.4", - "npm": ">=3.0.0" - } - }, - "node_modules/getroot/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -9383,11 +9336,6 @@ "node": ">=4" } }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==" - }, "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -10871,28 +10819,6 @@ "node": ">= 10.0.0" } }, - "node_modules/unixify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unixify/-/unixify-1.0.0.tgz", - "integrity": "sha512-6bc58dPYhCMHHuwxldQxO3RRNZ4eCogZ/st++0+fcC1nr0jiGUtAdBJ2qzmLQWSxbtz42pWt4QQMiZ9HvZf5cg==", - "dependencies": { - "normalize-path": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unixify/node_modules/normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", - "dependencies": { - "remove-trailing-separator": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/upath": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz", @@ -14473,14 +14399,6 @@ "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", "dev": true }, - "cld3-asm": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/cld3-asm/-/cld3-asm-3.1.1.tgz", - "integrity": "sha512-MINJMrEyidUXG3PmunceuG7CnnTZNzTaYhjjIE93lz1Ku5gthfVhKThb1IH68OYTgk1BrgHa7BUrbrJvxJgA8Q==", - "requires": { - "emscripten-wasm-loader": "^3.0.3" - } - }, "cli-boxes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", @@ -15133,23 +15051,6 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, - "emscripten-wasm-loader": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/emscripten-wasm-loader/-/emscripten-wasm-loader-3.0.3.tgz", - "integrity": "sha512-fyq2maBt5LOou27LEBlL5H6G04BxgSamXkvmMsAuIT6rd8ioH4BxNQhuyl6jVPeODh6U8Wk1BoFZxzHpg3o8wA==", - "requires": { - "getroot": "^1.0.0", - "nanoid": "^2.0.3", - "unixify": "^1.0.0" - }, - "dependencies": { - "nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - } - } - }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -16031,21 +15932,6 @@ "assert-plus": "^1.0.0" } }, - "getroot": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/getroot/-/getroot-1.0.0.tgz", - "integrity": "sha512-W9Q31kOv921dQuZBeAbK4R/dAPbC0WkhZD3alLcdVwjSkEtS1aX8twrzG3I5yo0sQ88M/d4JOqVbRiCuI/XPNA==", - "requires": { - "tslib": "^1.7.1" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -18828,11 +18714,6 @@ } } }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==" - }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -19932,24 +19813,6 @@ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "dev": true }, - "unixify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unixify/-/unixify-1.0.0.tgz", - "integrity": "sha512-6bc58dPYhCMHHuwxldQxO3RRNZ4eCogZ/st++0+fcC1nr0jiGUtAdBJ2qzmLQWSxbtz42pWt4QQMiZ9HvZf5cg==", - "requires": { - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, "upath": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz", diff --git a/package.json b/package.json index 0fced2ba..de24406d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "", "main": "background.js", "dependencies": { - "cld3-asm": "^3.1.1", "react": "^18.2.0", "react-dom": "^18.2.0", "seedrandom": "^3.0.5" diff --git a/src/config/channelOverrides.ts b/src/config/channelOverrides.ts index aae00d4e..04ebe244 100644 --- a/src/config/channelOverrides.ts +++ b/src/config/channelOverrides.ts @@ -1,6 +1,7 @@ import { VideoID } from "../../maze-utils/src/video"; import { ChannelInfo, getChannelID, getChannelIDSync } from "../thumbnails/thumbnailData"; -import Config, { ThumbnailFallbackAutogeneratedOption, ThumbnailFallbackOption, TitleFormatting } from "./config"; +import Config, { ThumbnailFallbackAutogeneratedOption, ThumbnailFallbackOption } from "./config"; +import { TitleFormatting } from "../../title-formatting/src"; export function shouldReplaceTitles(videoID: VideoID | null): Promise { return checkChannelOverrideOption(videoID, "replaceTitles"); @@ -78,7 +79,7 @@ function checkChannelOverrideOptionBase(option: string, channelInfo?: Channel ] for (const override of overrideOptions) { - if (override && Config.config!.customConfigurations[override] + if (override && Config.config!.customConfigurations[override] && Config.config!.customConfigurations[override][option] !== null && Config.config!.customConfigurations[override][option] !== undefined) { return Config.config!.customConfigurations[override][option]; @@ -110,4 +111,4 @@ function fastChannelOverrideOption(videoID: VideoID | null, option: string): } return mainValue; -} \ No newline at end of file +} diff --git a/src/config/config.ts b/src/config/config.ts index 43add701..ab252a8d 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -1,5 +1,6 @@ import { Keybind, ProtoConfig } from "../../maze-utils/src/config"; import { VideoID } from "../../maze-utils/src/video"; +import { TitleFormatting } from '../../title-formatting/src'; import { ThumbnailSubmission } from "../thumbnails/thumbnailData"; import { logError } from "../utils/logger"; import * as CompileConfig from "../../config.json"; @@ -22,15 +23,6 @@ export interface UnsubmittedSubmission { titles: UnsubmittedTitleSubmission[]; } -export enum TitleFormatting { - Disable = -1, - CapitalizeWords, - TitleCase, - SentenceCase, - LowerCase, - FirstLetterUppercase -} - export enum ThumbnailCacheOption { Disable, OnAllPagesExceptWatch, @@ -149,7 +141,7 @@ class ConfigClass extends ProtoConfig { // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars function migrateOldSyncFormats(config: SBConfig) { - + } const syncDefaults = { @@ -214,4 +206,4 @@ const localDefaults = { }; const Config = new ConfigClass(syncDefaults, localDefaults, migrateOldSyncFormats, true); -export default Config; \ No newline at end of file +export default Config; diff --git a/src/license/LicenseComponent.tsx b/src/license/LicenseComponent.tsx index f7a8c62d..daf67e4b 100644 --- a/src/license/LicenseComponent.tsx +++ b/src/license/LicenseComponent.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { getLicenseKey } from "./license"; import { FormattedText } from "../popup/FormattedTextComponent"; -import { TitleFormatting } from "../config/config"; +import { TitleFormatting } from "../../title-formatting/src"; interface LicenseComponentProps { titleFormatting?: TitleFormatting; @@ -46,7 +46,7 @@ export const LicenseComponent = ({ titleFormatting }: LicenseComponentProps) => } - + ); -}; \ No newline at end of file +}; diff --git a/src/options/ChannelOverridesComponent.tsx b/src/options/ChannelOverridesComponent.tsx index a2804f30..85992488 100644 --- a/src/options/ChannelOverridesComponent.tsx +++ b/src/options/ChannelOverridesComponent.tsx @@ -3,7 +3,7 @@ import { SelectOptionComponent } from "../popup/SelectOptionComponent"; import Config, { ConfigurationID, CustomConfiguration, ThumbnailFallbackOption } from "../config/config"; import { generateUserID } from "../../maze-utils/src/setup"; import { ToggleOptionComponent } from "../popup/ToggleOptionComponent"; -import { toFirstLetterUppercase, toLowerCaseTitle, toSentenceCase } from "../titles/titleFormatter"; +import { toFirstLetterUppercase, toLowerCaseTitle, toSentenceCase } from "../../title-formatting/src/formatters"; let forceUpdateConfigurationsTimeout: NodeJS.Timeout | null = null; let forceUpdateOverridesTimeout: NodeJS.Timeout | null = null; @@ -72,7 +72,7 @@ export const ChannelOverridesComponent = () => { }))} /> -
{ const newID = generateUserID(); @@ -103,7 +103,7 @@ export const ChannelOverridesComponent = () => { { selectedConfigurationID != null && <> - {
{chrome.i18n.getMessage("ChannelListInstructions")}
- -