Files
return-youtube-dislike/Extensions/combined/src/config.js
T

54 lines
1.6 KiB
JavaScript
Raw Normal View History

const DEV_API_URL = "https://returnyoutubedislikeapi.com";
const PROD_API_URL = "https://returnyoutubedislikeapi.com";
const runtime = typeof chrome !== "undefined" ? chrome.runtime : null;
const manifest = typeof runtime?.getManifest === "function" ? runtime.getManifest() : null;
const isDevelopment = !manifest || !("update_url" in manifest);
const extensionChangelogUrl =
runtime && typeof runtime.getURL === "function"
? runtime.getURL("changelog/4/changelog_4.0.html")
: "https://returnyoutubedislike.com/changelog/4/changelog_4.0.html";
const config = {
apiUrl: isDevelopment ? DEV_API_URL : PROD_API_URL,
voteDisabledIconName: "icon_hold128.png",
defaultIconName: "icon128.png",
links: {
website: "https://returnyoutubedislike.com",
github: "https://github.com/Anarios/return-youtube-dislike",
discord: "https://discord.gg/mYnESY4Md5",
donate: "https://returnyoutubedislike.com/donate",
faq: "https://returnyoutubedislike.com/faq",
help: "https://returnyoutubedislike.com/help",
changelog: extensionChangelogUrl,
},
defaultExtConfig: {
disableVoteSubmission: false,
disableLogging: true,
coloredThumbs: false,
coloredBar: false,
colorTheme: "classic",
numberDisplayFormat: "compactShort",
numberDisplayReformatLikes: false,
hidePremiumTeaser: false,
},
};
function getApiUrl() {
return config.apiUrl;
}
function getApiEndpoint(endpoint) {
return `${config.apiUrl}${endpoint.startsWith("/") ? "" : "/"}${endpoint}`;
}
function getChangelogUrl() {
return config.links?.changelog ?? extensionChangelogUrl;
}
export { config, getApiUrl, getApiEndpoint, getChangelogUrl };