diff --git a/package.json b/package.json index c4b03eb4..499dc0ae 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cobalt", "description": "save what you love", - "version": "7.7.5", + "version": "7.8", "author": "wukko", "exports": "./src/cobalt.js", "type": "module", @@ -36,6 +36,7 @@ "hls-parser": "^0.10.7", "nanoid": "^4.0.2", "node-cache": "^5.1.2", + "psl": "1.9.0", "set-cookie-parser": "2.6.0", "undici": "^5.19.1", "url-pattern": "1.0.3", diff --git a/src/config.json b/src/config.json index cd170594..da1ec4c6 100644 --- a/src/config.json +++ b/src/config.json @@ -8,37 +8,37 @@ "contact": "https://wukko.me/contacts", "support": { "default": { + "email": { + "emoji": "📧", + "url": "mailto:support@cobalt.tools", + "name": "support@cobalt.tools" + }, "twitter": { "emoji": "🐦", "url": "https://twitter.com/justusecobalt", - "handle": "@justusecobalt" + "name": "@justusecobalt" }, "discord": { "emoji": "👾", "url": "https://discord.gg/pQPt8HBUPu", - "handle": "cobalt community server" + "name": "cobalt discord server" }, "mastodon": { "emoji": "🐘", "url": "https://wetdry.world/@cobalt", - "handle": "@cobalt@wetdry.world" - }, - "support email": { - "emoji": "📧", - "url": "mailto:support@cobalt.tools", - "handle": "support@cobalt.tools" + "name": "@cobalt@wetdry.world" } }, "ru": { - "канал в telegram": { + "telegram": { "emoji": "📬", "url": "https://t.me/justusecobalt_ru", - "handle": "@justusecobalt_ru" + "name": "канал в telegram" }, - "поддержка по почте": { + "email": { "emoji": "📧", "url": "mailto:support@cobalt.tools", - "handle": "support@cobalt.tools" + "name": "support@cobalt.tools" } } } @@ -58,7 +58,9 @@ } }, "links": { - "saveToGalleryShortcut": "https://www.icloud.com/shortcuts/b401917928fd407daf1db0fd07eb7e78" + "saveToGalleryShortcut": "https://www.icloud.com/shortcuts/b401917928fd407daf1db0fd07eb7e78", + "statusPage": "https://status.cobalt.tools/", + "troubleshootingGuide": "https://github.com/wukko/cobalt/blob/current/docs/troubleshooting.md" }, "celebrations": { "01-01": "🎄", diff --git a/src/core/api.js b/src/core/api.js index 4e78fbb5..71ce8d3e 100644 --- a/src/core/api.js +++ b/src/core/api.js @@ -97,7 +97,7 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) { let chck = checkJSONPost(request); if (!chck) throw new Error(); - j = await getJSON(chck["url"], lang, chck); + j = await getJSON(chck.url, lang, chck); } else { j = apiJSON(0, { t: !contentCon ? "invalid content type header" : loc(lang, 'ErrorNoLink') diff --git a/src/front/cobalt.css b/src/front/cobalt.css index ce364dc3..200f288f 100644 --- a/src/front/cobalt.css +++ b/src/front/cobalt.css @@ -254,16 +254,17 @@ button:active, } #cobalt-main-box { position: fixed; - width: 60%; + width: 40rem; height: auto; display: flex; - flex-direction: row; + flex-direction: column; + align-content: center; + align-items: center; } #logo { text-align: left; font-size: 1rem; white-space: nowrap; - width: 7rem; height: 2.5rem; align-items: center; display: flex; @@ -295,7 +296,7 @@ button:active, } #url-input-area { background: none; - padding: 0 1rem; + padding-left: calc(20px + 1.4rem); width: 100%; color: var(--accent); border: 0; @@ -316,6 +317,15 @@ button:active, outline: none; border-bottom: var(--border-10); } +#link-icon { + display: flex; + position: absolute; + width: 20px; + padding-top: 0.2rem; + left: 0.7rem; + flex-wrap: nowrap; + color: var(--accent-subtext); +} #download-button { height: 2.5rem; color: var(--accent); @@ -331,6 +341,10 @@ button:active, color: var(--accent-subtext); cursor: not-allowed; } +#cobalt-main-box .switch, +#footer .switch { + box-shadow: 0 0 0 0.1rem var(--accent-highlight) inset; +} #footer { bottom: 0; width: 100%; @@ -458,9 +472,6 @@ button:active, .popup.scrollable { height: 95%; } -.scrollable .bottom-link { - padding-bottom: 2rem; -} .changelog-subtitle { font-size: 1.3rem; padding-bottom: var(--gap-no-icon); @@ -797,6 +808,7 @@ button:active, .collapse-body { display: none; padding: var(--padding-1); + padding-bottom: 1rem; user-select: text; -webkit-user-select: text; } @@ -947,7 +959,7 @@ button:active, .text-to-copy, .text-to-copy.text-backdrop, #filename-preview { - border-radius: 5px / 6px; + border-radius: 6px / 7px; } [type=checkbox] { border-radius: 3px / 4px; @@ -968,28 +980,28 @@ button:active, border-top: var(--accent-highlight) solid 0.1rem; bottom: -1px; } -.switches .first { - border-top-left-radius: 5px 6px; - border-bottom-left-radius: 5px 6px; +.switches :first-child { + border-top-left-radius: 6px 7px; + border-bottom-left-radius: 6px 7px; } -.switches .last { - border-top-right-radius: 5px 6px; - border-bottom-right-radius: 5px 6px; +.switches :last-child { + border-top-right-radius: 6px 7px; + border-bottom-right-radius: 6px 7px; } .text-backdrop { border-radius: 3px / 4px; } -.collapse-list.first, -.collapse-list.first .collapse-header { - border-top-left-radius: 6px 7px; - border-top-right-radius: 6px 7px; +.collapse-list:first-child, +.collapse-list:first-child .collapse-header { + border-top-left-radius: 7px 8px; + border-top-right-radius: 7px 8px; } -.collapse-list.last, -.collapse-list.last .collapse-header { - border-bottom-left-radius: 6px 7px; - border-bottom-right-radius: 6px 7px; +.collapse-list:last-child, +.collapse-list:last-child .collapse-header { + border-bottom-left-radius: 7px 8px; + border-bottom-right-radius: 7px 8px; } -.collapse-list.last.expanded .collapse-header { +.collapse-list:last-child.expanded .collapse-header { border-radius: 0; } /* prevent resizing fliecker on ios if web app is installed as standalone */ @@ -1008,9 +1020,6 @@ button:active, } } @media screen and (max-width: 1440px) { - #cobalt-main-box { - width: 65%; - } .popup.small { width: 30% } @@ -1024,9 +1033,6 @@ button:active, } } @media screen and (max-width: 1200px) { - #cobalt-main-box { - width: 70%; - } .popup.small { width: 35% } @@ -1035,9 +1041,6 @@ button:active, } } @media screen and (max-width: 1025px) { - #cobalt-main-box { - width: 75%; - } .popup.small { width: 40% } @@ -1062,14 +1065,14 @@ button:active, width: calc(100% - 1.3rem); } } -@media screen and (max-width: 720px) { +@media screen and (max-width: 660px) { #cobalt-main-box { width: calc(100% - (0.7rem * 2)); } #cobalt-main-box #bottom { - flex-direction: column-reverse; + flex-direction: row-reverse; } - #cobalt-main-box #bottom button { + #cobalt-main-box #bottom #audioMode button, #audioMode { width: 100%; } #footer { @@ -1166,9 +1169,6 @@ button:active, #popup-tabs { padding-bottom: calc(env(safe-area-inset-bottom)/2 + 1.5rem); } - .bottom-link { - padding-bottom: 2rem; - } .popup-content-inner, .tab-content-settings, .popup-tabs-child, diff --git a/src/front/cobalt.js b/src/front/cobalt.js index 183716cb..b3d3b7a8 100644 --- a/src/front/cobalt.js +++ b/src/front/cobalt.js @@ -1,4 +1,4 @@ -const version = 39; +const version = 40; const ua = navigator.userAgent.toLowerCase(); const isIOS = ua.match("iphone os"); @@ -358,7 +358,7 @@ async function download(url) { eid("url-clear").style.display = "none"; eid("url-input-area").disabled = true; let req = { - url: encodeURIComponent(url.split("&")[0].split('%')[0]), + url, aFormat: sGet("aFormat").slice(0, 4), filenamePattern: sGet("filenamePattern"), dubLang: false diff --git a/src/front/emoji/bubbles.svg b/src/front/emoji/bubbles.svg new file mode 100644 index 00000000..e5bccc36 --- /dev/null +++ b/src/front/emoji/bubbles.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/front/emoji/loudspeaker.svg b/src/front/emoji/loudspeaker.svg new file mode 100644 index 00000000..6acd5873 --- /dev/null +++ b/src/front/emoji/loudspeaker.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/front/emoji/wrench.svg b/src/front/emoji/wrench.svg new file mode 100644 index 00000000..b186d3b3 --- /dev/null +++ b/src/front/emoji/wrench.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/front/updateBanners/catroomba.webp b/src/front/updateBanners/catroomba.webp new file mode 100644 index 00000000..a94eeeb0 Binary files /dev/null and b/src/front/updateBanners/catroomba.webp differ diff --git a/src/localization/languages/en.json b/src/localization/languages/en.json index ddb5cb76..0435d218 100644 --- a/src/localization/languages/en.json +++ b/src/localization/languages/en.json @@ -1,7 +1,7 @@ { "name": "english", "substrings": { - "ContactLink": "create an issue on github" + "ContactLink": "check the status page or create an issue on github." }, "strings": { "AppTitleCobalt": "cobalt", @@ -45,7 +45,6 @@ "SettingsEnableDownloadPopup": "ask how to save", "AccessibilityEnableDownloadPopup": "ask what to do with downloads", "SettingsQualityDescription": "if selected quality isn't available, closest one is used instead.", - "LinkGitHubChanges": ">> see previous commits and contribute on github", "NoScriptMessage": "cobalt uses javascript for api requests and interactive interface. you have to allow javascript to use this site. there are no pesty scripts, pinky promise.", "DownloadPopupDescriptionIOS": "easiest way to save videos on ios:\n1. add this siri shortcut.\n2. press \"share\" above and select \"save to photos\" in appeared share sheet.\nif asked, review the permission request, and press \"always allow\".\n\nalternative method:\npress and hold the download button, hide the video preview, and select \"download linked file\" to download.\nthen, open safari downloads, select the file you downloaded, open share menu, and finally press \"save video\".", "DownloadPopupDescription": "download button opens a new tab with requested file. you can disable this popup in settings.", @@ -77,12 +76,12 @@ "ImagePickerExplanationPhone": "press and hold an image to save it.", "ErrorNoUrlReturned": "i didn't get a download link from the server. this should never happen. try again, but if it still doesn't work, {ContactLink}.", "ErrorUnknownStatus": "i received a response i can't process. this should never happen. try again, but if it still doesn't work, {ContactLink}.", - "PasteFromClipboard": "paste and download", + "PasteFromClipboard": "paste", "ChangelogOlder": "previous versions", "ChangelogPressToExpand": "expand", "Miscellaneous": "miscellaneous", - "ModeToggleAuto": "auto mode", - "ModeToggleAudio": "audio mode", + "ModeToggleAuto": "auto", + "ModeToggleAudio": "audio", "SettingsDisableNotifications": "hide notifications", "MediaPickerTitle": "pick what to save", "MediaPickerExplanationPC": "click or right click to download what you want.", @@ -127,7 +126,7 @@ "FeatureErrorGeneric": "your browser doesn't allow or support this feature. check if there are any updates available and try again!", "ClipboardErrorFirefox": "you're using firefox where all clipboard reading functionality is disabled.\n\nyou can fix this by following steps listed here!\n\n...or you can paste the link manually instead.", "ClipboardErrorNoPermission": "cobalt can't access the most recent item in your clipboard without your permission.\n\nif you don't want to give access, just paste the link manually instead.\n\nif you do, go to site settings and enable the clipboard permission.", - "SupportSelfTroubleshooting": "experiencing issues? try self-troubleshooting guide first!", + "SupportSelfTroubleshooting": "experiencing issues? try one of these first:", "AccessibilityGoBack": "go back and close the popup", "CollapseKeyboard": "keyboard shortcuts", "KeyboardShortcutsIntro": "use cobalt even faster with keyboard shortcuts:", @@ -157,6 +156,9 @@ "FilenamePreviewAudioTitle": "Audio Title", "FilenamePreviewAudioAuthor": "Audio Author", "UrgentFilenameUpdate": "customizable file names!", - "UrgentTwitterPatch": "fixes and easier downloads" + "UrgentTwitterPatch": "fixes and easier downloads", + "StatusPage": "service status page", + "TroubleshootingGuide": "self-troubleshooting guide", + "UpdateNewYears": "new years clean up" } } diff --git a/src/localization/languages/ru.json b/src/localization/languages/ru.json index 3b00fa3c..cdd5fbb7 100644 --- a/src/localization/languages/ru.json +++ b/src/localization/languages/ru.json @@ -1,14 +1,14 @@ { "name": "русский", "substrings": { - "ContactLink": "напиши об этом на github (можно на русском)" + "ContactLink": "глянь статус серверов или напиши о проблеме на github (можно на русском)" }, "strings": { "AppTitleCobalt": "кобальт", "LinkInput": "вставь ссылку сюда", "AboutSummary": "кобальт - твой друг при скачивании контента из соцсетей и других сервисов. никакой рекламы, трекеров и прочего мусора. вставляешь ссылку и получаешь файл. всё. ничего лишнего.", "EmbedBriefDescription": "сохраняй то, что любишь. без рекламы, трекеров и лишней мороки.", - "MadeWithLove": "сделано wukko, с <3", + "MadeWithLove": "сделано с любовью <3", "AccessibilityInputArea": "зона вставки ссылки", "AccessibilityOpenAbout": "открыть окно с инфой", "AccessibilityDownloadButton": "кнопка скачивания", @@ -45,7 +45,6 @@ "SettingsEnableDownloadPopup": "выбор метода скачивания", "AccessibilityEnableDownloadPopup": "спрашивать, что делать с загрузками", "SettingsQualityDescription": "если выбранное качество недоступно, то выбирается ближайшее к нему.", - "LinkGitHubChanges": ">> смотри предыдущие изменения на github", "NoScriptMessage": "кобальт использует javascript для обработки ссылок и интерактивного интерфейса. ты должен разрешить использование javascript, чтобы пользоваться сайтом. тут нет никаких зловредных скриптов, обещаю.", "DownloadPopupDescriptionIOS": "наиболее простой метод скачивания видео на ios:\n1. добавь этот сценарий siri.\n2. нажми \"поделиться\" выше и выбери \"save to photos\" в открывшемся окне.\nесли появляется окно с запросом разрешения, то прочитай его, потом нажми \"всегда разрешать\".\n\nальтернативный метод:\nзажми кнопку \"скачать\", затем скрой превью и выбери \"загрузить файл по ссылке\" в появившемся окне.\nпотом открой загрузки в safari, выбери скачанный файл, нажми иконку \"поделиться\", и, наконец, нажми \"сохранить видео\".", "DownloadPopupDescription": "кнопка скачивания открывает новое окно с файлом. ты можешь отключить выбор метода скачивания файла в настройках.", @@ -77,12 +76,12 @@ "ImagePickerExplanationPhone": "зажми и удерживай картинку, чтобы её сохранить.", "ErrorNoUrlReturned": "я не получил ссылку для скачивания от сервера. такого происходить не должно. попробуй ещё раз, а если не поможет, то {ContactLink}.", "ErrorUnknownStatus": "сервер ответил мне чем-то непонятным. такого происходить не должно. попробуй ещё раз, а если не поможет, то {ContactLink}.", - "PasteFromClipboard": "вставить и скачать", + "PasteFromClipboard": "вставить", "ChangelogOlder": "предыдущие версии (тоже на английском)", "ChangelogPressToExpand": "раскрыть", "Miscellaneous": "разное", - "ModeToggleAuto": "авто режим", - "ModeToggleAudio": "аудио режим", + "ModeToggleAuto": "авто", + "ModeToggleAudio": "аудио", "SettingsDisableNotifications": "cкрыть уведомления", "MediaPickerTitle": "выбери, что сохранить", "MediaPickerExplanationPC": "кликни то, что хочешь скачать. также можно скачать правой кнопки мыши.", @@ -128,7 +127,7 @@ "FeatureErrorGeneric": "твой браузер не разрешает или не поддерживает эту функцию. проверь наличие обновлений и попробуй ещё раз!", "ClipboardErrorFirefox": "ты используешь firefox в котором все функции чтения из буфера обмена отключены по умолчанию.\n\nно это можно исправить следуя шагам, описанным здесь\n\n...или же ты можешь просто вставить ссылку вручную.", "ClipboardErrorNoPermission": "кобальт не может прочитать последний элемент в буфере обмена без твоего разрешения.\n\nесли ты не хочешь давать доступ, просто вставь ссылку вручную.\n\nну а если хочешь, то открой настройки сайта и разреши доступ на чтение буфера обмена.", - "SupportSelfTroubleshooting": "возникли проблемы? попробуй сначала исправить всё сам по этому гиду!", + "SupportSelfTroubleshooting": "возникли проблемы? попробуй сначала что-то из этого:", "AccessibilityGoBack": "вернуться назад и закрыть окно", "CollapseKeyboard": "горячие клавиши", "KeyboardShortcutsIntro": "пользуйся кобальтом ещё быстрее с горячими клавишами:", @@ -159,6 +158,9 @@ "FilenamePreviewAudioTitle": "Название Аудио", "FilenamePreviewAudioAuthor": "Автор Аудио", "UrgentFilenameUpdate": "изменяемые названия файлов!", - "UrgentTwitterPatch": "фиксы и удобное скачивание" + "UrgentTwitterPatch": "фиксы и удобное скачивание", + "StatusPage": "статус серверов", + "TroubleshootingGuide": "гайд по устранению проблем", + "UpdateNewYears": "новогодняя уборка" } } diff --git a/src/localization/manager.js b/src/localization/manager.js index 2a2389b9..ce396891 100644 --- a/src/localization/manager.js +++ b/src/localization/manager.js @@ -16,7 +16,12 @@ export async function loadLoc() { } export function replaceBase(s) { - return s.replace(/\n/g, '
').replace(/{saveToGalleryShortcut}/g, links.saveToGalleryShortcut).replace(/{repo}/g, repo).replace(/\*;/g, "•"); + return s + .replace(/\n/g, '
') + .replace(/{saveToGalleryShortcut}/g, links.saveToGalleryShortcut) + .replace(/{repo}/g, repo) + .replace(/{statusPage}/g, links.statusPage) + .replace(/\*;/g, "•"); } export function replaceAll(lang, str, string, replacement) { let s = replaceBase(str[string]) diff --git a/src/modules/api.js b/src/modules/api.js index 62e9a7c6..c3549bb3 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -1,33 +1,30 @@ -import UrlPattern from "url-pattern"; +import { services } from "./config.js"; -import { services as patterns } from "./config.js"; - -import { cleanURL, apiJSON } from "./sub/utils.js"; +import { apiJSON } from "./sub/utils.js"; import { errorUnsupported } from "./sub/errors.js"; import loc from "../localization/manager.js"; import match from "./processing/match.js"; -import hostOverrides from "./processing/hostOverrides.js"; +import { getHostIfValid } from "./processing/url.js"; -export async function getJSON(originalURL, lang, obj) { +export async function getJSON(url, lang, obj) { try { - let patternMatch, url = encodeURI(decodeURIComponent(originalURL)), - hostname = new URL(url).hostname.split('.'), - host = hostname[hostname.length - 2]; + const host = getHostIfValid(url); - if (!url.startsWith('https://')) return apiJSON(0, { t: errorUnsupported(lang) }); - - let overrides = hostOverrides(host, url); - host = overrides.host; - url = overrides.url; - - if (!(host && host.length < 20 && host in patterns && patterns[host]["enabled"])) return apiJSON(0, { t: errorUnsupported(lang) }); - - let pathToMatch = cleanURL(url, host).split(`.${patterns[host]['tld'] ? patterns[host]['tld'] : "com"}/`)[1].replace('.', ''); - for (let i in patterns[host]["patterns"]) { - patternMatch = new UrlPattern(patterns[host]["patterns"][i]).match(pathToMatch); - if (patternMatch) break + if (!host || !services[host].enabled) { + return apiJSON(0, { t: errorUnsupported(lang) }); + } + + let patternMatch; + for (const pattern of services[host].patterns) { + patternMatch = pattern.match( + url.pathname.substring(1) + url.search + ); + if (patternMatch) break; + } + + if (!patternMatch) { + return apiJSON(0, { t: errorUnsupported(lang) }); } - if (!patternMatch) return apiJSON(0, { t: errorUnsupported(lang) }); return await match(host, patternMatch, url, lang, obj) } catch (e) { diff --git a/src/modules/changelog/changelog.json b/src/modules/changelog/changelog.json index 0ff51642..a4948a1f 100644 --- a/src/modules/changelog/changelog.json +++ b/src/modules/changelog/changelog.json @@ -1,16 +1,26 @@ { "current": { + "version": "7.8", + "date": "December 25, 2023", + "title": "new years clean up! bug fixes and fresh look for the home page", + "banner": { + "file": "catroomba.webp", + "width": 300, + "height": 168 + }, + "content": "merry christmas and happy new year! this update fixes several (very annoying) bugs to help you enjoy your holidays better.\n\nyou might have already noticed, but we've refreshed the home page on desktop and mobile! less space wasted, more pleasant to look at. let us know if you like it or not :D\n\nservice improvements:\n*; #264 anything that includes a period in the url should be possible to download (including instagram stories).\n*; #73 soundcloud: falling back to mp3 instead of refusing to download the song at all.\n*; #275 youtube: query parameters are parsed and handled correctly, all links should be supported, no matter where v query is located.\n*; tlds are parsed and validated correctly (e.g. \"pinterest.co.uk\" works now).\n\ninterface improvements:\n*; cleaner and more consistent home page layout.\n*; cleaned up support section in \"about\". also includes a link to the status page.\n\ninternal improvements:\n*; urls, subdomains, and tlds are properly validated.\n*; minor clean up.\n\nchanges since 7.7:\n*; made terms and ethics more descriptive.\n*; fix only affected twitter videos.\n*; fixed quick ⌘+V pasting on mac.\n*; now catching even more youtube-related errors.\n\nthis might not seem like a lot, but even smaller changes make a difference!\n\nenjoy this update and the rest of your day :D" + }, + "history": [{ "version": "7.7", "date": "December 2, 2023", "title": "bugfixes and better downloads!", "banner": { "file": "meowthpolishegg.webp", - "width": 851, - "height": 640 + "width": 640, + "height": 480 }, "content": "this update fixes various issues with supported services. no new features yet, but twitter fix is surely something good to have in the meantime!\n\nservice improvements:\n*; broken twitter videos are now automatically fixed by cobalt.\n*; all vimeo videos and audios should now be possible to download.\n*; vimeo: fixed short resolution displayed in \"basic\" and \"pretty\" filename styles.\n\ninterface improvements:\n*; streamables are now easier to save on ios.\n\ninternal improvements:\n*; port env variable is now not strictly necessary for cobalt to run.\n*; minor clean up.\n\nchanges since 7.6:\n*; fix for an issue related to youtube dubs.\n*; fixed a memory leak related to live renders.\n*; handling all errors related to twitter downloads.\n*; fixed support for reddit links in various languages.\n*; added rich filenames support for twitch clips.\n*; updated support and donation lists.\n\nstay tuned for future updates and have a great day :D" - }, - "history": [{ + }, { "version": "7.6", "date": "October 15, 2023", "title": "customizable file names, instagram stories, and first cobalt sponsor!", @@ -19,7 +29,7 @@ "width": 851, "height": 640 }, - "content": "as many have (very) often requested, cobalt now lets you pick between several file name format styles!\ngo to settings > other and change it to whichever you like! there's a preview of each style, so you know how exactly files are gonna look like.\n\nif you liked file names the way they were before, don't worry: classic style is still the default :)\n\non a different but not any less important note: cobalt is now sponsored by royalehosting.net!\noverall service performance and stability is gonna be better, but also more content will be possible to download thanks to geniuine server locations. and yes, still no ads or trackers.\n\nthis update also includes a bunch of other changes, check them out:\n\nservice improvements:\n*; added support for instagram stories thanks to #194.\n*; fixed reddit support thanks to #221.\n*; added support for rich file names for youtube, vimeo, soundcloud, rutube, and vk.\n*; numbers and emoji no longer disappear from file name and metadata.\n*; mute and audio dub file name tags don't appear together anymore.\n*; youtube: dub file name tag doesn't appear anymore if audio track is default.\n\ninterface improvements:\n*; added a list of sponsors to about tab. if you host an instance, it's disabled by default, but can be enabled with showSponsors env variable.\n*; about button now opens about tab when no new changelog is available.\n*; fixed download button thickness on ios.\n\nyou now can reach out to cobalt via email for support! it's located in the about tab along with other socials, such as discord.\n\ni hope you enjoy this long-awaited update and have a blissful day :D" + "content": "as many have (very) often requested, cobalt now lets you pick between several file name format styles!\ngo to settings > other and change it to whichever you like! there's a preview of each style, so you know how exactly files are gonna look like.\n\nif you liked file names the way they were before, don't worry: classic style is still the default :)\n\non a different but not any less important note: cobalt is now sponsored by royalehosting.net!\noverall service performance and stability is gonna be better, but also more content will be possible to download thanks to geniuine server locations. and yes, still no ads or trackers.\n\nthis update also includes a bunch of other changes, check them out:\n\nservice improvements:\n*; added support for instagram stories thanks to #194.\n*; fixed reddit support thanks to #221.\n*; added support for rich file names for youtube, vimeo, soundcloud, rutube, and vk.\n*; numbers and emoji no longer disappear from file name and metadata.\n*; mute and audio dub file name tags don't appear together anymore.\n*; youtube: dub file name tag doesn't appear anymore if audio track is default.\n\ninterface improvements:\n*; added a list of sponsors to about tab. if you host an instance, it's disabled by default, but can be enabled with showSponsors env variable.\n*; about button now opens about tab when no new changelog is available.\n*; fixed download button thickness on ios.\n\nyou now can reach out to cobalt via email for support! it's located in the about tab along with other socials, such as discord.\n\ni hope you enjoy this long-awaited update and have a blissful day :D" }, { "version": "7.5", "date": "September 16, 2023", @@ -49,7 +59,7 @@ "width": 500, "height": 280 }, - "content": "this update gives cobalt a sharp look in chromium browsers and makes it even more useful than before. check out the full changelog below!\n\nservice improvements:\n*; increased video length limit from 3 hours to 5 hours. feel free to download lectures you need :)\n*; you can now disable file metadata in settings.\n*; fixed a bug which previously caused some downloads to end up being 0 bytes.\n\nui improvements:\n*; fixed clickable area for urgent notice (text on top).\n*; fixed blurry header in chrome.\n*; fixed blurry tab bar in chrome.\n*; fixed blurry switches in chrome.\n*; fixed weirdly rounded corners in popups.\n*; fixed 1px gap on edges of various elements in popup in chrome.\n*; fixed overscrolling in other settings tab on ios.\n*; fixed unexpected button highlight effect on phones.\n*; removed outdated fixes for tiny screens.\n\nother improvements:\n*; cobalt web & api start faster than before, additional preparation functions aren't unexpectedly run anymore.\n*; cobalt is now available as a docker package. check it out on github.\n\nthank you for being here. i hope you have a great day :D" + "content": "this update gives cobalt a sharp look in chromium browsers and makes it even more useful than before. check out the full changelog below!\n\nservice improvements:\n*; increased video length limit from 3 hours to 5 hours. feel free to download lectures you need :)\n*; you can now disable file metadata in settings.\n*; fixed a bug which previously caused some downloads to end up being 0 bytes.\n\nui improvements:\n*; fixed clickable area for urgent notice (text on top).\n*; fixed blurry header in chrome.\n*; fixed blurry tab bar in chrome.\n*; fixed blurry switches in chrome.\n*; fixed weirdly rounded corners in popups.\n*; fixed 1px gap on edges of various elements in popup in chrome.\n*; fixed overscrolling in other settings tab on ios.\n*; fixed unexpected button highlight effect on phones.\n*; removed outdated fixes for tiny screens.\n\nother improvements:\n*; cobalt web & api start faster than before, additional preparation functions aren't unexpectedly run anymore.\n*; cobalt is now available as a docker package. check it out on github.\n\nthank you for being here. i hope you have a great day :D" }, { "version": "7.1", "date": "August 20, 2023", @@ -59,7 +69,7 @@ "width": 640, "height": 358 }, - "content": "service improvements:\n*; extended instagram support: high quality photos, videos, reels. everything should work without any issues, enjoy! :)\n*; added support for streamable.com (thanks to #179)\n*; added video metadata to youtube videos.\n*; fixed vk video downloads.\n*; vxtwitter links are now supported.\n*; fixed support for youtube audio dubs.\n\nui improvements:\n*; fixed picker popup: it's now scrollable in all cases and clickable areas don't overlap each other.\n\nbackend improvements:\n*; cobalt will now let you know if something goes wrong during video download instead of nuking the stream.\n*; added support for cookies (thanks to #177)\n*; replaced got with undici (thanks to #182). downloads should be slightly faster and clean of garbage in headers.\n\ninternal improvements:\n*; moved host overrides into its own module.\n*; minor clean ups.\n\neven more cool stuff is coming in future updates! thank you for using cobalt :D" + "content": "service improvements:\n*; extended instagram support: high quality photos, videos, reels. everything should work without any issues, enjoy! :)\n*; added support for streamable.com (thanks to #179)\n*; added video metadata to youtube videos.\n*; fixed vk video downloads.\n*; vxtwitter links are now supported.\n*; fixed support for youtube audio dubs.\n\nui improvements:\n*; fixed picker popup: it's now scrollable in all cases and clickable areas don't overlap each other.\n\nbackend improvements:\n*; cobalt will now let you know if something goes wrong during video download instead of nuking the stream.\n*; added support for cookies (thanks to #177)\n*; replaced got with undici (thanks to #182). downloads should be slightly faster and clean of garbage in headers.\n\ninternal improvements:\n*; moved host overrides into its own module.\n*; minor clean ups.\n\neven more cool stuff is coming in future updates! thank you for using cobalt :D" }, { "version": "7.0", "date": "August 15, 2023", @@ -89,7 +99,7 @@ "width": 600, "height": 314 }, - "content": "hey! long time no see, hopefully over 40 changes will make up for it :)\n\ncobalt now has an official community discord server. you can go there for news, support, or just to chat. go check it out!\n\ntl;dr\n*; new infra, new hosting structure, new main instance api url. developers, get it here.\n*; added support for pinterest, vine archive, tumblr audio, youtube vr videos.\n*; better web app performance and look.\n*; better stability thanks to load balancing.\n*; (hopefully) no more random video/audio download drops.\n\nservice improvements:\n*; added support for pinterest videos and stories (pr by @Snazzah).\n*; added support for tumblr audio. sorry, tumblr.\n*; added support for youtube vr videos. please note that they're in youtube's proprietary ratio.\n*; added support for vine archive.\n*; added support for ancient vk videos in 240p.\n*; fixed an issue related to muted video downloads from tumblr.\n*; moved to twitter v2 api.\n*; soundcloud share links are now processed without errors.\n\nui improvements:\n*; lazy image loading. should significantly speed up the page load.\n*; fixed checkbox width on mobile devices.\n*; addition of a temporary urgent notice.\n*; added hover border to all buttons.\n*; less annoying donation button highlight.\n*; more consistent color scheme.\n*; added link to a discord server into about popup.\n*; remember celebratory emoji changes? they've been fixed, and are now dynamically loaded!\n*; changelog history now lets you try to load it again if first attempt failed for whatever reason.\n*; padding (everywhere) has been slightly reduced to fit in more content and be consistent across ui.\n*; added more info to the \"how to save\" popup for ios devices.\n*; crypto wallet press-to-copy buttons now look like buttons.\n*; improved ui layout for smallest screens (iphone 5, 5s, se, etc).\n*; removed partial translations for sake of clarity and consistency.\n\ninternal improvements:\n*; separated web and api servers. they're now completely independent and therefore more stress-resistant.\n*; added a dedicated script for building the web app if you don't want to reload the frontend server.\n*; web app building improvements.\n*; async localization preloading.\n*; consistent server start time reporting.\n*; dynamic stream and ip hashing salt generation.\n\ninfrastructure improvements:\n*; load balancing: your api requests are now sent to the least busy server. yes, there are now several of them with more to come in the future.\n*; when possible, server in closest region is used instead of a far-away one. this should help with download speeds.\n*; currently there are multiple servers in europe. i will let you know when (and if) i manage to get an american one.\n\nupdates for developers and instance hosters:\n*; server info api endpoint: you can now check up on the api server of choice. it reports all the basic info you may need. check the api docs for more info.\n*; api names: each and every api instance should have a distinctive name. this will be useful in the future :)\n*; added docker compose sample config.\n*; updated and more granular setup script.\n*; better api scalability and faster server start up thanks to web and api separation.\n*; added ability to specify ffmpeg threads. simply add ffmpegThreads to your environment variables!\n\ni'm still in awe from how popular cobalt has become. there are now over 200k of unique users monthly, and that number only keeps growing. i even had to come up with something to accommodate for larger traffic, it's absolutely insane.\n\nlove you all, have a great day :D" + "content": "hey! long time no see, hopefully over 40 changes will make up for it :)\n\ncobalt now has an official community discord server. you can go there for news, support, or just to chat. go check it out!\n\ntl;dr\n*; new infra, new hosting structure, new main instance api url. developers, get it here.\n*; added support for pinterest, vine archive, tumblr audio, youtube vr videos.\n*; better web app performance and look.\n*; better stability thanks to load balancing.\n*; (hopefully) no more random video/audio download drops.\n\nservice improvements:\n*; added support for pinterest videos and stories (pr by @Snazzah).\n*; added support for tumblr audio. sorry, tumblr.\n*; added support for youtube vr videos. please note that they're in youtube's proprietary ratio.\n*; added support for vine archive.\n*; added support for ancient vk videos in 240p.\n*; fixed an issue related to muted video downloads from tumblr.\n*; moved to twitter v2 api.\n*; soundcloud share links are now processed without errors.\n\nui improvements:\n*; lazy image loading. should significantly speed up the page load.\n*; fixed checkbox width on mobile devices.\n*; addition of a temporary urgent notice.\n*; added hover border to all buttons.\n*; less annoying donation button highlight.\n*; more consistent color scheme.\n*; added link to a discord server into about popup.\n*; remember celebratory emoji changes? they've been fixed, and are now dynamically loaded!\n*; changelog history now lets you try to load it again if first attempt failed for whatever reason.\n*; padding (everywhere) has been slightly reduced to fit in more content and be consistent across ui.\n*; added more info to the \"how to save\" popup for ios devices.\n*; crypto wallet press-to-copy buttons now look like buttons.\n*; improved ui layout for smallest screens (iphone 5, 5s, se, etc).\n*; removed partial translations for sake of clarity and consistency.\n\ninternal improvements:\n*; separated web and api servers. they're now completely independent and therefore more stress-resistant.\n*; added a dedicated script for building the web app if you don't want to reload the frontend server.\n*; web app building improvements.\n*; async localization preloading.\n*; consistent server start time reporting.\n*; dynamic stream and ip hashing salt generation.\n\ninfrastructure improvements:\n*; load balancing: your api requests are now sent to the least busy server. yes, there are now several of them with more to come in the future.\n*; when possible, server in closest region is used instead of a far-away one. this should help with download speeds.\n*; currently there are multiple servers in europe. i will let you know when (and if) i manage to get an american one.\n\nupdates for developers and instance hosters:\n*; server info api endpoint: you can now check up on the api server of choice. it reports all the basic info you may need. check the api docs for more info.\n*; api names: each and every api instance should have a distinctive name. this will be useful in the future :)\n*; added docker compose sample config.\n*; updated and more granular setup script.\n*; better api scalability and faster server start up thanks to web and api separation.\n*; added ability to specify ffmpeg threads. simply add ffmpegThreads to your environment variables!\n\ni'm still in awe from how popular cobalt has become. there are now over 200k of unique users monthly, and that number only keeps growing. i even had to come up with something to accommodate for larger traffic, it's absolutely insane.\n\nlove you all, have a great day :D" }, { "version": "5.4", "title": "instagram support, docker, and more!", @@ -170,7 +180,7 @@ "width": 500, "height": 280 }, - "content": "your favorite social media downloader just got even better! this update includes a ton of improvements and fixes.\n\nin fact, there are so many changes, i had to split them in sections.\n\nservice-related improvements:\n*; vimeo module has been revamped, all sorts of videos should now be supported.\n*; vimeo audio downloads! you now can download audios from more recent videos.\n*; cobalt now supports all sorts of tumblr links. (even those scary ones from the mobile app)\n*; vk clips support has been fixed. they rolled back the separation of videos and clips, so i had to do the same.\n*; youtube videos with community warnings should now be possible to download.\nuser interface improvements:\n*; list of supported services is now MUCH easier to read.\n*; banners in changelog history should no longer overlap each other.\n*; bullet points! they have a bit of extra padding, so it makes them stand out of the rest of text.\ninternal improvements:\n*; cobalt will now match the link to regex when using ?u= query for autopasting it into input area.\n*; better rate limiting: limiting now is done per minute, not per 20 minutes. this ensures less waiting and less attack area for request spammers.\n*; moved to my own fork of ytdl-core, cause main project seems to have been abandoned. go check it out on github or npm!\n*; ALL user inputs are now properly sanitized on the server. that includes variables for POST api method, too.\n*; \"got\" package has been (mostly) replaced by native fetch api. this should greatly reduce ram usage.\n*; all unnecessary duplications of module imports have been gotten rid of. no more error passing strings from inside of service modules. you don't make mistakes only if you don't do anything, right?\n*; other code optimizations. there's less clutter overall.\nhuge update, right? seems like everything's fixed now?\n\nnope, one issue still persists: sometimes youtube server drops packets for an audio file while cobalt's rendering the video for you. this results in abrupt cuts of audio. if you want to help solving this issue, please feel free to do it on github!\n\nthank you for reading this, and thank you for sticking with cobalt and me." + "content": "your favorite social media downloader just got even better! this update includes a ton of improvements and fixes.\n\nin fact, there are so many changes, i had to split them in sections.\n\nservice-related improvements:\n*; vimeo module has been revamped, all sorts of videos should now be supported.\n*; vimeo audio downloads! you now can download audios from more recent videos.\n*; cobalt now supports all sorts of tumblr links. (even those scary ones from the mobile app)\n*; vk clips support has been fixed. they rolled back the separation of videos and clips, so i had to do the same.\n*; youtube videos with community warnings should now be possible to download.\nuser interface improvements:\n*; list of supported services is now MUCH easier to read.\n*; banners in changelog history should no longer overlap each other.\n*; bullet points! they have a bit of extra padding, so it makes them stand out of the rest of text.\ninternal improvements:\n*; cobalt will now match the link to regex when using ?u= query for autopasting it into input area.\n*; better rate limiting: limiting now is done per minute, not per 20 minutes. this ensures less waiting and less attack area for request spammers.\n*; moved to my own fork of ytdl-core, cause main project seems to have been abandoned. go check it out on github or npm!\n*; ALL user inputs are now properly sanitized on the server. that includes variables for POST api method, too.\n*; \"got\" package has been (mostly) replaced by native fetch api. this should greatly reduce ram usage.\n*; all unnecessary duplications of module imports have been gotten rid of. no more error passing strings from inside of service modules. you don't make mistakes only if you don't do anything, right?\n*; other code optimizations. there's less clutter overall.\nhuge update, right? seems like everything's fixed now?\n\nnope, one issue still persists: sometimes youtube server drops packets for an audio file while cobalt's rendering the video for you. this results in abrupt cuts of audio. if you want to help solving this issue, please feel free to do it on github!\n\nthank you for reading this, and thank you for sticking with cobalt and me." }, { "version": "4.4", "title": "over 1 million monthly requests. thank you.", @@ -192,7 +202,7 @@ "width": 640, "height": 360 }, - "content": "this update features a TON of improvements.\n\ndevelopers, you now can rely on cobalt for getting content from social media. the api has been revamped and documentation is now available. you can read more about API changes down below. go crazy, and have fun :D\n\nif you're not a developer, here's a list of changes that you probably care about:\n- rate limit is now approximately 8 times bigger. no more waiting, even if you want to download entirety of your tiktok \"for you\" page.\n- some updates will now have expressive banners, just like this one.\n- fixed what was causing an error when a youtube video had no description.\n- mp4 format button text should now be displayed properly, no matter if you touched the switcher or not.\n\nnext, the star of this update — improved api!\n- main endpoint now uses POST method instead of GET.\n- internal variables for preferences have been updated to be consistent and easier to understand.\n- ip address is now hashed right upon request, not somewhere deep inside the code.\n- global stream salt variable is no longer unnecessarily passed over a billion functions.\n- url and picker keys are now separate in the json response.\n- cobalt web app now correctly processes responses with \"success\" status.\n\nif you currently have a siri shortcut or some other script that uses the GET method, make sure to update it soon. this method is deprecated, limited, and will be removed entirely in coming updates.\n\nif you ever make something using cobalt's api, make sure to mention @justusecobalt on twitter, i would absolutely love to see what you made." + "content": "this update features a TON of improvements.\n\ndevelopers, you now can rely on cobalt for getting content from social media. the api has been revamped and documentation is now available. you can read more about API changes down below. go crazy, and have fun :D\n\nif you're not a developer, here's a list of changes that you probably care about:\n- rate limit is now approximately 8 times bigger. no more waiting, even if you want to download entirety of your tiktok \"for you\" page.\n- some updates will now have expressive banners, just like this one.\n- fixed what was causing an error when a youtube video had no description.\n- mp4 format button text should now be displayed properly, no matter if you touched the switcher or not.\n\nnext, the star of this update — improved api!\n- main endpoint now uses POST method instead of GET.\n- internal variables for preferences have been updated to be consistent and easier to understand.\n- ip address is now hashed right upon request, not somewhere deep inside the code.\n- global stream salt variable is no longer unnecessarily passed over a billion functions.\n- url and picker keys are now separate in the json response.\n- cobalt web app now correctly processes responses with \"success\" status.\n\nif you currently have a siri shortcut or some other script that uses the GET method, make sure to update it soon. this method is deprecated, limited, and will be removed entirely in coming updates.\n\nif you ever make something using cobalt's api, make sure to mention @justusecobalt on twitter, i would absolutely love to see what you made." }, { "version": "4.2", "title": "optimized quality picking and 8k video support", @@ -204,7 +214,7 @@ }, { "version": "4.0", "title": "better and faster than ever", - "content": "this update has a ton of improvements and new features.\n\nchanges you probably care about:\n- cobalt now has support for recorded twitter spaces! download the previous conversation no matter how long it was.\n- download speeds from youtube are at least 10 times better now. you're welcome.\n- both video and audio length limits have been extended to 2 hours.\n- audio downloads from youtube, youtube music, twitter spaces, and soundcloud now have metadata! most often it's just title and artist, but when cobalt is able to get more info, it adds that metadata too.\n- tiktok downloads have been fixed, yet again, and if they ever break in the future, cobalt will fall back to downloading a less annoyingly watermarked video.\n- soundcloud downloads have been fixed, too.\n\nless notable changes:\n- currently experimenting with using mp3 as default audio format. if you set something other than mp3 before, it'll be set to mp3. you can always change it back in settings. let me know what you think about this.\n- \"download audio\" button from image picker no longer stays on the screen after popup was closed.\n- clipboard button now shows up depending on your browser's support for it.\n- you can no longer manually hide the clipboard button, 'cause it's unnecessary.\n- small internal improvements such as separation of changelog version and title.\n- fair bit of internal clean up.\n\nif you want to help me implement covers for downloaded audios, you can do it on github." + "content": "this update has a ton of improvements and new features.\n\nchanges you probably care about:\n- cobalt now has support for recorded twitter spaces! download the previous conversation no matter how long it was.\n- download speeds from youtube are at least 10 times better now. you're welcome.\n- both video and audio length limits have been extended to 2 hours.\n- audio downloads from youtube, youtube music, twitter spaces, and soundcloud now have metadata! most often it's just title and artist, but when cobalt is able to get more info, it adds that metadata too.\n- tiktok downloads have been fixed, yet again, and if they ever break in the future, cobalt will fall back to downloading a less annoyingly watermarked video.\n- soundcloud downloads have been fixed, too.\n\nless notable changes:\n- currently experimenting with using mp3 as default audio format. if you set something other than mp3 before, it'll be set to mp3. you can always change it back in settings. let me know what you think about this.\n- \"download audio\" button from image picker no longer stays on the screen after popup was closed.\n- clipboard button now shows up depending on your browser's support for it.\n- you can no longer manually hide the clipboard button, 'cause it's unnecessary.\n- small internal improvements such as separation of changelog version and title.\n- fair bit of internal clean up.\n\nif you want to help me implement covers for downloaded audios, you can do it on github." }, { "version": "3.7", "title": "support for multi media tweets is here!", diff --git a/src/modules/config.js b/src/modules/config.js index 6fbe9d43..5e079536 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -1,8 +1,17 @@ +import UrlPattern from "url-pattern"; import { loadJSON } from "./sub/loadFromFs.js"; const config = loadJSON("./src/config.json"); const packageJson = loadJSON("./package.json"); const servicesConfigJson = loadJSON("./src/modules/processing/servicesConfig.json"); +Object.values(servicesConfigJson.config).forEach(service => { + service.patterns = service.patterns.map( + pattern => new UrlPattern(pattern, { + segmentValueCharset: UrlPattern.defaultOptions.segmentValueCharset + '@\\.' + }) + ) +}) + export const services = servicesConfigJson.config, audioIgnore = servicesConfigJson.audioIgnore, diff --git a/src/modules/emoji.js b/src/modules/emoji.js index b2d759ed..f2bab1b9 100644 --- a/src/modules/emoji.js +++ b/src/modules/emoji.js @@ -39,7 +39,10 @@ const names = { "🎞️": "film_frames", "🎧": "headphone", "📧": "email", - "📬": "mailbox" + "📬": "mailbox", + "📢": "loudspeaker", + "🔧": "wrench", + "🫧": "bubbles" } let sizing = { 18: 0.8, diff --git a/src/modules/pageRender/elements.js b/src/modules/pageRender/elements.js index 8415fb25..308f9748 100644 --- a/src/modules/pageRender/elements.js +++ b/src/modules/pageRender/elements.js @@ -10,6 +10,8 @@ export const dropdownSVG = ` ` +export const linkSVG = '' + export function switcher(obj) { let items = ``; if (obj.name === "download") { @@ -17,8 +19,6 @@ export function switcher(obj) { } else { for (let i = 0; i < obj.items.length; i++) { let classes = obj.items[i]["classes"] ? obj.items[i]["classes"] : []; - if (i === 0) classes.push("first"); - if (i === (obj.items.length - 1)) classes.push("last"); items += `` } } @@ -68,7 +68,7 @@ export function popup(obj) { } } return ` - ${obj.standalone ? `