diff --git a/package.json b/package.json index 6b1f672b..2b39799b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cobalt", "description": "save what you love", - "version": "7.5.1", + "version": "7.6", "author": "wukko", "exports": "./src/cobalt.js", "type": "module", diff --git a/src/config.json b/src/config.json index 10e3286d..c14f6ce5 100644 --- a/src/config.json +++ b/src/config.json @@ -74,5 +74,15 @@ "copy": ["-c:a", "copy"], "audio": ["-ar", "48000", "-ac", "2", "-b:a", "320k"], "m4a": ["-movflags", "frag_keyframe+empty_moov"] - } + }, + "sponsors": [{ + "name": "royale", + "fullName": "RoyaleHosting", + "url": "https://royalehosting.net/", + "logo": { + "width": 605, + "height": 136, + "scale": 5 + } + }] } diff --git a/src/front/cobalt.css b/src/front/cobalt.css index e0e5322e..07c14158 100644 --- a/src/front/cobalt.css +++ b/src/front/cobalt.css @@ -315,10 +315,11 @@ button:active, color: var(--accent); background: none; border: none; - font-size: 1.6rem; + font-size: 1.8rem; cursor: pointer; padding: 0; - letter-spacing: -0.36rem; + letter-spacing: -0.35rem; + font-weight: normal!important; } #download-button:disabled { color: var(--accent-subtext); @@ -759,9 +760,6 @@ button:active, user-select: none; -webkit-user-select: none; } -.collapse-list.last { - margin-bottom: 1rem; -} .collapse-header { padding: 0.5rem var(--padding-1); font-size: 0.95rem; @@ -948,6 +946,27 @@ button:active, .collapse-list.last.expanded .collapse-header { border-radius: 0; } +.sponsored-by-text { + text-align: center!important; + font-size: .85rem; + color: var(--accent-subtext); + user-select: none; +} +#sponsored-logos { + width: 100%; + display: flex; + justify-content: center; + flex-wrap: wrap; + gap: 0.2rem 1rem; + margin-bottom: 1rem; +} +.sponsored-logo svg { + height: inherit; + width: inherit; +} +.sponsored-logo svg path { + fill: var(--accent-subtext); +} /* prevent resizing fliecker on ios if web app is installed as standalone */ @media all and (display-mode: standalone) { #home.visible { @@ -1092,7 +1111,7 @@ button:active, } .popup.small.visible { transform: none; - transition: transform 200ms cubic-bezier(0.075, 0.82, 0.165, 1), opacity 130ms ease-in-out; + transition: transform 210ms cubic-bezier(0.062, 0.82, 0.165, 1), opacity 130ms ease-in-out; } .popup.small #popup-header { background: none; diff --git a/src/front/cobalt.js b/src/front/cobalt.js index b4df9a4a..5a69bdfe 100644 --- a/src/front/cobalt.js +++ b/src/front/cobalt.js @@ -194,7 +194,7 @@ function popup(type, action, text) { store.isPopupOpen = true; switch (type) { case "about": - let tabId = sGet("seenAbout") ? "changelog" : "about"; + let tabId = sGet("changelogStatus") !== `${version}` ? "changelog" : "about"; if (text) tabId = text; eid(`tab-button-${type}-${tabId}`).click(); break; diff --git a/src/front/sponsors/royale.svg b/src/front/sponsors/royale.svg new file mode 100644 index 00000000..c0338038 --- /dev/null +++ b/src/front/sponsors/royale.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/localization/languages/en.json b/src/localization/languages/en.json index a0dc8f60..0ce31dc5 100644 --- a/src/localization/languages/en.json +++ b/src/localization/languages/en.json @@ -144,6 +144,7 @@ "NewDomainWelcome": "cobalt is moving! same features, same owner, simply a more rememberable domain. and still no ads.\n\ncobalt.tools is the new main domain, aka where you are now. make sure to update your bookmarks and reinstall the web app!", "DataTransferSuccess": "btw, your settings have been transferred automatically :)", "DataTransferError": "something went wrong when transferring your preferences. you'll have to open settings and configure cobalt by hand.", - "SupportNotAffiliated": "cobalt is not affiliated with any services listed above." + "SupportNotAffiliated": "cobalt is not affiliated with any services listed above.", + "SponsoredBy": "sponsored by" } } diff --git a/src/localization/languages/ru.json b/src/localization/languages/ru.json index ef9ddc43..db0fa5b2 100644 --- a/src/localization/languages/ru.json +++ b/src/localization/languages/ru.json @@ -146,6 +146,7 @@ "DataTransferSuccess": "кстати, твои настройки были перенесены автоматически :)", "DataTransferError": "при переносе настроек что-то пошло не так. придётся зайти в настройки и настроить кобальт вручную.", "SupportNotAffiliated": "кобальт не аффилирован ни с одним из перечисленных выше сервисов.", - "SupportMetaNoticeRU": "деятельность meta platforms inc. (владелец instagram) запрещена на территории россии." + "SupportMetaNoticeRU": "деятельность meta platforms inc. (владелец instagram) запрещена на территории россии.", + "SponsoredBy": "спонсируется" } } diff --git a/src/localization/manager.js b/src/localization/manager.js index 76b68737..2a2389b9 100644 --- a/src/localization/manager.js +++ b/src/localization/manager.js @@ -1,6 +1,6 @@ import * as fs from "fs"; import { links, repo } from "../modules/config.js"; -import loadJson from "../modules/sub/loadJSON.js"; +import { loadJSON } from "../modules/sub/loadFromFs.js"; const locPath = './src/localization/languages'; @@ -10,7 +10,7 @@ let languages = []; export async function loadLoc() { const files = await fs.promises.readdir(locPath).catch((e) => { return [] }); files.forEach(file => { - loc[file.split('.')[0]] = loadJson(`${locPath}/${file}`); + loc[file.split('.')[0]] = loadJSON(`${locPath}/${file}`); languages.push(file.split('.')[0]) }); } diff --git a/src/modules/changelog/changelogManager.js b/src/modules/changelog/changelogManager.js index 40ddc5a0..b267b321 100644 --- a/src/modules/changelog/changelogManager.js +++ b/src/modules/changelog/changelogManager.js @@ -1,5 +1,5 @@ import { replaceBase } from "../../localization/manager.js"; -import loadJSON from "../sub/loadJSON.js"; +import { loadJSON } from "../sub/loadFromFs.js"; let changelog = loadJSON('./src/modules/changelog/changelog.json') diff --git a/src/modules/config.js b/src/modules/config.js index 5268b8dd..6fbe9d43 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -1,7 +1,7 @@ -import loadJson from "./sub/loadJSON.js"; -const config = loadJson("./src/config.json"); -const packageJson = loadJson("./package.json"); -const servicesConfigJson = loadJson("./src/modules/processing/servicesConfig.json"); +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"); export const services = servicesConfigJson.config, @@ -16,4 +16,5 @@ export const ffmpegArgs = config.ffmpegArgs, supportedAudio = config.supportedAudio, celebrations = config.celebrations, - links = config.links + links = config.links, + sponsors = config.sponsors diff --git a/src/modules/pageRender/elements.js b/src/modules/pageRender/elements.js index 65f96699..c0c4ed44 100644 --- a/src/modules/pageRender/elements.js +++ b/src/modules/pageRender/elements.js @@ -1,5 +1,6 @@ -import { authorInfo, celebrations } from "../config.js"; +import { authorInfo, celebrations, sponsors } from "../config.js"; import emoji from "../emoji.js"; +import { loadFile } from "../sub/loadFromFs.js"; export const backButtonSVG = ` @@ -255,3 +256,21 @@ export function webLoc(t, arr) { } return `{${base}};` } + +export function sponsoredList() { + let base = ``; + let altText = `` + for (let i = 0; i < sponsors.length; i++) { + let s = sponsors[i]; + let loadedLogo = loadFile(`./src/front/sponsors/${s.name}.svg`); + + altText += `${s.fullName ? s.fullName : s.name}, `; + base += + `` + } + return `` +} diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js index 23f9966d..3de0110a 100644 --- a/src/modules/pageRender/page.js +++ b/src/modules/pageRender/page.js @@ -1,4 +1,4 @@ -import { checkbox, collapsibleList, explanation, footerButtons, multiPagePopup, popup, popupWithBottomButtons, sep, settingsCategory, switcher, socialLink, socialLinks, urgentNotice, keyboardShortcuts, webLoc } from "./elements.js"; +import { checkbox, collapsibleList, explanation, footerButtons, multiPagePopup, popup, popupWithBottomButtons, sep, settingsCategory, switcher, socialLink, socialLinks, urgentNotice, keyboardShortcuts, webLoc, sponsoredList } from "./elements.js"; import { services as s, authorInfo, version, repo, donations, supportedAudio } from "../config.js"; import { getCommitInfo } from "../sub/currentCommit.js"; import loc from "../../localization/manager.js"; @@ -164,7 +164,17 @@ export default function(obj) { title: `${emoji("📑")} ${t("CollapseLegal")}`, body: t("FairUse") }]) - }] + }, + ...(process.env.showSponsors ? + [{ + text: t("SponsoredBy"), + classes: ["sponsored-by-text"], + nopadding: true + }, { + text: sponsoredList(), + raw: true + }] : [] + )] }) }, { name: "changelog", diff --git a/src/modules/sub/loadFromFs.js b/src/modules/sub/loadFromFs.js new file mode 100644 index 00000000..3cbb1614 --- /dev/null +++ b/src/modules/sub/loadFromFs.js @@ -0,0 +1,16 @@ +import * as fs from "fs"; + +export function loadJSON(path) { + try { + return JSON.parse(fs.readFileSync(path, 'utf-8')) + } catch(e) { + return false + } +} +export function loadFile(path) { + try { + return fs.readFileSync(path, 'utf-8') + } catch(e) { + return false + } +} diff --git a/src/modules/sub/loadJSON.js b/src/modules/sub/loadJSON.js deleted file mode 100644 index 205c36d6..00000000 --- a/src/modules/sub/loadJSON.js +++ /dev/null @@ -1,9 +0,0 @@ -import * as fs from "fs"; - -export default function(path) { - try { - return JSON.parse(fs.readFileSync(path, 'utf-8')) - } catch(e) { - return false - } -} diff --git a/src/test/test.js b/src/test/test.js index f03c8dbb..15b28cca 100644 --- a/src/test/test.js +++ b/src/test/test.js @@ -2,7 +2,7 @@ import "dotenv/config"; import { getJSON } from "../modules/api.js"; import { services } from "../modules/config.js"; -import loadJSON from "../modules/sub/loadJSON.js"; +import { loadJSON } from "../modules/sub/loadFromFs.js"; import { checkJSONPost } from "../modules/sub/utils.js"; let tests = loadJSON('./src/test/tests.json');