From 299fe6336b2e70979e926336881288c4c819e389 Mon Sep 17 00:00:00 2001 From: wukko Date: Sun, 17 Jul 2022 17:21:51 +0600 Subject: [PATCH] got rid of dash in file names --- src/cobalt.js | 8 ++++---- src/modules/api.js | 2 +- src/modules/config.js | 2 +- src/modules/match.js | 2 +- src/modules/{page-renderer.js => pageRender.js} | 2 +- src/modules/services/vk.js | 2 +- src/modules/services/youtube.js | 2 +- src/modules/setup.js | 2 +- .../stream/{select-quality.js => selectQuality.js} | 0 src/modules/stream/stream.js | 2 +- src/modules/stream/types.js | 2 +- src/modules/sub/{console-text.js => consoleText.js} | 0 .../sub/{current-commit.js => currentCommit.js} | 0 src/modules/sub/i18n.js | 10 +++------- src/modules/sub/{load-json.js => loadJSON.js} | 0 src/modules/sub/{api-helper.js => utils.js} | 1 + 16 files changed, 17 insertions(+), 20 deletions(-) rename src/modules/{page-renderer.js => pageRender.js} (99%) rename src/modules/stream/{select-quality.js => selectQuality.js} (100%) rename src/modules/sub/{console-text.js => consoleText.js} (100%) rename src/modules/sub/{current-commit.js => currentCommit.js} (100%) rename src/modules/sub/{load-json.js => loadJSON.js} (100%) rename src/modules/sub/{api-helper.js => utils.js} (97%) diff --git a/src/cobalt.js b/src/cobalt.js index d6cccb86..ae10d381 100644 --- a/src/cobalt.js +++ b/src/cobalt.js @@ -5,13 +5,13 @@ import cors from "cors"; import * as fs from "fs"; import rateLimit from "express-rate-limit"; -import { shortCommit } from "./modules/sub/current-commit.js"; +import { shortCommit } from "./modules/sub/currentCommit.js"; import { appName, genericUserAgent, version, internetExplorerRedirect } from "./modules/config.js"; import { getJSON } from "./modules/api.js"; -import renderPage from "./modules/page-renderer.js"; -import { apiJSON } from "./modules/sub/api-helper.js"; +import renderPage from "./modules/pageRender.js"; +import { apiJSON } from "./modules/sub/utils.js"; import loc from "./modules/sub/i18n.js"; -import { Bright, Cyan } from "./modules/sub/console-text.js"; +import { Bright, Cyan } from "./modules/sub/consoleText.js"; import stream from "./modules/stream/stream.js"; const commitHash = shortCommit(); diff --git a/src/modules/api.js b/src/modules/api.js index 09337aea..7de3f61d 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -2,7 +2,7 @@ import UrlPattern from "url-pattern"; import { services as patterns } from "./config.js"; -import { cleanURL, apiJSON } from "./sub/api-helper.js"; +import { cleanURL, apiJSON } from "./sub/utils.js"; import { errorUnsupported } from "./sub/errors.js"; import loc from "./sub/i18n.js"; import match from "./match.js"; diff --git a/src/modules/config.js b/src/modules/config.js index 9bf126bd..cfc20c95 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -1,4 +1,4 @@ -import loadJson from "./sub/load-json.js"; +import loadJson from "./sub/loadJSON.js"; const config = loadJson("./src/config.json"); export const diff --git a/src/modules/match.js b/src/modules/match.js index 205b5ef5..2abcca31 100644 --- a/src/modules/match.js +++ b/src/modules/match.js @@ -1,4 +1,4 @@ -import { apiJSON } from "./sub/api-helper.js"; +import { apiJSON } from "./sub/utils.js"; import { errorUnsupported, genericError } from "./sub/errors.js"; import bilibili from "./services/bilibili.js"; diff --git a/src/modules/page-renderer.js b/src/modules/pageRender.js similarity index 99% rename from src/modules/page-renderer.js rename to src/modules/pageRender.js index 6af6a4a2..1ec3fc17 100644 --- a/src/modules/page-renderer.js +++ b/src/modules/pageRender.js @@ -1,5 +1,5 @@ import { services, appName, authorInfo, version, quality, repo, donations } from "./config.js"; -import { getCommitInfo } from "./sub/current-commit.js"; +import { getCommitInfo } from "./sub/currentCommit.js"; import loc from "./sub/i18n.js"; let s = services diff --git a/src/modules/services/vk.js b/src/modules/services/vk.js index 17a32887..9247d44b 100644 --- a/src/modules/services/vk.js +++ b/src/modules/services/vk.js @@ -2,7 +2,7 @@ import got from "got"; import { xml2json } from "xml-js"; import loc from "../sub/i18n.js"; import { genericUserAgent, maxVideoDuration, services } from "../config.js"; -import selectQuality from "../stream/select-quality.js"; +import selectQuality from "../stream/selectQuality.js"; export default async function(obj) { try { diff --git a/src/modules/services/youtube.js b/src/modules/services/youtube.js index 538615c5..b3fbce26 100644 --- a/src/modules/services/youtube.js +++ b/src/modules/services/youtube.js @@ -1,7 +1,7 @@ import ytdl from "ytdl-core"; import loc from "../sub/i18n.js"; import { maxVideoDuration, quality as mq } from "../config.js"; -import selectQuality from "../stream/select-quality.js"; +import selectQuality from "../stream/selectQuality.js"; export default async function (obj) { try { diff --git a/src/modules/setup.js b/src/modules/setup.js index d230c19e..207a9a43 100644 --- a/src/modules/setup.js +++ b/src/modules/setup.js @@ -1,7 +1,7 @@ import { randomBytes } from "crypto"; import { existsSync, unlinkSync, appendFileSync } from "fs"; import { createInterface } from "readline"; -import { Cyan, Bright, Green } from "./sub/console-text.js"; +import { Cyan, Bright, Green } from "./sub/consoleText.js"; import { execSync } from "child_process"; let envPath = './.env'; diff --git a/src/modules/stream/select-quality.js b/src/modules/stream/selectQuality.js similarity index 100% rename from src/modules/stream/select-quality.js rename to src/modules/stream/selectQuality.js diff --git a/src/modules/stream/stream.js b/src/modules/stream/stream.js index b24badb9..dc1ffd2c 100644 --- a/src/modules/stream/stream.js +++ b/src/modules/stream/stream.js @@ -1,4 +1,4 @@ -import { apiJSON } from "../sub/api-helper.js"; +import { apiJSON } from "../sub/utils.js"; import { verifyStream } from "./manage.js"; import { streamAudioOnly, streamDefault, streamLiveRender } from "./types.js"; diff --git a/src/modules/stream/types.js b/src/modules/stream/types.js index 9d0ee06a..42551125 100644 --- a/src/modules/stream/types.js +++ b/src/modules/stream/types.js @@ -2,7 +2,7 @@ import { spawn } from "child_process"; import ffmpeg from "ffmpeg-static"; import got from "got"; import { ffmpegArgs, genericUserAgent } from "../config.js"; -import { msToTime } from "../sub/api-helper.js"; +import { msToTime } from "../sub/utils.js"; import { internalError } from "../sub/errors.js"; import loc from "../sub/i18n.js"; diff --git a/src/modules/sub/console-text.js b/src/modules/sub/consoleText.js similarity index 100% rename from src/modules/sub/console-text.js rename to src/modules/sub/consoleText.js diff --git a/src/modules/sub/current-commit.js b/src/modules/sub/currentCommit.js similarity index 100% rename from src/modules/sub/current-commit.js rename to src/modules/sub/currentCommit.js diff --git a/src/modules/sub/i18n.js b/src/modules/sub/i18n.js index b131d684..c2a5ca18 100644 --- a/src/modules/sub/i18n.js +++ b/src/modules/sub/i18n.js @@ -1,17 +1,13 @@ import { supportedLanguages, appName, repo } from "../config.js"; -import loadJson from "./load-json.js"; +import loadJson from "./loadJSON.js"; export default function(lang, cat, string, replacement) { - if (!supportedLanguages.includes(lang)) { - lang = 'en' - } try { + if (!supportedLanguages.includes(lang)) lang = 'en'; let str = loadJson(`./src/i18n/${lang}/${cat}.json`); if (str && str[string]) { let s = str[string].replace(/\n/g, '
').replace(/{appName}/g, appName).replace(/{repo}/g, repo) - if (replacement) { - s = s.replace(/{s}/g, replacement) - } + if (replacement) s = s.replace(/{s}/g, replacement); return s + ' ' } else { return string diff --git a/src/modules/sub/load-json.js b/src/modules/sub/loadJSON.js similarity index 100% rename from src/modules/sub/load-json.js rename to src/modules/sub/loadJSON.js diff --git a/src/modules/sub/api-helper.js b/src/modules/sub/utils.js similarity index 97% rename from src/modules/sub/api-helper.js rename to src/modules/sub/utils.js index 86c1ab9e..ac7916c6 100644 --- a/src/modules/sub/api-helper.js +++ b/src/modules/sub/utils.js @@ -1,4 +1,5 @@ import { createStream } from "../stream/manage.js"; +import { execSync } from "child_process"; export function apiJSON(type, obj) { try {