diff --git a/api/src/core/web.js b/api/src/core/web.js deleted file mode 100644 index d892c56c..00000000 --- a/api/src/core/web.js +++ /dev/null @@ -1,97 +0,0 @@ - -import { Bright, Cyan } from "../modules/sub/consoleText.js"; -import { languageCode } from "../modules/sub/utils.js"; -import { version, env } from "../modules/config.js"; - -import { buildFront } from "../modules/build.js"; -import findRendered from "../modules/pageRender/findRendered.js"; - -import { celebrationsEmoji } from "../modules/pageRender/elements.js"; -import { changelogHistory } from "../modules/pageRender/onDemand.js"; -import { createResponse } from "../modules/processing/request.js"; - -export async function runWeb(express, app, gitCommit, gitBranch, __dirname) { - const startTime = new Date(); - const startTimestamp = Math.floor(startTime.getTime()); - - await buildFront(gitCommit, gitBranch); - - app.use('/', express.static('./build/min')); - app.use('/', express.static('./src/front')); - - app.use((req, res, next) => { - try { decodeURIComponent(req.path) } catch (e) { return res.redirect('/') } - next(); - }) - - app.get('/onDemand', (req, res) => { - try { - if (typeof req.query.blockId !== 'string') { - return res.status(400).json({ - status: "error", - text: "couldn't render this block, please try again!" - }); - } - - let blockId = req.query.blockId.slice(0, 3); - let blockData; - switch(blockId) { - // changelog history - case "0": - let history = changelogHistory(); - if (history) { - blockData = createResponse("success", { t: history }) - } else { - blockData = createResponse("error", { - t: "couldn't render this block, please try again!" - }) - } - break; - // celebrations emoji - case "1": - let celebration = celebrationsEmoji(); - if (celebration) { - blockData = createResponse("success", { t: celebration }) - } - break; - default: - blockData = createResponse("error", { - t: "couldn't find a block with this id" - }) - break; - } - - if (blockData?.body) { - return res.status(blockData.status).json(blockData.body); - } else { - return res.status(204).end(); - } - } catch { - return res.status(400).json({ - status: "error", - text: "couldn't render this block, please try again!" - }) - } - }) - - app.get("/", (req, res) => { - return res.sendFile(`${__dirname}/${findRendered(languageCode(req))}`) - }) - - app.get("/favicon.ico", (req, res) => { - return res.sendFile(`${__dirname}/src/front/icons/favicon.ico`) - }) - - app.get("/*", (req, res) => { - return res.redirect('/') - }) - - app.listen(env.webPort, () => { - console.log(`\n` + - `${Cyan("cobalt")} WEB ${Bright(`v.${version}-${gitCommit} (${gitBranch})`)}\n` + - `Start time: ${Bright(`${startTime.toUTCString()} (${startTimestamp})`)}\n\n` + - `URL: ${Cyan(`${env.webURL}`)}\n` + - `Port: ${env.webPort}\n` - ) - }) -} diff --git a/api/src/front/assets/meowbalt/error.png b/api/src/front/assets/meowbalt/error.png deleted file mode 100644 index 533858a7..00000000 Binary files a/api/src/front/assets/meowbalt/error.png and /dev/null differ diff --git a/api/src/front/assets/meowbalt/question.png b/api/src/front/assets/meowbalt/question.png deleted file mode 100644 index 330cd69b..00000000 Binary files a/api/src/front/assets/meowbalt/question.png and /dev/null differ diff --git a/api/src/front/cobalt.css b/api/src/front/cobalt.css deleted file mode 100644 index ab8c5e3b..00000000 --- a/api/src/front/cobalt.css +++ /dev/null @@ -1,1265 +0,0 @@ -:root { - --transparent: rgba(0, 0, 0, 0); - --without-padding: calc(100% - 4rem); - --border-15: 0.15rem solid var(--accent); - --border-10: 0.1rem solid var(--accent); - --inset-focus: 0 0 0 0.1rem var(--accent) inset; - --inset-focus-inv: 0 0 0 0.15rem var(--background) inset; - --font-mono: 'Noto Sans Mono', 'Consolas', 'SF Mono', monospace; - --padding: 0.7rem; - --padding-small: 0.2rem; - --padding-dialog: 18px; - --line-height: 1.65rem; - --red: rgb(249, 47, 96); - --blue: rgb(47, 138, 249); - --gap: 0.5rem; - --gap-no-icon: 0.6rem; -} -[data-theme="dark"] { - --accent: rgb(225, 225, 225); - --accent-highlight: rgb(225, 225, 225, 4%); - --accent-subtext: rgb(110, 110, 110); - --accent-hover: rgb(30, 30, 30); - --accent-hover-elevated: rgb(48, 48, 48); - --accent-hover-transparent: rgba(48, 48, 48, 0.5); - --accent-button: rgb(25, 25, 25); - --accent-button-elevated: rgb(42, 42, 42); - --glass: rgba(25, 25, 25, 0.85); - --glass-lite: rgba(25, 25, 25, 0.98); - --subbackground: rgb(10, 10, 10); - --background: rgb(0, 0, 0); - --background-backdrop: rgba(0, 0, 0, 0.5); -} -[data-theme="light"] { - --accent: rgb(25, 25, 25); - --accent-highlight: rgb(25, 25, 25, 4%); - --accent-subtext: rgb(110, 110, 110); - --accent-hover: rgb(225, 225, 225); - --accent-hover-elevated: rgb(210, 210, 210); - --accent-hover-transparent: rgba(215, 215, 215, 0.5); - --accent-button: rgb(232, 232, 232); - --accent-button-elevated: rgb(215, 215, 215); - --glass: rgba(232, 232, 232, 0.85); - --glass-lite: rgba(232, 232, 232, 0.98); - --subbackground: rgb(240, 240, 240); - --background: rgb(255, 255, 255); - --background-backdrop: rgba(255, 255, 255, 0.5); -} -html, -body { - height: calc(100% + env(safe-area-inset-top) / 2); - margin: 0; - background: var(--background); - color: var(--accent); - -webkit-tap-highlight-color: var(--transparent); - font-family: var(--font-mono); - user-select: none; - -webkit-user-select: none; - overflow: hidden; - -ms-overflow-style: none; - scrollbar-width: none; -} -#home { - position: fixed; - width: 100%; - height: 100%; -} -a { - color: var(--accent); - text-decoration: none; - user-select: none; - -webkit-user-select: none; -} -::placeholder, -::moz-placeholder { - color: var(--accent-subtext); -} -.switches::-webkit-scrollbar, -.popup-content::-webkit-scrollbar { - display: none; -} -:focus-visible { - outline: var(--border-15); -} -.checkbox { - display: inline-flex; - align-items: center; - flex-direction: row; - flex-wrap: nowrap; - padding: calc(var(--gap) - 0.1rem) calc(var(--gap)*2 - var(--padding-small)) calc(var(--gap) - 0.1rem) var(--gap); - width: auto; - margin-right: var(--padding); - margin-bottom: var(--padding); - background: var(--accent-button); -} -.checkbox-label { - line-height: 1.3rem; -} -[type="checkbox"] { - -webkit-appearance: none; - appearance: none; - width: 20px; - height: 20px; - z-index: 0; - margin-right: var(--padding); - border: 0.15rem solid var(--accent); -} -[type="checkbox"]::before { - content: ""; - display: none; - position: relative; - width: 6px; - height: 12px; - z-index: 5; - transform: scaleX(0.9)rotate(45deg); - left: 6px; - top: 1px; - border-bottom: 0.18rem solid var(--background); - border-right: 0.18rem solid var(--background); -} -[type="checkbox"]:checked::before { - display: block; -} -[type="checkbox"]:checked { - background-color: var(--accent); - border: 0; -} -input[type="checkbox"] { - cursor: pointer; -} -button { - background: none; - border: none; - font-family: var(--font-mono); - color: var(--accent); - font-size: 0.9rem; -} -input, -input[type="text"], -[type="text"] { - border-radius: 0; -} -.glass-bkg { - background: var(--glass); - backdrop-filter: blur(7px); - -webkit-backdrop-filter: blur(7px); -} -.glass-bkg.alone { - z-index: -1; - top: 0; - left: 0; - bottom: 0; - right: 0; - position: absolute; -} -.glass-bkg.small { - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: -1; - position: absolute; - border: var(--accent-highlight) solid 0.15rem; - border-radius: 22px; -} -.desktop button:hover, -.desktop .switch:hover, -.desktop .checkbox:hover, -.desktop .text-to-copy:hover, -.desktop .collapse-header:hover { - background: var(--accent-hover); - box-shadow: 0 0 0 0.1rem var(--accent-highlight) inset; - cursor: pointer; -} -button:active, -.switch:active, -.checkbox:active, -.text-to-copy:active { - box-shadow: 0 0 0 0.1rem var(--accent-highlight) inset; - cursor: pointer; - transform: scale(0.95); -} -.collapse-header:active { - box-shadow: 0 0 0 0.1rem var(--accent-highlight) inset; -} -.popup.small .switch { - background: var(--accent-button-elevated); -} -.desktop .popup.small .switch:hover { - background: var(--accent-hover-elevated); -} -.switch.text-backdrop, -.switch.text-backdrop:hover, -.switch.text-backdrop:active, -.text-to-copy.text-backdrop, -.text-to-copy.text-backdrop:hover, -.text-to-copy.text-backdrop:active, -.popup.small .switch.text-backdrop, -.popup.small .switch.text-backdrop:hover, -.popup.small .switch.text-backdrop:active { - background: var(--accent); - color: var(--background); - box-shadow: 0 0 0 0.1rem var(--accent-highlight) inset; -} -.picker-image:active { - cursor: pointer; - transform: scale(0.95); -} -.button { - background: none; - border: var(--border-15); - color: var(--accent); - padding: 0.3rem var(--padding) 0.5rem; - font-size: 1rem; -} -.mono { - font-family: var(--font-mono); -} -.center { - top: 50%; - left: 50%; - transform: translate(-50%, -50%); -} -#cobalt-main-box { - position: fixed; - width: 40rem; - height: auto; - display: flex; - flex-direction: column; - align-content: center; - align-items: center; -} -#logo { - text-align: center; - font-size: 1rem; - height: 2.5rem; - align-items: center; - display: flex; - gap: 0.3rem; -} -.logo-sub { - color: var(--blue); - font-size: 0.8rem; -} -#download-area { - display: flex; - flex-direction: column; - width: 100%; -} -#cobalt-main-box #top { - display: inline-flex; - height: 2.5rem; - flex-direction: row; -} -#cobalt-main-box #bottom { - padding-top: calc(1rem - var(--padding-small)); - display: flex; - flex-direction: row; - justify-content: space-between; -} -.box { - background: var(--background); - color: var(--accent); -} -#url-input-area { - background: none; - padding-left: calc(20px + 1.4rem); - width: 100%; - color: var(--accent); - border: 0; - float: right; - border-bottom: 0.1rem solid var(--accent-subtext); - outline: none; - font-size: 0.8rem; -} -#url-clear { - height: 100%; - background: none; - padding: 0 1rem var(--padding-small); - transform: none; - font-size: 1rem; - box-shadow: none!important; -} -#url-input-area:focus { - outline: none; - border-bottom: var(--border-10); -} -#link-icon { - display: flex; - position: absolute; - width: 20px; - padding-top: var(--padding-small); - left: var(--padding); - flex-wrap: nowrap; - color: var(--accent-subtext); -} -#download-button { - height: 2.5rem; - color: var(--accent); - background: none; - border: none; - font-size: 1.8rem; - cursor: pointer; - padding: 0; - letter-spacing: -0.35rem; - font-weight: normal!important; -} -#download-button:disabled { - 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%; - position: absolute; - display: flex; - justify-content: center; - padding-bottom: 2rem; - font-size: 0.9rem; - text-align: center; -} -#cobalt-main-box #bottom, -#footer-buttons, -#footer-buttons, .footer-pair { - gap: var(--gap); -} -#footer-buttons, .footer-pair { - display: flex; - flex-direction: row; - align-items: center; -} -.footer-button { - width: auto!important; - color: var(--accent-subtext); - padding: var(--gap) 1rem!important; - align-content: center; -} -.notification-dot { - width: 8px; - height: 8px; - background: var(--red); - margin-right: 0.4rem; - border-radius: 99rem; -} -.text-backdrop { - background: var(--accent); - color: var(--background); - padding: 0 0.3rem; -} -.text-backdrop.link { - text-decoration: underline; -} -.cobalt-support-link { - display: flex; - flex-direction: row; - justify-content: flex-start; - gap: 0.3rem; - margin-top: 0.5rem; - user-select: none; - -webkit-user-select: none; -} -::-moz-selection { - background-color: var(--accent); - color: var(--background); -} -::selection { - background-color: var(--accent); - color: var(--background); -} -.popup { - visibility: hidden; - position: fixed; - height: auto; - width: 36%; - z-index: 999; - font-size: 0.9rem; - max-height: 95%; - opacity: 0; - transform: translate(-50%,-48%)scale(.95); - box-shadow: 0 0 0 var(--padding-small) var(--glass) inset, - 0 0 20px 0 var(--accent-hover-transparent); -} -.popup.visible { - visibility: visible; - opacity: 1; - transform: translate(-50%, -50%); - transition: transform 100ms ease-out, opacity 100ms ease-in-out; -} -#popup-backdrop { - visibility: hidden; - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 998; - opacity: 0; - background: var(--background-backdrop); -} -#popup-backdrop.visible { - visibility: visible; - opacity: 1; - transition: opacity .13s ease-in-out; - backdrop-filter: blur(7px); - -webkit-backdrop-filter: blur(7px); -} -.popup.small { - width: 21rem; - box-shadow: 0px 0px 60px 0px var(--accent-hover); - padding: var(--padding-dialog); - transform: translate(-50%, -50%)scale(.95); - pointer-events: all; - border-radius: 22px; -} -.popup.small .popup-content-inner { - display: flex; - flex-direction: column; - gap: var(--padding-dialog); - width: 100%; -} -.popup.small.visible { - transform: translate(-50%, -50%); -} -.popup.small .popup-header-contents, -.popup.small .popup-content-inner, -.popup.small .popup-header { - padding: 0; -} -.popup.small .popup-header { - position: relative; - border: none; -} -.popup.small .popup-title { - margin-bottom: 0.6rem; -} -.popup.small .close-error.switch { - background: var(--accent)!important; - color: var(--background); - height: 2.5rem; -} -#popup-error, -#popup-download { - display: flex; - flex-direction: column; - padding-top: 4rem; -} -#popup-error { - justify-content: center; - align-items: center; -} -.popout-meowbalt { - position: absolute; - top: -7rem; - user-select: none; - -webkit-user-select: none; - pointer-events: none; - height: 180px; - width: 180px; -} -#popup-download .popout-meowbalt { - left: -2rem; -} -.popup.scrollable { - height: 95%; -} -.changelog-subtitle { - font-size: 1.3rem; - padding-bottom: var(--gap-no-icon); -} -.changelog-banner { - position: relative; - width: 100%; - max-height: 300px; - min-height: 210px; - margin-bottom: var(--padding); - float: left; - background: var(--accent-hover); - display: flex; -} -.changelog-img { - object-fit: cover; - width: inherit; - height: inherit; - max-height: inherit; -} -.changelog-tags { - display: inline-flex; - align-items: center; - gap: var(--padding); - padding-bottom: var(--padding); - flex-wrap: wrap; -} -.changelog-tag-version { - font-size: 1rem; - padding: 0.15rem 0.5rem; -} -.changelog-tag-date { - color: var(--accent-subtext); - font-size: 0.8rem; -} -.nowrap { - white-space: nowrap; -} -.no-top-padding { - padding-top: 0!important; -} -.desc-padding { - padding-bottom: var(--padding); -} -#popup-subtitle { - font-size: 1.1rem; - padding-bottom: var(--padding); -} -.popup-desc, -.desc-error, -#popup-info-desc { - width: 100%; - text-align: left; - float: left; - line-height: var(--line-height); - user-select: text; - -webkit-user-select: text; -} -.desc-error { - padding-bottom: 0rem; - text-align: center; -} -.popup-title { - font-size: 1.5rem; - display: flex; - align-items: center; - line-height: 1em; - margin-bottom: 0.4rem; - margin-top: 0.4rem; -} -.popup-above-title { - color: var(--accent-subtext); - font-size: 0.8rem; -} -.popup-content { - overflow-x: scroll; - overflow-y: auto; - height: 100%; - scrollbar-width: none; -} -.popup-content-inner, -.tab-content-settings, -#picker-holder { - padding-top: calc(var(--padding) + 4rem); - padding-bottom: 4.8rem; -} -.tab-content-settings, -#tab-about-about .popup-content-inner { - padding-top: 6rem; -} -.bullpadding { - padding-left: 0.58rem; -} -.popup-header { - position: absolute; - z-index: 999; - padding-top: calc(var(--padding) + 1rem); - width: 100%; -} -.settings-category { - padding-bottom: var(--padding); -} -.separator { - float: left; -} -.separator, -.category-title { - width: 100%; - color: var(--accent-subtext); - border-bottom: 0.05rem solid var(--accent-subtext); - padding-bottom: 0.25rem; - margin-bottom: calc(var(--gap-no-icon)*1.5); -} -.category-title { - text-align: left; - line-height: var(--line-height); -} -.bottom-margin { - margin-bottom: var(--padding)!important; -} -.top-margin { - margin-top: var(--padding)!important; -} -.top-margin-only { - margin-top: var(--padding)!important; - margin-bottom: 0!important; -} -.no-margin { - margin: 0!important; -} -.switch-container { - width: 100%; -} -.subtitle { - width: 100%; - text-align: left; - line-height: var(--line-height); - padding-bottom: 0.4rem; - color: var(--accent); -} -.small-padding .subtitle { - margin-top: 0.5rem; -} -.explanation { - margin-top: var(--padding); - width: 100%; - font-size: 0.8rem; - text-align: left; - line-height: 1.3rem!important; - color: var(--accent-subtext); -} -.explanation.embedded { - margin-top: 0.825rem; - margin-bottom: 0.825rem; -} -.subtext { - color: var(--accent-subtext); -} -.switch { - padding: var(--gap-no-icon); - width: 100%; - text-align: left; - color: var(--accent); - background: var(--accent-button); - display: flex; - justify-content: center; - align-items: center; - cursor: pointer; -} -.switch.space-right { - margin-right: var(--padding); -} -.switch:focus { - box-shadow: var(--inset-focus) inset; -} -.popup-tabs .switch { - background: none; -} -.desktop .popup-tabs .switch:hover, -.popup-tabs .switch:active { - background: var(--accent-hover-transparent); - box-shadow: 0 0 0 0.1rem var(--accent-highlight) inset; -} -.switch[data-enabled="true"], -.popup-tabs .switch[data-enabled="true"] { - color: var(--background); - background: var(--accent)!important; - cursor: default; -} -.switch[data-enabled="true"]:hover { - background: var(--accent); -} -.switch[data-enabled="true"]:focus { - box-shadow: var(--inset-focus-inv) inset; -} -.switches { - display: flex; - width: auto; - flex-direction: row; - flex-wrap: nowrap; - scrollbar-width: none; -} -.switches .switch { - padding-left: calc(var(--gap-no-icon) + 0.1rem); - padding-right: calc(var(--gap-no-icon) + 0.1rem); -} -#popup-settings .switches .switch { - text-align: center; -} -.autowidth { - width: auto; -} -.bottom-space { - margin-bottom: 2rem; -} -.text-to-copy { - user-select: text; - -webkit-user-select: text; - background: var(--accent-button); - padding: var(--gap-no-icon); - overflow: clip; -} -.back-button { - padding: 0; - background: none; - max-width: 4rem; - font-size: 1rem; -} -.back-button svg path, -.collapse-indicator svg path { - fill: var(--accent); -} -.popup-tab-content[data-enabled="false"] { - display: none; -} -.popup-tabs { - z-index: 999; - bottom: 0; - position: absolute; - width: 100%; - padding-top: var(--padding-small); - padding-bottom: calc(var(--padding) + 1rem); -} -.popup-tabs-child { - width: 100%; - padding: 0 var(--padding-small); -} -.emoji, svg { - user-select: none; - -webkit-user-select: none; - pointer-events: none; -} -.emoji { - margin-right: 0.4rem; -} -.picker-image { - object-fit: cover; - width: 100%; - height: 100%; - cursor: pointer; - user-select: all; - -webkit-user-select: all; -} -.picker-image-container { - width: calc(100% / 3); - height: 12rem; - background-color: var(--accent-button); - cursor: pointer; - position: relative; -} -#picker-holder { - display: flex; - justify-content: start; - flex-wrap: wrap; - align-content: space-around; - padding-top: 7.6rem; - padding-bottom: 4.8rem; - padding-left: var(--padding-small); - padding-right: var(--padding-small); -} -.imageBlock { - width: 100%; - height: 100%; - position: absolute; - z-index: 99; -} -.picker-element-name { - position: absolute; - background: var(--background); - color: var(--accent); - padding: 0.3rem var(--gap); - font-size: 0.8rem; - opacity: 0.7; - margin: 0.4rem; -} -#popup-picker .explanation { - margin-top: 0!important; - margin-bottom: var(--padding); -} -#cobalt-main-box #bottom button { - width: auto; - padding: var(--gap) 0.9rem; -} -.collapse-list { - background: var(--subbackground); - user-select: none; - -webkit-user-select: none; -} -.collapse-header { - padding: 0.5rem var(--padding); - font-size: 0.95rem; - display: flex; - flex-direction: row; - align-items: center; - cursor: pointer; - background: var(--accent-button); -} -.collapse-header .emoji { - margin-right: var(--padding); -} -.collapse-indicator { - display: flex; - justify-content: center; - align-items: center; - cursor: pointer; - transform: none; -} -.collapse-list.expanded .collapse-indicator { - transform: rotate(180deg); -} -.collapse-title { - width: 100%; - display: flex; - flex-direction: row; - align-items: center; -} -.collapse-body { - display: none; - padding: var(--padding); - padding-bottom: 1rem; - user-select: text; - -webkit-user-select: text; -} -.expanded .collapse-body { - display: block; -} -#download-switcher .switches { - gap: var(--gap); -} -#pd-share { - display: none; -} -.popup-content-inner, -.tab-content-settings, -.popup-header-contents { - padding-left: 1rem; - padding-right: 1rem; -} -.urgent-notice { - width: 100%; - text-align: center; - position: absolute; - display: flex; - justify-content: center; - align-items: center; - padding-top: 1rem; -} -.urgent-text { - display: flex; - align-items: center; - cursor: pointer; -} -.no-transparency .glass-bkg, -.no-transparency #popup-backdrop { - backdrop-filter: none; - -webkit-backdrop-filter: none; -} -.no-transparency .glass-bkg { - background: var(--glass-lite); -} -.no-animation .popup, -.no-animation #popup-backdrop { - transition: none; -} -.popup-from-bottom { - position: fixed; - width: 100%; - height: 100%; - bottom: 0; - z-index: 999; - visibility: hidden; - pointer-events: none; -} -.popup-from-bottom.visible { - visibility: visible; -} -#keyboard-collapse { - display: none; -} -.desktop #keyboard-collapse { - display: block; -} -.text-backdrop.key { - color: var(--accent-hover-elevated); -} -#keyboard-shortcuts { - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: flex-start; - align-items: flex-start; - gap: 1.5rem; - user-select: none; - color: var(--accent); -} -.loader { - text-align: center; -} -#picker-download { - visibility: hidden; -} -#picker-download.visible { - visibility: visible; -} -#home { - opacity: 0; -} -#home.visible { - opacity: 1; - transition: opacity 0.2s ease-out; -} -.no-animation #home { - transition: none; -} -.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: var(--padding-small) 1rem; - margin-bottom: 1rem; -} -.sponsored-logo svg { - height: inherit; - width: inherit; -} -.sponsored-logo svg path { - fill: var(--accent-subtext); -} -#filename-preview { - background: var(--accent-button); - margin-top: 0.8rem; -} -.filename-item { - display: flex; - flex-direction: row; - align-items: center; - justify-content: flex-start; - gap: 1rem; - padding: 0.5rem var(--padding); -} -.filename-item.line { - border-bottom: 0.1rem solid var(--accent-button-elevated); -} -.filename-label { - color: var(--accent-subtext); - font-size: 0.8rem; -} -.filename-container { - overflow-wrap: anywhere; -} -/* rounded corners */ -#bottom #paste, -#footer .switch, -#audioMode, -.popup-content .switches, -.checkbox, -.changelog-img, -.changelog-banner, -.close-error, -#download-switcher .switch, -#popup-about .switch, -.popup-tabs .switch, -.text-to-copy, -.text-to-copy.text-backdrop, -#filename-preview { - border-radius: 9px; -} -[type=checkbox] { - border-radius: 4px; -} -.popup, -.scrollable .popup-content { - border-radius: 12px; -} -.popup-header .glass-bkg { - border-top-left-radius: 12px; - border-top-right-radius: 12px; - border-bottom: var(--accent-highlight) solid 0.1rem; - top: -1px; -} -.popup-tabs .glass-bkg { - border-bottom-left-radius: 12px; - border-bottom-right-radius: 12px; - border-top: var(--accent-highlight) solid 0.1rem; - bottom: -1px; -} -.switches .switch:first-child { - border-top-left-radius: 9px; - border-bottom-left-radius: 9px; -} -.switches .switch:last-child { - border-top-right-radius: 9px; - border-bottom-right-radius: 9px; -} -.text-backdrop { - border-radius: 4px; -} -.collapse-list:first-child, -.collapse-list:first-child .collapse-header { - border-top-left-radius: 8px; - border-top-right-radius: 8px; -} -.collapse-list:last-child, -.collapse-list:last-child .collapse-header { - border-bottom-left-radius: 8px; - border-bottom-right-radius: 8px; -} -.collapse-list:last-child.expanded .collapse-header { - border-radius: 0; -} -/* prevent resizing fliecker on ios if web app is installed as standalone */ -@media all and (display-mode: standalone) { - #home.visible { - transition-delay: 0.1s; - } -} -/* adapt the page according to screen size */ -@media screen and (max-width: 1550px) { - .popup { - width: 40%; - } -} -@media screen and (max-width: 1440px) { - .popup { - width: 45%; - } -} -@media screen and (max-width: 1300px) { - .popup { - width: 50%; - } -} -@media screen and (max-width: 1200px) { - .popup { - width: 55%; - } -} -@media screen and (max-width: 1025px) { - .popup { - width: 60%; - } -} -@media screen and (max-width: 850px) { - .popup { - width: 75%; - } -} -@media screen and (max-width: 680px) { - .popup { - width: 90%; - } -} -@media screen and (max-width: 660px) { - #cobalt-main-box { - width: calc(100% - (var(--padding) * 2)); - } -} -/* mobile page */ -@media screen and (max-width: 499px) { - .tab { - font-size: 0!important; - } - .tab .emoji { - margin-right: 0; - } - .checkbox { - width: calc(100% - 1.3rem); - } -} -@media screen and (max-width: 535px) { - #cobalt-main-box #bottom { - flex-direction: row-reverse; - } - #cobalt-main-box #bottom #audioMode button, #audioMode { - width: 100%; - } - #footer-buttons { - flex-direction: column; - align-items: stretch; - width: 100%; - padding: 0 var(--padding); - } - .footer-pair .footer-button { - width: 100%!important; - } - #logo { - width: 100%; - height: auto; - justify-content: center; - } - #cobalt-main-box { - display: flex; - border: none; - padding: 0; - flex-direction: column; - gap: var(--gap); - } - .popup, - .popup-header .glass-bkg, - .popup-tabs .glass-bkg, - .glass-bkg.small { - border-radius: 0; - } - .popup-tabs .glass-bkg { - bottom: 0; - } - .switches { - overflow-x: scroll; - } - .checkbox { - margin-right: 0; - } - .popup.center { - top: unset; - left: unset; - transform: unset; - } - .popup.small { - width: calc(100% - var(--padding-dialog) * 2); - height: auto; - top: unset; - bottom: 0; - left: 0; - transform: none; - position: absolute; - transform: translateY(30rem); - } - #popup-download .popout-meowbalt { - left: unset; - } - .glass-bkg.small { - border: none; - border-top: var(--accent-highlight) solid 0.15rem; - } - .popup.small.visible { - transform: translateY(0rem); - transition: transform 250ms cubic-bezier(0.075, 0.82, 0.165, 1), opacity 130ms ease-in-out; - } - .popup.small .popup-header { - background: none; - } - .no-animation .popup.small { - transition: none; - } - .close-error { - bottom: 3rem; - } - #picker-holder { - padding-left: 0; - padding-right: 0; - } - #picker-holder::-webkit-scrollbar { - display: none; - } - #picker-holder.various { - flex-wrap: wrap; - gap: 0; - overflow-x: hidden; - overflow-y: scroll; - } - .popup, .popup.scrollable { - border: none; - width: 100%; - height: 100%; - max-height: 100%; - box-shadow: none; - } - .popup-content-inner, - .tab-content-settings, - .popup-tabs-child, - .popup-header-contents { - padding-left: var(--padding); - padding-right: var(--padding); - } - .popup-content-inner, - .tab-content-settings, - #picker-holder { - padding-bottom: calc(var(--padding) + 3.5rem); - padding-top: calc(var(--padding) + 3rem - var(--padding-small)); - } - #footer, - .popup-tabs { - padding-bottom: var(--padding); - } - .popup.small { - padding-bottom: var(--padding-dialog) - } - .urgent-notice { - padding-top: 1rem; - } - .popup-title { - margin-top: var(--padding-small); - } - .popup-header { - padding-top: var(--padding); - } - .tab-content-settings, - #tab-about-about .popup-content-inner { - padding-top: calc(5rem - var(--padding-small)); - } -} -@media screen and (max-width: 535px) and (display-mode: standalone) { - .popup-header { - padding-top: max( - calc(env(safe-area-inset-top)), - var(--padding) + 1rem - ); - } - .urgent-notice { - padding-top: max( - calc(env(safe-area-inset-top) - var(--padding-small)), - var(--padding) - ); - } - #footer, - .popup-tabs { - padding-bottom: max( - calc(env(safe-area-inset-bottom) + var(--padding-small)), - var(--padding) - ); - } - .popup.small { - padding-bottom: max( - calc(env(safe-area-inset-bottom) + var(--padding-small)), - var(--padding-dialog) - ); - } - .popup-content-inner, - .tab-content-settings { - padding-top: max( - calc(env(safe-area-inset-top) + var(--padding) + var(--padding-small) + 2rem), - calc(var(--padding) + 4rem - var(--padding-small)) - ); - padding-bottom: max( - calc(env(safe-area-inset-bottom) + var(--padding) + 3rem), - calc(var(--padding) + var(--padding-small) * 2 + 3rem) - ); - } - .tab-content-settings, - #tab-about-about .popup-content-inner { - padding-top: max( - calc(env(safe-area-inset-top) + var(--padding) + var(--padding-small) * 2 + 3rem), - calc(var(--padding) + 5rem) - ); - } - #picker-holder { - padding-top: max( - calc(env(safe-area-inset-top) + var(--padding) + 5rem), - calc(var(--padding) * 2 + 6rem) - ); - padding-bottom: max( - calc(env(safe-area-inset-bottom) + var(--padding) + 2rem), - calc(4rem - var(--padding) + var(--padding-small)) - ); - } - - .android .popup-header { - padding-top: var(--padding); - } - .android .popup-content-inner, - .android .tab-content-settings, - .android #picker-holder { - padding-bottom: calc(var(--padding) + 3.5rem); - padding-top: calc(var(--padding) + 3rem - var(--padding-small)); - } - .android .tab-content-settings, - .android #tab-about-about .popup-content-inner { - padding-top: calc(5rem - var(--padding-small)); - } -} diff --git a/api/src/front/cobalt.js b/api/src/front/cobalt.js deleted file mode 100644 index 0c89dec2..00000000 --- a/api/src/front/cobalt.js +++ /dev/null @@ -1,708 +0,0 @@ -const ua = navigator.userAgent.toLowerCase(); -const isIOS = ua.includes("iphone os") || (ua.includes("mac os") && navigator.maxTouchPoints > 0); -const isAndroid = ua.includes("android"); -const isMobile = ua.includes("android") || isIOS; -const isSafari = ua.includes("safari/"); -const isFirefox = ua.includes("firefox/"); -const isOldFirefox = ua.includes("firefox/") && ua.split("firefox/")[1].split('.')[0] < 103; - -const switchers = { - "theme": ["auto", "light", "dark"], - "vCodec": ["h264", "av1", "vp9"], - "vQuality": ["720", "max", "2160", "1440", "1080", "480", "360", "240", "144"], - "aFormat": ["mp3", "best", "ogg", "wav", "opus"], - "audioMode": ["false", "true"], - "filenamePattern": ["classic", "pretty", "basic", "nerdy"] -} -const checkboxes = [ - "alwaysVisibleButton", - "downloadPopup", - "fullTikTokAudio", - "muteAudio", - "reduceTransparency", - "disableAnimations", - "disableMetadata", - "twitterGif", - "plausible_ignore", - "ytDub", - "tiktokH265" -] -const bottomPopups = ["error", "download"] - -let store = {}; - -const validLink = (link) => { - try { - return /^https:/i.test(new URL(link).protocol); - } catch { - return false - } -} - -const fixApiUrl = (url) => { - return url.endsWith('/') ? url.slice(0, -1) : url -} - -let apiURL = fixApiUrl(defaultApiUrl); - -const changeApi = (url) => { - apiURL = fixApiUrl(url); - return true -} - -const eid = (id) => { - return document.getElementById(id) -} - -const sGet = (id) =>{ - return localStorage.getItem(id) -} -const sSet = (id, value) => { - localStorage.setItem(id, value) -} -const lazyGet = (key) => { - const value = sGet(key); - if (key in switchers) { - if (switchers[key][0] !== value) - return value; - } else if (checkboxes.includes(key)) { - if (value === 'true') - return true; - } -} - -const changeDownloadButton = (action, text) => { - switch (action) { - case "hidden": // hidden, but only visible when alwaysVisibleButton is true - eid("download-button").disabled = true - if (sGet("alwaysVisibleButton") === "true") { - eid("download-button").value = '>>' - eid("download-button").style.padding = '0 1rem' - } else { - eid("download-button").value = '' - eid("download-button").style.padding = '0' - } - break; - case "disabled": - eid("download-button").disabled = true - eid("download-button").value = text - eid("download-button").style.padding = '0 1rem' - break; - default: - eid("download-button").disabled = false - eid("download-button").value = '>>' - eid("download-button").style.padding = '0 1rem' - break; - } -} - -const button = () => { - let regexTest = validLink(eid("url-input-area").value); - - eid("url-clear").style.display = "none"; - - if ((eid("url-input-area").value).length > 0) { - eid("url-clear").style.display = "block"; - } - - if (regexTest) { - changeDownloadButton() - } else { - changeDownloadButton("hidden") - } -} - -const clearInput = () => { - eid("url-input-area").value = ''; - button(); -} - -const copy = (id, data) => { - let target = document.getElementById(id); - target.classList.add("text-backdrop"); - - setTimeout(() => { - target.classList.remove("text-backdrop") - }, 600); - - if (data) { - navigator.clipboard.writeText(data) - } else { - navigator.clipboard.writeText(target.textContent) - } -} - -const share = url => navigator?.share({ url }).catch(() => {}); - -const preferredColorScheme = () => { - let theme = "auto"; - let localTheme = sGet("theme"); - let isLightPreferred = false; - - if (localTheme) { - theme = localTheme; - } - if (window.matchMedia) { - isLightPreferred = window.matchMedia('(prefers-color-scheme: light)').matches; - } - if (theme === "auto") { - theme = isLightPreferred ? "light" : "dark" - } - - return theme -} - -const changeStatusBarColor = () => { - const theme = preferredColorScheme(); - const colors = { - "dark": "#000000", - "light": "#ffffff", - "dark-popup": "#151515", - "light-popup": "#ebebeb" - } - - let state = store.isPopupOpen ? "dark-popup" : "dark"; - - if (theme === "light") { - state = store.isPopupOpen ? "light-popup" : "light"; - } - - document.querySelector('meta[name="theme-color"]').setAttribute('content', colors[state]); -} -const detectColorScheme = () => { - document.documentElement.setAttribute("data-theme", preferredColorScheme()); - changeStatusBarColor(); -} - -if (window.matchMedia) { - window.matchMedia('(prefers-color-scheme: light)').addEventListener('change', () => { - changeStatusBarColor() - detectColorScheme() - }) -} - -const updateFilenamePreview = () => { - let videoFilePreview = ``; - let audioFilePreview = ``; - let resMatch = { - "max": "3840x2160", - "2160": "3840x2160", - "1440": "2560x1440", - "1080": "1920x1080", - "720": "1280x720", - "480": "854x480", - "360": "640x360", - } - - switch(sGet("filenamePattern")) { - case "classic": - videoFilePreview = `youtube_dQw4w9WgXcQ_${resMatch[sGet('vQuality')]}_${sGet('vCodec')}` - + `${sGet("muteAudio") === "true" ? "_mute" : ""}` - + `.${sGet('vCodec') === "vp9" ? 'webm' : 'mp4'}`; - audioFilePreview = `youtube_dQw4w9WgXcQ_audio` - + `.${sGet('aFormat') !== "best" ? sGet('aFormat') : 'opus'}`; - break; - case "basic": - videoFilePreview = `${loc.FilenamePreviewVideoTitle} ` - + `(${sGet('vQuality') === "max" ? "2160p" : `${sGet('vQuality')}p`}, ` - + `${sGet('vCodec')}${sGet("muteAudio") === "true" ? ", mute" : ""})` - + `.${sGet('vCodec') === "vp9" ? 'webm' : 'mp4'}`; - audioFilePreview = `${loc.FilenamePreviewAudioTitle} - ${loc.FilenamePreviewAudioAuthor}` - + `.${sGet('aFormat') !== "best" ? sGet('aFormat') : 'opus'}`; - break; - case "pretty": - videoFilePreview = `${loc.FilenamePreviewVideoTitle} ` - + `(${sGet('vQuality') === "max" ? "2160p" : `${sGet('vQuality')}p`}, ${sGet('vCodec')}, ` - + `${sGet("muteAudio") === "true" ? "mute, " : ""}youtube)` - + `.${sGet('vCodec') === "vp9" ? 'webm' : 'mp4'}`; - audioFilePreview = `${loc.FilenamePreviewAudioTitle} - ${loc.FilenamePreviewAudioAuthor} (soundcloud)` - + `.${sGet('aFormat') !== "best" ? sGet('aFormat') : 'opus'}`; - break; - case "nerdy": - videoFilePreview = `${loc.FilenamePreviewVideoTitle} ` - + `(${sGet('vQuality') === "max" ? "2160p" : `${sGet('vQuality')}p`}, ${sGet('vCodec')}, ` - + `${sGet("muteAudio") === "true" ? "mute, " : ""}youtube, dQw4w9WgXcQ)` - + `.${sGet('vCodec') === "vp9" ? 'webm' : 'mp4'}`; - audioFilePreview = `${loc.FilenamePreviewAudioTitle} - ${loc.FilenamePreviewAudioAuthor} ` - + `(soundcloud, 1242868615)` - + `.${sGet('aFormat') !== "best" ? sGet('aFormat') : 'opus'}`; - break; - } - eid("video-filename-text").innerHTML = videoFilePreview - eid("audio-filename-text").innerHTML = audioFilePreview -} - -const changeTab = (evnt, tabId, tabClass) => { - if (tabId === "tab-settings-other") updateFilenamePreview(); - - let tabcontent = document.getElementsByClassName(`tab-content-${tabClass}`); - let tablinks = document.getElementsByClassName(`tab-${tabClass}`); - - for (let i = 0; i < tabcontent.length; i++) { - tabcontent[i].dataset.enabled = "false"; - } - for (let i = 0; i < tablinks.length; i++) { - tablinks[i].dataset.enabled = "false"; - } - - evnt.currentTarget.dataset.enabled = "true"; - eid(tabId).dataset.enabled = "true"; - eid(tabId).parentElement.scrollTop = 0; -} - -const expandCollapsible = (evnt) => { - let classlist = evnt.currentTarget.parentNode.classList; - let c = "expanded"; - !classlist.contains(c) ? classlist.add(c) : classlist.remove(c); -} - -const hideAllPopups = () => { - let filter = document.getElementsByClassName('popup'); - for (let i = 0; i < filter.length; i++) { - filter[i].classList.remove("visible"); - } - eid("popup-backdrop").classList.remove("visible"); - store.isPopupOpen = false; - - // clear the picker - eid("picker-holder").innerHTML = ''; - eid("picker-download").href = '/'; - eid("picker-download").classList.remove("visible"); -} - -const popup = (type, action, text) => { - if (action === 1) { - hideAllPopups(); // hide the previous popup before showing a new one - store.isPopupOpen = true; - - // if not a small popup, update status bar color to match the popup header - if (!bottomPopups.includes(type)) changeStatusBarColor(); - switch (type) { - case "about": - let tabId = "about"; - if (text) tabId = text; - eid(`tab-button-${type}-${tabId}`).click(); - break; - case "settings": - eid(`tab-button-${type}-video`).click(); - break; - case "error": - eid("desc-error").innerHTML = text; - break; - case "download": - eid("pd-download").href = text; - eid("pd-copy").setAttribute("onClick", `copy('pd-copy', '${text}')`); - eid("pd-share").setAttribute("onClick", `share('${text}')`); - if (navigator.canShare) eid("pd-share").style.display = "flex"; - break; - case "picker": - eid("picker-title").innerHTML = loc.MediaPickerTitle; - eid("picker-subtitle").innerHTML = isMobile ? loc.MediaPickerExplanationPhone : loc.MediaPickerExplanationPC; - - switch (text.type) { - case "images": - eid("picker-holder").classList.remove("various"); - - eid("picker-download").href = text.audio; - eid("picker-download").classList.add("visible"); - - for (let i in text.arr) { - eid("picker-holder").innerHTML += - `` + - `` + - `` - } - break; - default: - eid("picker-holder").classList.add("various"); - - for (let i in text.arr) { - eid("picker-holder").innerHTML += - `` + - `
${text.arr[i].type}
` + - (text.arr[i].type === 'photo' ? '' : '
') + - `` + - `
` - } - eid("picker-download").classList.remove("visible"); - break; - } - break; - default: - break; - } - } else { - store.isPopupOpen = false; - - // reset status bar to base color - changeStatusBarColor(); - - if (type === "picker") { - eid("picker-download").href = '/'; - eid("picker-download").classList.remove("visible"); - eid("picker-holder").innerHTML = '' - } - } - if (bottomPopups.includes(type)) { - eid(`popup-${type}-container`).classList.toggle("visible"); - } - eid("popup-backdrop").classList.toggle("visible"); - eid(`popup-${type}`).classList.toggle("visible"); - eid(`popup-${type}`).focus(); -} - -const changeSwitcher = (switcher, state) => { - if (state) { - if (!switchers[switcher].includes(state)) { - state = switchers[switcher][0]; - } - sSet(switcher, state); - - for (let i in switchers[switcher]) { - if (switchers[switcher][i] === state) { - eid(`${switcher}-${state}`).dataset.enabled = "true"; - } else { - eid(`${switcher}-${switchers[switcher][i]}`).dataset.enabled = "false"; - } - } - if (switcher === "theme") detectColorScheme(); - if (switcher === "filenamePattern") updateFilenamePreview(); - } else { - let defaultValue = switchers[switcher][0]; - sSet(switcher, defaultValue); - for (let i in switchers[switcher]) { - if (switchers[switcher][i] === defaultValue) { - eid(`${switcher}-${defaultValue}`).dataset.enabled = "true"; - } else { - eid(`${switcher}-${switchers[switcher][i]}`).dataset.enabled = "false"; - } - } - } -} - -const checkbox = (action) => { - sSet(action, !!eid(action).checked); - switch(action) { - case "alwaysVisibleButton": button(); break; - case "reduceTransparency": eid("cobalt-body").classList.toggle('no-transparency'); break; - case "disableAnimations": eid("cobalt-body").classList.toggle('no-animation'); break; - } -} - -const changeButton = (type, text) => { - switch (type) { - case "error": //error - eid("url-input-area").disabled = false - eid("url-clear").style.display = "block"; - changeDownloadButton("disabled", '!!'); - popup("error", 1, text); - setTimeout(() => { changeButton("default") }, 2500); - break; - case "default": //enable back - changeDownloadButton(); - eid("url-clear").style.display = "block"; - eid("url-input-area").disabled = false - break; - case "error-default": //enable back + information popup - popup("error", 1, text); - changeDownloadButton(); - eid("url-clear").style.display = "block"; - eid("url-input-area").disabled = false - break; - } -} - -const internetError = () => { - eid("url-input-area").disabled = false - changeDownloadButton("disabled", '!!'); - setTimeout(() => { changeButton("default") }, 2500); - popup("error", 1, loc.ErrorNoInternet); -} - -const resetSettings = () => { - localStorage.clear(); - window.location.reload(); -} - -const download = async(url) => { - changeDownloadButton("disabled", '...'); - - eid("url-clear").style.display = "none"; - eid("url-input-area").disabled = true; - - let req = { - url, - vCodec: lazyGet("vCodec"), - vQuality: lazyGet("vQuality"), - aFormat: lazyGet("aFormat"), - filenamePattern: lazyGet("filenamePattern"), - isAudioOnly: lazyGet("audioMode"), - isTTFullAudio: lazyGet("fullTikTokAudio"), - isAudioMuted: lazyGet("muteAudio"), - disableMetadata: lazyGet("disableMetadata"), - dubLang: lazyGet("ytDub"), - twitterGif: lazyGet("twitterGif"), - tiktokH265: lazyGet("tiktokH265"), - } - - let j = await fetch(`${apiURL}/api/json`, { - method: "POST", - body: JSON.stringify(req), - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - } - }).then(r => r.json()).catch(() => {}); - - if (!j) { - internetError(); - return; - } - - if ((j.status === "error" || j.status === "rate-limit") && j && j.text) { - changeButton("error", j.text); - return; - } - - if (j.text && (!j.url || !j.picker)) { - if (j.status === "success") { - changeButton("error-default", j.text) - } else { - changeButton("error", loc.ErrorNoUrlReturned); - } - } - switch (j.status) { - case "redirect": - changeDownloadButton("disabled", '>>>'); - setTimeout(() => { changeButton("default") }, 1500); - - if (sGet("downloadPopup") === "true") { - popup('download', 1, j.url) - } else { - window.open(j.url, '_blank') - } - break; - case "stream": - changeDownloadButton("disabled", '?..'); - - let probeStream = await fetch(`${j.url}&p=1`).then(r => r.json()).catch(() => {}); - if (!probeStream) return internetError(); - - if (probeStream.status !== "continue") { - changeButton("error", probeStream.text); - return; - } - - changeDownloadButton("disabled", '>>>'); - if (sGet("downloadPopup") === "true") { - popup('download', 1, j.url) - } else { - if (isMobile || isSafari) { - window.location.href = j.url; - } else { - window.open(j.url, '_blank'); - } - } - setTimeout(() => { changeButton("default") }, 2500); - break; - case "picker": - if (j.audio && j.picker) { - changeDownloadButton("disabled", '>>>'); - popup('picker', 1, { - audio: j.audio, - arr: j.picker, - type: j.pickerType - }); - setTimeout(() => { changeButton("default") }, 2500); - } else if (j.picker) { - changeDownloadButton("disabled", '>>>'); - popup('picker', 1, { - arr: j.picker, - type: j.pickerType - }); - setTimeout(() => { changeButton("default") }, 2500); - } else { - changeButton("error", loc.ErrorNoUrlReturned); - } - break; - case "success": - changeButton("error-default", j.text); - break; - default: - changeButton("error", loc.ErrorUnknownStatus); - break; - } -} - -const pasteClipboard = async() => { - try { - let clipboard = await navigator.clipboard.readText(); - let onlyURL = clipboard.match(/https:\/\/[^\s]+/g) - if (onlyURL) { - eid("url-input-area").value = onlyURL; - download(eid("url-input-area").value); - } - } catch (e) { - let errorMessage = loc.FeatureErrorGeneric; - let doError = true; - let error = String(e).toLowerCase(); - - if (error.includes("denied")) errorMessage = loc.ClipboardErrorNoPermission; - if (error.includes("dismissed") || isIOS) doError = false; - if (error.includes("function") && isFirefox) errorMessage = loc.ClipboardErrorFirefox; - - if (doError) popup("error", 1, errorMessage); - } -} - -const loadCelebrationsEmoji = async() => { - let aboutButtonBackup = eid("about-footer").innerHTML; - try { - let j = await fetch(`/onDemand?blockId=1`).then(r => r.json()).catch(() => {}); - if (j && j.status === "success" && j.text) { - eid("about-footer").innerHTML = eid("about-footer").innerHTML.replace( - `${aboutButtonBackup.split('> ')[0]}>`, - j.text - ) - } - } catch { - eid("about-footer").innerHTML = aboutButtonBackup; - } -} - -const loadOnDemand = async(elementId, blockId) => { - store.historyButton = eid(elementId).innerHTML; - eid(elementId).innerHTML = `
...
`; - - try { - if (!store.historyContent) { - let j = await fetch(`/onDemand?blockId=${blockId}`).then(r => r.json()).catch(() => {}); - if (!j) throw new Error(); - - if (j.status === "success") { - store.historyContent = j.text - } - } - eid(elementId).innerHTML = - ` - ${store.historyContent}`; - } catch { - eid(elementId).innerHTML = store.historyButton; - internetError() - } -} - -const restoreUpdateHistory = () => { - eid("changelog-history").innerHTML = store.historyButton; -} - -const loadSettings = () => { - if (sGet("alwaysVisibleButton") === "true") { - eid("alwaysVisibleButton").checked = true; - eid("download-button").value = '>>' - eid("download-button").style.padding = '0 1rem'; - } - if (sGet("downloadPopup") === "true" && !isIOS) { - eid("downloadPopup").checked = true; - } - if (sGet("reduceTransparency") === "true" || isOldFirefox) { - eid("cobalt-body").classList.add('no-transparency'); - } - if (sGet("disableAnimations") === "true") { - eid("cobalt-body").classList.add('no-animation'); - } - if (!isMobile) { - eid("cobalt-body").classList.add('desktop'); - } - if (isAndroid) { - eid("cobalt-body").classList.add('android'); - } - if (isIOS) { - eid("download-switcher") - .querySelector(".explanation") - .innerHTML = loc.DownloadPopupDescriptionIOS; - } - for (let i = 0; i < checkboxes.length; i++) { - try { - if (sGet(checkboxes[i]) === "true") eid(checkboxes[i]).checked = true; - } - catch { - console.error(`checkbox ${checkboxes[i]} failed to initialize`) - } - } - for (let i in switchers) { - changeSwitcher(i, sGet(i)) - } - updateFilenamePreview() -} - -window.onload = () => { - loadCelebrationsEmoji(); - - loadSettings(); - detectColorScheme(); - - changeDownloadButton("hidden"); - eid("url-input-area").value = ""; - - if (isIOS) { - sSet("downloadPopup", "true"); - eid("downloadPopup-chkbx").style.display = "none"; - } - - eid("home").style.visibility = 'visible'; - eid("home").classList.toggle("visible"); - - const pageQuery = new URLSearchParams(window.location.search); - if (pageQuery.has("u") && validLink(pageQuery.get("u"))) { - eid("url-input-area").value = pageQuery.get("u"); - button() - } - window.history.replaceState(null, '', window.location.pathname); - - // fix for animations not working in Safari - if (isIOS) { - document.addEventListener('touchstart', () => {}, true); - } -} - -eid("url-input-area").addEventListener("keydown", () => { - button(); -}) -eid("url-input-area").addEventListener("keyup", (e) => { - if (e.key === 'Enter') eid("download-button").click(); -}) - -document.addEventListener("keydown", (event) => { - if (event.key === "Tab") { - eid("download-button").value = '>>' - eid("download-button").style.padding = '0 1rem' - } -}) -document.onkeydown = (e) => { - if (!store.isPopupOpen) { - if (e.metaKey || e.ctrlKey || e.key === "/") eid("url-input-area").focus(); - if (e.key === "Escape" || e.key === "Clear") clearInput(); - - if (e.target === eid("url-input-area")) return; - - // top buttons - if (e.key === "D") pasteClipboard(); - if (e.key === "K") changeSwitcher('audioMode', 'false'); - if (e.key === "L") changeSwitcher('audioMode', 'true'); - - // popups - if (e.key === "B") popup('about', 1, 'about'); // open about - if (e.key === "N") popup('about', 1, 'changelog'); // open changelog - if (e.key === "M") popup('settings', 1); - - } else { - if (e.key === "Escape") hideAllPopups(); - } -} diff --git a/api/src/front/emoji/3d/film_frames.png b/api/src/front/emoji/3d/film_frames.png deleted file mode 100644 index 6522c5f7..00000000 Binary files a/api/src/front/emoji/3d/film_frames.png and /dev/null differ diff --git a/api/src/front/emoji/3d/headphone.png b/api/src/front/emoji/3d/headphone.png deleted file mode 100644 index b46173a2..00000000 Binary files a/api/src/front/emoji/3d/headphone.png and /dev/null differ diff --git a/api/src/front/emoji/abacus.svg b/api/src/front/emoji/abacus.svg deleted file mode 100644 index 6f9587c4..00000000 --- a/api/src/front/emoji/abacus.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/alien_monster.svg b/api/src/front/emoji/alien_monster.svg deleted file mode 100644 index 66be00bd..00000000 --- a/api/src/front/emoji/alien_monster.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/biceps.svg b/api/src/front/emoji/biceps.svg deleted file mode 100644 index 4de9e74e..00000000 --- a/api/src/front/emoji/biceps.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/api/src/front/emoji/bird.svg b/api/src/front/emoji/bird.svg deleted file mode 100644 index 55cf0208..00000000 --- a/api/src/front/emoji/bird.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/api/src/front/emoji/boring_document.svg b/api/src/front/emoji/boring_document.svg deleted file mode 100644 index ec3e642f..00000000 --- a/api/src/front/emoji/boring_document.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/bubbles.svg b/api/src/front/emoji/bubbles.svg deleted file mode 100644 index e5bccc36..00000000 --- a/api/src/front/emoji/bubbles.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/api/src/front/emoji/cake.svg b/api/src/front/emoji/cake.svg deleted file mode 100644 index c6de34d4..00000000 --- a/api/src/front/emoji/cake.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/api/src/front/emoji/candle.svg b/api/src/front/emoji/candle.svg deleted file mode 100644 index f62a93d3..00000000 --- a/api/src/front/emoji/candle.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/api/src/front/emoji/cat.svg b/api/src/front/emoji/cat.svg deleted file mode 100644 index a29d581e..00000000 --- a/api/src/front/emoji/cat.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/api/src/front/emoji/cat_crying.svg b/api/src/front/emoji/cat_crying.svg deleted file mode 100644 index 896ae898..00000000 --- a/api/src/front/emoji/cat_crying.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/cat_flabbergasted.svg b/api/src/front/emoji/cat_flabbergasted.svg deleted file mode 100644 index 92f72427..00000000 --- a/api/src/front/emoji/cat_flabbergasted.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/cat_grin.svg b/api/src/front/emoji/cat_grin.svg deleted file mode 100644 index 4b7cbb06..00000000 --- a/api/src/front/emoji/cat_grin.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/cat_smile.svg b/api/src/front/emoji/cat_smile.svg deleted file mode 100644 index 06ff249c..00000000 --- a/api/src/front/emoji/cat_smile.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/christmas_tree.svg b/api/src/front/emoji/christmas_tree.svg deleted file mode 100644 index dead8216..00000000 --- a/api/src/front/emoji/christmas_tree.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/api/src/front/emoji/clapper_board.svg b/api/src/front/emoji/clapper_board.svg deleted file mode 100644 index 8bcf482b..00000000 --- a/api/src/front/emoji/clapper_board.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/api/src/front/emoji/clipboard.svg b/api/src/front/emoji/clipboard.svg deleted file mode 100644 index b4d28229..00000000 --- a/api/src/front/emoji/clipboard.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/api/src/front/emoji/crystal_ball.svg b/api/src/front/emoji/crystal_ball.svg deleted file mode 100644 index d2a7f670..00000000 --- a/api/src/front/emoji/crystal_ball.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/api/src/front/emoji/dog.svg b/api/src/front/emoji/dog.svg deleted file mode 100644 index 03056a1f..00000000 --- a/api/src/front/emoji/dog.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/api/src/front/emoji/dragon_face.svg b/api/src/front/emoji/dragon_face.svg deleted file mode 100644 index 861ae074..00000000 --- a/api/src/front/emoji/dragon_face.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/api/src/front/emoji/dragon_face_wukko.svg b/api/src/front/emoji/dragon_face_wukko.svg deleted file mode 100644 index c389f4c8..00000000 --- a/api/src/front/emoji/dragon_face_wukko.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/api/src/front/emoji/elephant.svg b/api/src/front/emoji/elephant.svg deleted file mode 100644 index 3f96a89a..00000000 --- a/api/src/front/emoji/elephant.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/api/src/front/emoji/email.svg b/api/src/front/emoji/email.svg deleted file mode 100644 index 144c9534..00000000 --- a/api/src/front/emoji/email.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/film_frames.svg b/api/src/front/emoji/film_frames.svg deleted file mode 100644 index 7471d431..00000000 --- a/api/src/front/emoji/film_frames.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/api/src/front/emoji/gear.svg b/api/src/front/emoji/gear.svg deleted file mode 100644 index 8351a33a..00000000 --- a/api/src/front/emoji/gear.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/api/src/front/emoji/headphone.svg b/api/src/front/emoji/headphone.svg deleted file mode 100644 index 1c9b6702..00000000 --- a/api/src/front/emoji/headphone.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/keyboard.svg b/api/src/front/emoji/keyboard.svg deleted file mode 100644 index f6cb218b..00000000 --- a/api/src/front/emoji/keyboard.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/api/src/front/emoji/link.svg b/api/src/front/emoji/link.svg deleted file mode 100644 index c3d86605..00000000 --- a/api/src/front/emoji/link.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/api/src/front/emoji/locked.svg b/api/src/front/emoji/locked.svg deleted file mode 100644 index 98e9e0e7..00000000 --- a/api/src/front/emoji/locked.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/loudspeaker.svg b/api/src/front/emoji/loudspeaker.svg deleted file mode 100644 index 6acd5873..00000000 --- a/api/src/front/emoji/loudspeaker.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/api/src/front/emoji/magic_wand.svg b/api/src/front/emoji/magic_wand.svg deleted file mode 100644 index b10883b6..00000000 --- a/api/src/front/emoji/magic_wand.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/api/src/front/emoji/magnifying_glass.svg b/api/src/front/emoji/magnifying_glass.svg deleted file mode 100644 index 905da556..00000000 --- a/api/src/front/emoji/magnifying_glass.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/mailbox.svg b/api/src/front/emoji/mailbox.svg deleted file mode 100644 index 5dfd70b5..00000000 --- a/api/src/front/emoji/mailbox.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/api/src/front/emoji/mending_heart.svg b/api/src/front/emoji/mending_heart.svg deleted file mode 100644 index 3b647fa7..00000000 --- a/api/src/front/emoji/mending_heart.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/money_with_wings.svg b/api/src/front/emoji/money_with_wings.svg deleted file mode 100644 index 56d0cb0c..00000000 --- a/api/src/front/emoji/money_with_wings.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/api/src/front/emoji/musical_notes.svg b/api/src/front/emoji/musical_notes.svg deleted file mode 100644 index f66414f0..00000000 --- a/api/src/front/emoji/musical_notes.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/api/src/front/emoji/newspaper.svg b/api/src/front/emoji/newspaper.svg deleted file mode 100644 index ebe0b5fd..00000000 --- a/api/src/front/emoji/newspaper.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/octopus.svg b/api/src/front/emoji/octopus.svg deleted file mode 100644 index b8c6e906..00000000 --- a/api/src/front/emoji/octopus.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/api/src/front/emoji/party_popper.svg b/api/src/front/emoji/party_popper.svg deleted file mode 100644 index 93113d0f..00000000 --- a/api/src/front/emoji/party_popper.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/api/src/front/emoji/pinata.svg b/api/src/front/emoji/pinata.svg deleted file mode 100644 index cf260701..00000000 --- a/api/src/front/emoji/pinata.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/api/src/front/emoji/pumpkin.svg b/api/src/front/emoji/pumpkin.svg deleted file mode 100644 index 3dcf031a..00000000 --- a/api/src/front/emoji/pumpkin.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/api/src/front/emoji/question_mark.svg b/api/src/front/emoji/question_mark.svg deleted file mode 100644 index 3c7e887a..00000000 --- a/api/src/front/emoji/question_mark.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/api/src/front/emoji/sparkles.svg b/api/src/front/emoji/sparkles.svg deleted file mode 100644 index e9702d09..00000000 --- a/api/src/front/emoji/sparkles.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/api/src/front/emoji/sparkling_heart.svg b/api/src/front/emoji/sparkling_heart.svg deleted file mode 100644 index b5dd6eb2..00000000 --- a/api/src/front/emoji/sparkling_heart.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/api/src/front/emoji/wrench.svg b/api/src/front/emoji/wrench.svg deleted file mode 100644 index b186d3b3..00000000 --- a/api/src/front/emoji/wrench.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/api/src/front/fonts/files/notosansmono_3dVQ.woff2 b/api/src/front/fonts/files/notosansmono_3dVQ.woff2 deleted file mode 100644 index 1174c362..00000000 Binary files a/api/src/front/fonts/files/notosansmono_3dVQ.woff2 and /dev/null differ diff --git a/api/src/front/fonts/files/notosansmono_7dVXQQ.woff2 b/api/src/front/fonts/files/notosansmono_7dVXQQ.woff2 deleted file mode 100644 index e9fcb07d..00000000 Binary files a/api/src/front/fonts/files/notosansmono_7dVXQQ.woff2 and /dev/null differ diff --git a/api/src/front/fonts/files/notosansmono_DdVXQQ.woff2 b/api/src/front/fonts/files/notosansmono_DdVXQQ.woff2 deleted file mode 100644 index 28bca6ff..00000000 Binary files a/api/src/front/fonts/files/notosansmono_DdVXQQ.woff2 and /dev/null differ diff --git a/api/src/front/fonts/files/notosansmono_HdVXQQ.woff2 b/api/src/front/fonts/files/notosansmono_HdVXQQ.woff2 deleted file mode 100644 index 95050fe6..00000000 Binary files a/api/src/front/fonts/files/notosansmono_HdVXQQ.woff2 and /dev/null differ diff --git a/api/src/front/fonts/files/notosansmono_LdVXQQ.woff2 b/api/src/front/fonts/files/notosansmono_LdVXQQ.woff2 deleted file mode 100644 index 137ea72c..00000000 Binary files a/api/src/front/fonts/files/notosansmono_LdVXQQ.woff2 and /dev/null differ diff --git a/api/src/front/fonts/files/notosansmono_PdVXQQ.woff2 b/api/src/front/fonts/files/notosansmono_PdVXQQ.woff2 deleted file mode 100644 index e3267a5e..00000000 Binary files a/api/src/front/fonts/files/notosansmono_PdVXQQ.woff2 and /dev/null differ diff --git a/api/src/front/fonts/files/notosansmono_ndVXQQ.woff2 b/api/src/front/fonts/files/notosansmono_ndVXQQ.woff2 deleted file mode 100644 index bb374b0a..00000000 Binary files a/api/src/front/fonts/files/notosansmono_ndVXQQ.woff2 and /dev/null differ diff --git a/api/src/front/fonts/notosansmono.css b/api/src/front/fonts/notosansmono.css deleted file mode 100644 index 827b4f61..00000000 --- a/api/src/front/fonts/notosansmono.css +++ /dev/null @@ -1 +0,0 @@ -@font-face{font-family:'Noto Sans Mono';font-style:normal;font-weight:500;font-stretch:100%;font-display:swap;src:url('files/notosansmono_DdVXQQ.woff2') format('woff2');unicode-range:U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F}@font-face{font-family:'Noto Sans Mono';font-style:normal;font-weight:500;font-stretch:100%;font-display:swap;src:url('files/notosansmono_ndVXQQ.woff2') format('woff2');unicode-range:U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116}@font-face{font-family:'Noto Sans Mono';font-style:normal;font-weight:500;font-stretch:100%;font-display:swap;src:url('files/notosansmono_HdVXQQ.woff2') format('woff2');unicode-range:U+1F00-1FFF}@font-face{font-family:'Noto Sans Mono';font-style:normal;font-weight:500;font-stretch:100%;font-display:swap;src:url('files/notosansmono_7dVXQQ.woff2') format('woff2');unicode-range:U+0370-03FF}@font-face{font-family:'Noto Sans Mono';font-style:normal;font-weight:500;font-stretch:100%;font-display:swap;src:url('files/notosansmono_LdVXQQ.woff2') format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB}@font-face{font-family:'Noto Sans Mono';font-style:normal;font-weight:500;font-stretch:100%;font-display:swap;src:url('files/notosansmono_PdVXQQ.woff2') format('woff2');unicode-range:U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF}@font-face{font-family:'Noto Sans Mono';font-style:normal;font-weight:500;font-stretch:100%;font-display:swap;src:url('files/notosansmono_3dVQ.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD} \ No newline at end of file diff --git a/api/src/front/icons/android-chrome-192x192.png b/api/src/front/icons/android-chrome-192x192.png deleted file mode 100644 index 0d3ac83a..00000000 Binary files a/api/src/front/icons/android-chrome-192x192.png and /dev/null differ diff --git a/api/src/front/icons/android-chrome-512x512.png b/api/src/front/icons/android-chrome-512x512.png deleted file mode 100644 index d1777d48..00000000 Binary files a/api/src/front/icons/android-chrome-512x512.png and /dev/null differ diff --git a/api/src/front/icons/apple-touch-icon.png b/api/src/front/icons/apple-touch-icon.png deleted file mode 100644 index b2abfa63..00000000 Binary files a/api/src/front/icons/apple-touch-icon.png and /dev/null differ diff --git a/api/src/front/icons/favicon-16x16.png b/api/src/front/icons/favicon-16x16.png deleted file mode 100644 index 94f9c1a9..00000000 Binary files a/api/src/front/icons/favicon-16x16.png and /dev/null differ diff --git a/api/src/front/icons/favicon-32x32.png b/api/src/front/icons/favicon-32x32.png deleted file mode 100644 index b4e9203f..00000000 Binary files a/api/src/front/icons/favicon-32x32.png and /dev/null differ diff --git a/api/src/front/icons/favicon.ico b/api/src/front/icons/favicon.ico deleted file mode 100644 index 1b08e4bb..00000000 Binary files a/api/src/front/icons/favicon.ico and /dev/null differ diff --git a/api/src/front/icons/generic.png b/api/src/front/icons/generic.png deleted file mode 100644 index d1777d48..00000000 Binary files a/api/src/front/icons/generic.png and /dev/null differ diff --git a/api/src/front/icons/maskable/128.png b/api/src/front/icons/maskable/128.png deleted file mode 100644 index e8213cfe..00000000 Binary files a/api/src/front/icons/maskable/128.png and /dev/null differ diff --git a/api/src/front/icons/maskable/192.png b/api/src/front/icons/maskable/192.png deleted file mode 100644 index 8268d89a..00000000 Binary files a/api/src/front/icons/maskable/192.png and /dev/null differ diff --git a/api/src/front/icons/maskable/384.png b/api/src/front/icons/maskable/384.png deleted file mode 100644 index 483e42ff..00000000 Binary files a/api/src/front/icons/maskable/384.png and /dev/null differ diff --git a/api/src/front/icons/maskable/48.png b/api/src/front/icons/maskable/48.png deleted file mode 100644 index 02a5bca0..00000000 Binary files a/api/src/front/icons/maskable/48.png and /dev/null differ diff --git a/api/src/front/icons/maskable/512.png b/api/src/front/icons/maskable/512.png deleted file mode 100644 index bb4af2f3..00000000 Binary files a/api/src/front/icons/maskable/512.png and /dev/null differ diff --git a/api/src/front/icons/maskable/72.png b/api/src/front/icons/maskable/72.png deleted file mode 100644 index 903f6bd5..00000000 Binary files a/api/src/front/icons/maskable/72.png and /dev/null differ diff --git a/api/src/front/icons/maskable/96.png b/api/src/front/icons/maskable/96.png deleted file mode 100644 index c4b1ae60..00000000 Binary files a/api/src/front/icons/maskable/96.png and /dev/null differ diff --git a/api/src/front/icons/pattern.png b/api/src/front/icons/pattern.png deleted file mode 100644 index dfaef1c8..00000000 Binary files a/api/src/front/icons/pattern.png and /dev/null differ diff --git a/api/src/front/manifest.webmanifest b/api/src/front/manifest.webmanifest deleted file mode 100644 index 3777ca6d..00000000 --- a/api/src/front/manifest.webmanifest +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "cobalt", - "short_name": "cobalt", - "start_url": "/", - "icons": [ - { - "src": "/icons/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/icons/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "/icons/generic.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "any" - }, - { - "src": "/icons/maskable/48.png", - "sizes": "48x48", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/icons/maskable/72.png", - "sizes": "72x72", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/icons/maskable/96.png", - "sizes": "96x96", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/icons/maskable/128.png", - "sizes": "128x128", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/icons/maskable/192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/icons/maskable/384.png", - "sizes": "384x384", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/icons/maskable/512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - } - ], - "share_target": { - "action": "/", - "params": { - "text": "u", - "url": "u" - } - }, - "theme_color": "#000000", - "background_color": "#000000", - "display": "standalone" -} diff --git a/api/src/front/robots.txt b/api/src/front/robots.txt deleted file mode 100644 index a5218222..00000000 --- a/api/src/front/robots.txt +++ /dev/null @@ -1,8 +0,0 @@ -User-Agent: * -Disallow: /emoji/ -Disallow: /fonts/ -Disallow: /icons/ -Disallow: /sponsors/ -Disallow: /updateBanners/ -Disallow: /*.js -Disallow: /*.css diff --git a/api/src/front/sponsors/royale.svg b/api/src/front/sponsors/royale.svg deleted file mode 100644 index c0338038..00000000 --- a/api/src/front/sponsors/royale.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/api/src/modules/build.js b/api/src/modules/build.js deleted file mode 100644 index a4c4aa6b..00000000 --- a/api/src/modules/build.js +++ /dev/null @@ -1,41 +0,0 @@ -import * as esbuild from "esbuild"; -import * as fs from "fs"; -import { loadLoc, languageList } from "../localization/manager.js"; -import { cleanHTML } from "./sub/utils.js"; - -import page from "./pageRender/page.js"; - -export async function buildFront(commitHash, branch) { - try { - // preload localization files - await loadLoc(); - - // build html - if (!fs.existsSync('./build/')){ - fs.mkdirSync('./build/'); - } - // get rid of old build path - if (fs.existsSync('./min')) { - fs.rmSync('./min', { recursive: true, force: true }); - } - for (let i in languageList) { - i = languageList[i]; - let params = { - "hash": commitHash, - "lang": i, - "branch": branch - } - fs.writeFileSync(`./build/${i}.html`, cleanHTML(page(params))); - } - // build js & css - await esbuild.build({ - entryPoints: ['src/front/cobalt.js', 'src/front/cobalt.css'], - outdir: 'build/min/', - minify: true, - loader: { '.js': 'js', '.css': 'css', }, - charset: 'utf8' - }) - } catch { - return; - } -} diff --git a/api/src/modules/buildStatic.js b/api/src/modules/buildStatic.js deleted file mode 100644 index d3ed909f..00000000 --- a/api/src/modules/buildStatic.js +++ /dev/null @@ -1,7 +0,0 @@ -import { buildFront } from "./build.js"; -import { getCurrentBranch, shortCommit } from "./sub/currentCommit.js"; - -const commitHash = shortCommit(); -const branch = getCurrentBranch(); - -await buildFront(commitHash, branch); diff --git a/api/src/modules/changelog/changelogManager.js b/api/src/modules/changelog/changelogManager.js deleted file mode 100644 index b8763fb5..00000000 --- a/api/src/modules/changelog/changelogManager.js +++ /dev/null @@ -1,46 +0,0 @@ -import { replaceBase } from "../../localization/manager.js"; -import { loadJSON } from "../sub/loadFromFs.js"; - -let changelog = loadJSON('./src/modules/changelog/changelog.json') - -export default function(string) { - try { - const currentChangelog = changelog.current; - - switch (string) { - case "version": - return `v.${currentChangelog.version}${ - currentChangelog.date ? `ยท ${currentChangelog.date}` : '' - }` - case "title": - return replaceBase(currentChangelog.title); - case "banner": - const currentBanner = changelog.current.banner; - return currentBanner ? { - ...currentBanner, - url: `updateBanners/${currentBanner.file}` - } : false; - case "content": - return replaceBase(currentChangelog.content); - case "history": - return changelog.history.map((log) => { - const banner = log.banner; - return { - title: replaceBase(log.title), - version: `v.${log.version}${ - log.date ? `ยท ${log.date}` : '' - }`, - content: replaceBase(log.content), - banner: banner ? { - ...banner, - url: `updateBanners/${banner.file}` - } : false, - } - }); - default: - return replaceBase(changelog[string]) - } - } catch (e) { - return `!!CHANGELOG_${string}!!` - } -} diff --git a/api/src/modules/emoji.js b/api/src/modules/emoji.js deleted file mode 100644 index 82273ac4..00000000 --- a/api/src/modules/emoji.js +++ /dev/null @@ -1,66 +0,0 @@ -const names = { - "๐ŸŽถ": "musical_notes", - "๐ŸŽฌ": "clapper_board", - "๐ŸŽ‰": "party_popper", - "โ“": "question_mark", - "โœจ": "sparkles", - "๐Ÿช…": "pinata", - "๐Ÿช„": "magic_wand", - "๐Ÿฒ": "dragon_face", - "๐Ÿ€„": "dragon_face_wukko", - "๐Ÿ’ธ": "money_with_wings", - "โš™๏ธ": "gear", - "๐Ÿ“‹": "clipboard", - "๐ŸŽƒ": "pumpkin", - "๐ŸŽ„": "christmas_tree", - "๐Ÿ•ฏ๏ธ": "candle", - "๐Ÿ˜บ": "cat", - "๐Ÿถ": "dog", - "๐ŸŽ‚": "cake", - "๐Ÿ˜": "elephant", - "๐Ÿฆ": "bird", - "๐Ÿ™": "octopus", - "๐Ÿ”ฎ": "crystal_ball", - "๐Ÿ’ช": "biceps", - "๐Ÿ’–": "sparkling_heart", - "๐Ÿ‘พ": "alien_monster", - "๐Ÿ˜ฟ": "cat_crying", - "๐Ÿ™€": "cat_flabbergasted", - "๐Ÿฑ": "cat_smile", - "โค๏ธโ€๐Ÿฉน": "mending_heart", - "๐Ÿ”’": "locked", - "๐Ÿ”": "magnifying_glass", - "๐Ÿ”—": "link", - "โŒจ": "keyboard", - "๐Ÿ“‘": "boring_document", - "๐Ÿงฎ": "abacus", - "๐Ÿ˜ธ": "cat_grin", - "๐Ÿ“ฐ": "newspaper", - "๐ŸŽž๏ธ": "film_frames", - "๐ŸŽง": "headphone", - "๐Ÿ“ง": "email", - "๐Ÿ“ฌ": "mailbox", - "๐Ÿ“ข": "loudspeaker", - "๐Ÿ”ง": "wrench", - "๐Ÿซง": "bubbles" -} -let sizing = { - 18: 0.8, - 22: 0.4, - 30: 0.7, - 32: 0.8, - 48: 0.9, - 64: 0.9, - 78: 0.9 -} -export default function(emoji, size, disablePadding, fluent) { - if (!size) size = 22; - let padding = size !== 22 ? `margin-right:${sizing[size] ? sizing[size] : "0.4"}rem;` : false; - if (disablePadding) padding = 'margin-right:0!important;'; - - if (!names[emoji]) emoji = "โ“"; - - let filePath = `emoji/${names[emoji]}.svg`; - if (fluent) filePath = `emoji/3d/${names[emoji]}.png`; - return `` -} diff --git a/api/src/modules/pageRender/elements.js b/api/src/modules/pageRender/elements.js deleted file mode 100644 index ae14cd88..00000000 --- a/api/src/modules/pageRender/elements.js +++ /dev/null @@ -1,270 +0,0 @@ -import { authorInfo, celebrations, sponsors, env } from "../config.js"; -import emoji from "../emoji.js"; -import { loadFile } from "../sub/loadFromFs.js"; - -export const backButtonSVG = ` - -` - -export const dropdownSVG = ` - -` - -export const linkSVG = '' - -export function switcher(obj) { - let items = ``; - if (obj.name === "download") { - items = obj.items; - } else { - for (let i = 0; i < obj.items.length; i++) { - let classes = obj.items[i]["classes"] ? obj.items[i]["classes"] : []; - items += `` - } - } - - if (obj.noParent) return `
${items}
`; - return `
- ${obj.subtitle ? `
${obj.subtitle}
` : ``} -
${items}
- ${obj.explanation ? `
${obj.explanation}
` : ``} -
` -} -export function checkbox(obj) { - let paddings = ["bottom-margin", "top-margin", "no-margin", "top-margin-only"]; - let checkboxes = ``; - for (let i = 0; i < obj.length; i++) { - let paddingClass = obj[i].padding && paddings.includes(obj[i].padding) ? ` ${obj[i].padding}` : ''; - - checkboxes += `` - } - return checkboxes -} -export function sep(paddingType) { - let paddingClass = `` - switch(paddingType) { - case 0: - paddingClass += ` top-margin`; - break; - } - return `
` -} -export function popup(obj) { - let classes = obj.classes ? obj.classes : []; - let body = obj.body; - if (Array.isArray(obj.body)) { - body = `` - for (let i = 0; i < obj.body.length; i++) { - if (obj.body[i]["text"].length > 0) { - classes = obj.body[i]["classes"] ?? [] - if (i !== obj.body.length - 1 && !obj.body[i]["nopadding"]) { - classes.push("desc-padding") - } - body += obj.body[i]["raw"] ? obj.body[i]["text"] : `
${obj.body[i]["text"]}
` - } - } - } - return ` - ${obj.standalone ? `` : ''}` -} - -export function multiPagePopup(obj) { - let tabs = ` - `; - - let tabContent = ``; - for (let i = 0; i < obj.tabs.length; i++) { - tabs += `` - tabContent += `` - } - - return ` - ` -} -export function collapsibleList(arr) { - let items = ``; - - for (let i = 0; i < arr.length; i++) { - let classes = arr[i]["classes"] ? arr[i]["classes"] : []; - items += `
-
-
${arr[i]["title"]}
-
${dropdownSVG}
-
-
${arr[i]["body"]}
-
` - } - return items; -} -export function popupWithBottomButtons(obj) { - let tabs = ` - ` - - for (let i = 0; i < obj.buttons.length; i++) { - tabs += obj.buttons[i] - } - return ` - ` -} -export function socialLink(emji, name, url) { - return `` -} -export function socialLinks(lang) { - let links = authorInfo.support[lang] ? authorInfo.support[lang] : authorInfo.support.default; - let r = ``; - for (let i in links) { - r += socialLink( - emoji(links[i].emoji), links[i].name, links[i].url - ) - } - return r -} -export function settingsCategory(obj) { - return `
-
${obj.title ?? obj.name}
-
${obj.body}
-
` -} - -export function footerButtons(obj) { - let items = `` - for (let i = 0; i < obj.length; i++) { - let buttonName = obj[i]["context"] ? `${obj[i]["name"]}-${obj[i]["context"]}` : obj[i]["name"], - context = obj[i]["context"] ? `, '${obj[i]["context"]}'` : '', - buttonName2, - context2; - - if (obj[i + 1]) { - buttonName2 = obj[i + 1]["context"] ? `${obj[i + 1]["name"]}-${obj[i + 1]["context"]}` : obj[i + 1]["name"]; - context2 = obj[i + 1]["context"] ? `, '${obj[i + 1]["context"]}'` : ''; - } - - items += - ``; - i++; - } - return ` - ` -} -export function explanation(text) { - return `
${text}
` -} -export function celebrationsEmoji() { - try { - let n = new Date().toISOString().split('T')[0].split('-'); - let dm = `${n[1]}-${n[2]}`; - let f = Object.keys(celebrations).includes(dm) ? celebrations[dm] : "๐Ÿฒ"; - return f != "๐Ÿฒ" ? emoji(f, 22) : false; - } catch (e) { - return false - } -} -export function urgentNotice(obj) { - if (obj.visible) { - return `
` + - `${emoji(obj.emoji, 18)} ${obj.text}` + - `
` - } - return `` -} -export function keyboardShortcuts(arr) { - let base = `
`; - - for (let i = 0; i < arr.length; i++) { - base += `
`; - for (let c = 0; c < arr[i].items.length; c++) { - let combo = arr[i].items[c].combo.split('+').map( - key => `${key}` - ).join("+") - base += `
${combo}: ${arr[i].items[c].name}
` - } - base += `
` - } - base += `
`; - - return base; -} -export function webLoc(t, arr) { - let base = ``; - for (let i = 0; i < arr.length; i++) { - base += `${arr[i]}:` + "`" + t(arr[i]) + "`" + `,` - } - 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 `` -} - -export function betaTag() { - return env.isBeta ? 'ฮฒ' : '' -} diff --git a/api/src/modules/pageRender/findRendered.js b/api/src/modules/pageRender/findRendered.js deleted file mode 100644 index 1cbb01aa..00000000 --- a/api/src/modules/pageRender/findRendered.js +++ /dev/null @@ -1,6 +0,0 @@ -import { languageList } from "../../localization/manager.js"; - -export default function(lang) { - let language = languageList.includes(lang) ? lang : "en"; - return `/build/${language}.html`; -} diff --git a/api/src/modules/pageRender/onDemand.js b/api/src/modules/pageRender/onDemand.js deleted file mode 100644 index 7667708f..00000000 --- a/api/src/modules/pageRender/onDemand.js +++ /dev/null @@ -1,33 +0,0 @@ -import changelogManager from "../changelog/changelogManager.js" -import { cleanHTML } from "../sub/utils.js"; - -let cache = {} - -export function changelogHistory() { // blockId 0 - if (cache['0']) return cache['0']; - let history = changelogManager("history"); - let render = ``; - - let historyLen = history.length; - for (let i in history) { - let separator = (i !== 0 && i !== historyLen) ? '
' : ''; - - render += ` - ${separator}${history[i]["banner"] ? - `
- `+ - ` -
` : ''} - - - ` - } - render = cleanHTML(render); - cache['0'] = render; - return render; -} diff --git a/api/src/modules/pageRender/page.js b/api/src/modules/pageRender/page.js deleted file mode 100644 index 2c166177..00000000 --- a/api/src/modules/pageRender/page.js +++ /dev/null @@ -1,666 +0,0 @@ -import { services as s, version, repo, donations, supportedAudio, links, env } from "../config.js"; -import { getCommitInfo } from "../sub/currentCommit.js"; -import loc from "../../localization/manager.js"; -import emoji from "../emoji.js"; -import changelogManager from "../changelog/changelogManager.js"; - -import { - checkbox, - collapsibleList, - explanation, - footerButtons, - multiPagePopup, - popup, - popupWithBottomButtons, - sep, - settingsCategory, - switcher, - socialLink, - socialLinks, - urgentNotice, - keyboardShortcuts, - webLoc, - sponsoredList, - betaTag, - linkSVG -} from "./elements.js"; - -let com = getCommitInfo(); - -let enabledServices = Object.keys(s).filter(p => s[p].enabled).sort().map((p) => { - return `
• ${s[p].alias ? s[p].alias : p}` -}).join('').substring(4) - -let donate = `` -let donateLinks = `` -let audioFormats = supportedAudio.map((p) => { - return { "action": p } -}) -audioFormats.unshift({ "action": "best" }) -for (let i in donations["links"]) { - donateLinks += `REPLACEME ${i}` -} -let extr = '' -for (let i in donations["crypto"]) { - donate += `
${i} (REPLACEME)
${donations["crypto"][i]}
` - extr = ' top-margin' -} - -export default function(obj) { - const t = (str, replace) => { - return loc(obj.lang, str, replace) - } - - audioFormats[0]["text"] = t('SettingsAudioFormatBest'); - - try { - return ` - - - - - - - ${t("AppTitleCobalt")} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${env.plausibleHostname ? - `` - : ''} - - - - ${multiPagePopup({ - name: "about", - closeAria: t('AccessibilityGoBack'), - tabs: [{ - name: "about", - title: `${emoji("๐Ÿฒ")} ${t('AboutTab')}`, - content: popup({ - name: "about", - header: { - aboveTitle: { - text: t('MadeWithLove'), - url: repo - }, - closeAria: t('AccessibilityGoBack'), - title: `${emoji("๐Ÿ”ฎ", 30)} ${t('TitlePopupAbout')}` - }, - body: [{ - text: t('AboutSummary') - }, { - text: collapsibleList([{ - name: "services", - title: `${emoji("๐Ÿ”—")} ${t("CollapseServices")}`, - body: `${enabledServices}` - + `
${t("SupportNotAffiliated")}` - + `${obj.lang === "ru" ? `
${t("SupportMetaNoticeRU")}` : ''}` - + `
` - + `${t("ServicesNote")}` - }, { - name: "keyboard", - title: `${emoji("โŒจ")} ${t("CollapseKeyboard")}`, - body: - `${t("KeyboardShortcutsIntro")} - ${keyboardShortcuts([{ - items: [{ - combo: "Shift+D", - name: t("PasteFromClipboard") - }, { - combo: "Shift+K", - name: t("ModeToggleAuto") - }, { - combo: "Shift+L", - name: t("ModeToggleAudio") - }] - }, { - items: [{ - combo: "โŒ˜/Ctrl+V", - name: t("KeyboardShortcutQuickPaste") - }, { - combo: "Esc", - name: t("KeyboardShortcutClear") - }, { - combo: "Esc", - name: t("KeyboardShortcutClosePopup") - }] - }, { - items: [{ - combo: "Shift+B", - name: t("AboutTab") - }, { - combo: "Shift+N", - name: t("ChangelogTab") - }, { - combo: "Shift+M", - name: t("TitlePopupSettings") - }] - }])}` - }, { - name: "support", - title: `${emoji("โค๏ธโ€๐Ÿฉน")} ${t("CollapseSupport")}`, - body: `${t("SupportSelfTroubleshooting")}` - + `${socialLink(emoji("๐Ÿ“ข"), t("StatusPage"), links.statusPage)}` - + `${socialLink(emoji("๐Ÿ”ง"), t("TroubleshootingGuide"), links.troubleshootingGuide)}` - + `
` - + `${t("FollowSupport")}` - + `${socialLinks(obj.lang)}` - + `
` - + `${t("SourceCode")}` - + `${socialLink(emoji("๐Ÿ™"), repo.replace("https://github.com/", ''), repo)}` - }, { - name: "privacy", - title: `${emoji("๐Ÿ”’")} ${t("CollapsePrivacy")}`, - body: t("PrivacyPolicy") + `${ - env.plausibleHostname ? `

${t("AnalyticsDescription")}` : '' - }` - }, { - name: "legal", - title: `${emoji("๐Ÿ“‘")} ${t("CollapseLegal")}`, - body: t("FairUse") - }]) - }, - ...(env.showSponsors ? - [{ - text: t("SponsoredBy"), - classes: ["sponsored-by-text"], - nopadding: true - }, { - text: sponsoredList(), - raw: true - }] : [] - )] - }) - }, { - name: "changelog", - title: `${emoji("๐ŸŽ‰")} ${t('ChangelogTab')}`, - content: popup({ - name: "changelog", - header: { - closeAria: t('AccessibilityGoBack'), - title: `${emoji("๐Ÿช„", 30)} ${t('TitlePopupChangelog')}` - }, - body: [{ - text: `
${t('ChangelogLastMajor')}
`, - raw: true - }, { - text: (() => { - const banner = changelogManager('banner'); - if (!banner) return ''; - return `
- -
`; - })(), - raw: true - }, { - text: changelogManager("version"), - classes: ["changelog-tags"], - nopadding: true - }, { - text: changelogManager("title"), - classes: ["changelog-subtitle"], - nopadding: true - }, { - text: changelogManager("content") - }, { - text: sep(), - raw: true - },{ - text: `#${obj.hash}`, - classes: ["changelog-tags"], - nopadding: true - }, { - text: com[0], - classes: ["changelog-subtitle"], - nopadding: true - }, { - text: com[1] - }, { - text: `
${t('ChangelogOlder')}
`, - raw: true - }, { - text: ` -
- -
`, - raw: true - }] - }) - }, { - name: "donate", - title: `${emoji("๐Ÿ’–")} ${t('DonationsTab')}`, - content: popup({ - name: "donate", - header: { - closeAria: t('AccessibilityGoBack'), - title: emoji("๐Ÿ’ธ", 30) + t('TitlePopupDonate') - }, - body: [{ - text: `
${t('DonateSub')}
`, - raw: true - }, { - text: ` -
- -
`, - raw: true - }, { - text: t('DonateExplanation') - }, { - text: donateLinks.replace(/REPLACEME/g, t('DonateVia')), - raw: true - }, { - text: t('DonateLinksDescription'), - classes: ["explanation"] - }, { - text: sep(), - raw: true - }, { - text: donate.replace(/REPLACEME/g, t('ClickToCopy')), - classes: ["desc-padding"] - }] - }) - }], - })} - ${multiPagePopup({ - name: "settings", - closeAria: t('AccessibilityGoBack'), - header: { - aboveTitle: { - text: `v.${version}-${obj.hash} (${obj.branch})`, - url: `${repo}/commit/${obj.hash}` - }, - title: `${emoji("โš™๏ธ", 30)} ${t('TitlePopupSettings')}` - }, - tabs: [{ - name: "video", - title: `${emoji("๐ŸŽฌ")} ${t('SettingsVideoTab')}`, - content: settingsCategory({ - name: "downloads", - title: t('SettingsQualitySubtitle'), - body: switcher({ - name: "vQuality", - explanation: t('SettingsQualityDescription'), - items: [{ - action: "max", - text: "8k+" - }, { - action: "2160", - text: "4k" - }, { - action: "1440", - text: "1440p" - }, { - action: "1080", - text: "1080p" - }, { - action: "720", - text: "720p" - }, { - action: "480", - text: "480p" - }, { - action: "360", - text: "360p" - }, { - action: "240", - text: "240p" - }, { - action: "144", - text: "144p" - }] - }) - }) - + settingsCategory({ - name: "codec", - title: t('SettingsCodecSubtitle'), - body: switcher({ - name: "vCodec", - explanation: t('SettingsCodecDescription'), - items: [{ - action: "h264", - text: "h264 (mp4)" - }, { - action: "av1", - text: "av1 (mp4)" - }, { - action: "vp9", - text: "vp9 (webm)" - }] - }) - }) - + settingsCategory({ - name: "twitter", - title: "twitter", - body: checkbox([{ - action: "twitterGif", - name: t("SettingsTwitterGif"), - padding: "no-margin" - }]) - + explanation(t('SettingsTwitterGifDescription')) - }) - + settingsCategory({ - name: "tiktok", - title: "tiktok", - body: checkbox([{ - action: "tiktokH265", - name: t("SettingsTikTokH265"), - padding: "no-margin" - }]) - + explanation(t('SettingsTikTokH265Description')) - }) - }, { - name: "audio", - title: `${emoji("๐ŸŽถ")} ${t('SettingsAudioTab')}`, - content: settingsCategory({ - name: "general", - title: t('SettingsFormatSubtitle'), - body: switcher({ - name: "aFormat", - explanation: t('SettingsAudioFormatDescription'), - items: audioFormats - }) - + sep(0) - + checkbox([{ - action: "muteAudio", - name: t("SettingsVideoMute"), - padding: "no-margin" - }]) - + explanation(t('SettingsVideoMuteExplanation')) - }) - + settingsCategory({ - name: "youtube-dub", - title: t("SettingsAudioDub"), - body: checkbox([{ - action: "ytDub", - name: t("SettingsYoutubeDub"), - padding: "no-margin" - }]) - + explanation(t('SettingsYoutubeDubDescription')) - }) - + settingsCategory({ - name: "tiktok-audio", - title: "tiktok", - body: checkbox([{ - action: "fullTikTokAudio", - name: t("SettingsAudioFullTikTok"), - padding: "no-margin" - }]) - + explanation(t('SettingsAudioFullTikTokDescription')) - }) - }, { - name: "other", - title: `${emoji("๐Ÿช…")} ${t('SettingsOtherTab')}`, - content: settingsCategory({ - name: "appearance", - title: t('SettingsAppearanceSubtitle'), - body: switcher({ - name: "theme", - items: [{ - action: "auto", - text: t('SettingsThemeAuto') - }, { - action: "dark", - text: t('SettingsThemeDark') - }, { - action: "light", - text: t('SettingsThemeLight') - }] - }) - }) - + settingsCategory({ - name: "filename", - title: t('FilenameTitle'), - body: switcher({ - name: "filenamePattern", - items: [{ - action: "classic", - text: t('FilenamePatternClassic') - }, { - action: "basic", - text: t('FilenamePatternBasic') - }, { - action: "pretty", - text: t('FilenamePatternPretty') - }, { - action: "nerdy", - text: t('FilenamePatternNerdy') - }] - }) - + `
-
- ${emoji('๐ŸŽž๏ธ', 32, 1, 1)} -
-
${t('Preview')}
-
-
-
-
- ${emoji('๐ŸŽง', 32, 1, 1)} -
-
${t('Preview')}
-
-
-
-
` - + explanation(t('FilenameDescription')) - }) - + settingsCategory({ - name: "accessibility", - title: t('Accessibility'), - body: checkbox([{ - action: "alwaysVisibleButton", - name: t("SettingsKeepDownloadButton"), - aria: t("AccessibilityKeepDownloadButton") - }, { - action: "reduceTransparency", - name: t("SettingsReduceTransparency") - }, { - action: "disableAnimations", - name: t("SettingsDisableAnimations"), - padding: "no-margin" - }]) - }) - + (() => { - if (env.plausibleHostname) { - return settingsCategory({ - name: "privacy", - title: t('PrivateAnalytics'), - body: checkbox([{ - action: "plausible_ignore", - name: t("SettingsDisableAnalytics"), - padding: "no-margin" - }]) - + explanation(t('SettingsAnalyticsExplanation')) - }) - } - return '' - })() - + settingsCategory({ - name: "miscellaneous", - title: t('Miscellaneous'), - body: checkbox([{ - action: "downloadPopup", - name: t("SettingsEnableDownloadPopup"), - aria: t("AccessibilityEnableDownloadPopup") - }, { - action: "disableMetadata", - name: t("SettingsDisableMetadata") - }]) - }) - }] - })} - ${popupWithBottomButtons({ - name: "picker", - closeAria: t('AccessibilityGoBack'), - header: { - title: `${emoji("๐Ÿงฎ", 30)}
`, - explanation: `
`, - }, - buttons: [`${t('ImagePickerDownloadAudio')}`], - content: '
' - })} - - - - - - - - -` - } catch (err) { - return `${t('ErrorPageRenderFail', obj.hash)}`; - } -}