list of sponsors + fixes
- added list of sponsors, if you host an instance, it can be enabled with showSponsors. - fixed download button thickness on ios. - about button now opens about tab when no new changelog is available.
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = `<svg width="22" height="22" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.1905 28.5L2 16L14.1905 3.5L16.2857 5.62054L7.65986 14.4654H30V17.5346H7.65986L16.2857 26.3516L14.1905 28.5Z" fill="#E1E1E1"/>
|
||||
@@ -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 +=
|
||||
`<a class="sponsored-logo ${s.name}"
|
||||
href="${s.url}" target="_blank"
|
||||
style="width: calc(${s.logo.width}px / ${s.logo.scale}); height: calc(${s.logo.height}px / ${s.logo.scale});">
|
||||
${loadedLogo}
|
||||
</a>`
|
||||
}
|
||||
return `<div id="sponsored-logos" aria-label="${altText.slice(0, -2)}">${base}</div>`
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
16
src/modules/sub/loadFromFs.js
Normal file
16
src/modules/sub/loadFromFs.js
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user