diff --git a/src/cobalt.js b/src/cobalt.js index d6cccb8..ae10d38 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 09337ae..7de3f61 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 9bf126b..cfc20c9 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 205b5ef..2abcca3 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 6af6a4a..1ec3fc1 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 17a3288..9247d44 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 538615c..b3fbce2 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 d230c19..207a9a4 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 b24badb..dc1ffd2 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 9d0ee06..4255112 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 b131d68..c2a5ca1 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 86c1ab9..ac7916c 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 {