diff --git a/README.md b/README.md index 5bdc8a7a..6b26b9c2 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Take English or Russian localization from [this directory](https://github.com/wu - [ ] Add an option to keep watermark on TikTok videos ### Other -- [ ] Remake video quality picking (do it more like I did in Vimeo module) +- [ ] Remake video quality picking - [ ] Add support for emoji in localization - [ ] Language picker in settings - [ ] Make cobalt fully PWA compatible (add a service worker) @@ -96,8 +96,6 @@ Setup script installs all needed `npm` dependencies, but you have to install `No ## Disclaimer This is my passion project, so update scheduele depends solely on my motivation. Don't expect any consistency in that. -## Third party stuff -[Fluent Emoji](https://github.com/microsoft/fluentui-emoji) by Microsoft. - ## License cobalt is under [AGPL-3.0](https://github.com/wukko/cobalt/blob/current/LICENSE). +[Fluent Emoji](https://github.com/microsoft/fluentui-emoji) by Microsoft is under [MIT](https://github.com/microsoft/fluentui-emoji/blob/main/LICENSE). diff --git a/src/cobalt.js b/src/cobalt.js index 1918e689..cb327708 100644 --- a/src/cobalt.js +++ b/src/cobalt.js @@ -50,8 +50,8 @@ if (fs.existsSync('./.env')) { try { decodeURIComponent(req.path) } - catch(e) { - return res.redirect(process.env.selfURL); + catch (e) { + return res.redirect(process.env.selfURL); } next(); }); diff --git a/src/front/cobalt.js b/src/front/cobalt.js index 1157d927..9424d82d 100644 --- a/src/front/cobalt.js +++ b/src/front/cobalt.js @@ -51,7 +51,7 @@ function changeDownloadButton(action, text) { break; } } -document.addEventListener("keydown", function (event) { +document.addEventListener("keydown", (event) => { if (event.key == "Tab") { eid("download-button").value = '>>' eid("download-button").style.padding = '0 1rem' @@ -257,7 +257,7 @@ async function download(url) { } }).catch((error) => internetError()); } -window.onload = function () { +window.onload = () => { loadSettings(); detectColorScheme(); changeDownloadButton(0, '>>'); @@ -274,6 +274,6 @@ window.onload = function () { eid("url-input-area").addEventListener("keyup", (event) => { if (event.key === 'Enter') eid("download-button").click(); }) -document.onkeydown = function(event) { +document.onkeydown = (event) => { if (event.key === 'Escape') hideAllPopups(); }; \ No newline at end of file diff --git a/src/localization/languages/ru.json b/src/localization/languages/ru.json index 7ee8310f..19a6f161 100644 --- a/src/localization/languages/ru.json +++ b/src/localization/languages/ru.json @@ -59,7 +59,7 @@ "SettingsEnableDownloadPopup": "спрашивать, как сохранять", "AccessibilityEnableDownloadPopup": "спрашивать, что делать с загрузками", "SettingsFormatDescription": "выбирай webm, если хочешь максимальное качество. webm обычно лучше по качеству, но устройства на ios не могут проигрывать их без сторонних приложений.", - "SettingsQualityDescription": "если выбранное разрешение недоступно, то выбирается ближайшее к нему. если ты хочешь твитнуть загруженное видео, то выбирай комбинацию из mp4 и 720p. такие видео твиттер обычно воспринимает намного лучше.", + "SettingsQualityDescription": "если выбранное разрешение недоступно, то выбирается ближайшее к нему. если ты хочешь твитнуть загруженное видео, то выбирай комбинацию из mp4 и 720p. твиттер такие видео обычно воспринимает намного лучше.", "DonateSubtitle": "помоги мне платить за хостинг", "DonateDescription": "я не люблю крипто в его текущем состоянии, но у меня нет другого надёжного способа оплаты хостинга.", "LinkGitHubIssues": ">> сообщай о проблемах и смотри исходный код на github", diff --git a/src/modules/api.js b/src/modules/api.js index 9e956aad..0d53760d 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -29,10 +29,10 @@ export async function getJSON(originalURL, ip, lang, format, quality, audioForma } if (patternMatch) { return await match(host, patternMatch, url, ip, lang, format, quality, audioFormat, isAudioOnly); - } return apiJSON(0, { t: errorUnsupported(lang) } ) - } return apiJSON(0, { t: errorUnsupported(lang) } ) + } return apiJSON(0, { t: errorUnsupported(lang) }) + } return apiJSON(0, { t: errorUnsupported(lang) }) } else { - return apiJSON(0, { t: errorUnsupported(lang) } ) + return apiJSON(0, { t: errorUnsupported(lang) }) } } catch (e) { return apiJSON(0, { t: loc(lang, 'ErrorSomethingWentWrong') }); diff --git a/src/modules/build.js b/src/modules/build.js index a1f9a9cd..fdeebdab 100644 --- a/src/modules/build.js +++ b/src/modules/build.js @@ -6,7 +6,7 @@ export async function buildFront() { entryPoints: ['src/front/cobalt.js', 'src/front/cobalt.css'], outdir: `min/`, minify: true, - loader: {".js": "js", ".css": "css"} + loader: { ".js": "js", ".css": "css" } }) } catch (e) { return; diff --git a/src/modules/config.js b/src/modules/config.js index a0a4521f..a8bb8424 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -3,17 +3,17 @@ const config = loadJson("./src/config.json"); const packageJson = loadJson("./package.json"); export const -services = loadJson("./src/modules/servicesConfig.json"), -appName = packageJson.name, -version = packageJson.version, -streamLifespan = config.streamLifespan, -maxVideoDuration = config.maxVideoDuration, -genericUserAgent = config.genericUserAgent, -repo = packageJson["bugs"]["url"].replace('/issues', ''), -authorInfo = config.authorInfo, -supportedLanguages = config.supportedLanguages, -quality = config.quality, -internetExplorerRedirect = config.internetExplorerRedirect, -donations = config.donations, -ffmpegArgs = config.ffmpegArgs, -supportedAudio = config.supportedAudio + services = loadJson("./src/modules/servicesConfig.json"), + appName = packageJson.name, + version = packageJson.version, + streamLifespan = config.streamLifespan, + maxVideoDuration = config.maxVideoDuration, + genericUserAgent = config.genericUserAgent, + repo = packageJson["bugs"]["url"].replace('/issues', ''), + authorInfo = config.authorInfo, + supportedLanguages = config.supportedLanguages, + quality = config.quality, + internetExplorerRedirect = config.internetExplorerRedirect, + donations = config.donations, + ffmpegArgs = config.ffmpegArgs, + supportedAudio = config.supportedAudio diff --git a/src/modules/emoji.js b/src/modules/emoji.js index 705913a3..98bce6e0 100644 --- a/src/modules/emoji.js +++ b/src/modules/emoji.js @@ -17,7 +17,7 @@ let sizing = { } export default function(emoji, size, disablePadding) { if (!size) size = 22; - let padding = size != 22 ? `margin-right:${sizing[size] ? sizing[size] : "0.4"}rem;`: ``; + let padding = size != 22 ? `margin-right:${sizing[size] ? sizing[size] : "0.4"}rem;` : ``; if (disablePadding) padding = 'margin-right:0!important;'; if (!names[emoji]) emoji = "❓"; return `` diff --git a/src/modules/match.js b/src/modules/match.js index 00f6c20e..5d03d63d 100644 --- a/src/modules/match.js +++ b/src/modules/match.js @@ -42,7 +42,7 @@ export default async function (host, patternMatch, url, ip, lang, format, qualit break; case "youtube": let fetchInfo = { - id: patternMatch["id"].slice(0,11), + id: patternMatch["id"].slice(0, 11), lang: lang, quality: quality, format: "webm" }; @@ -87,7 +87,7 @@ export default async function (host, patternMatch, url, ip, lang, format, qualit break; case "vimeo": r = await vimeo({ - id: patternMatch["id"], quality: quality, + id: patternMatch["id"].slice(0, 11), quality: quality, lang: lang }); break; diff --git a/src/modules/pageRender/elements.js b/src/modules/pageRender/elements.js index e0901ad7..a9c60878 100644 --- a/src/modules/pageRender/elements.js +++ b/src/modules/pageRender/elements.js @@ -40,9 +40,9 @@ export function popup(obj) { } } return ` - ${!obj.embed ? `