mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-11-24 05:11:16 +00:00
d17c4d7d2f
* Starting on new tailwind based joinlemmy-site. * Formatting fix. * Adding follow communities block. * Adding a few more blocks. * Finishing up blocks. * Adding a few more pages. * Adding apps page. * Almost done with donation page. * Adding most of instances page. * Trying to fix CI 1. * Adding navbar and footer. * Adding bottom spacer. * Finishing up more info modal. * Adding icons to main page. * Eruda only in development mode. * Finishing up main page, starting to work on recs. * Adding main images. * Adding images 2. * Starting to add filters. * Finishing up helper modal. * Adding topic icons. * Adding more instances. * Fixing recommended. * Forgot to add instance picker. * Adding world background image. * Adding alexandrite. * Adding funding goal block. * Fix dockerfile. * Upgrading deps. * Fixing package json. * Updating coders, sponsors. * Fixing mobile margins. * Fixing navbar auto-close when clicked. * Removing todo. * Removing some useless instance helper links. * Fixing news titling. * Addressing PR comments. * Updating instance stats. * Fixing class -> className * Fixing sm:max directives. * Make instance images links to their sites. * Use ubuntu font. * Addressing PR comments. * Adding a few more android apps. * Adding thunder and combustible apps. * Fixing z index. * Add a warning alert for closed source apps. * Adding MLMYM app. Fixes #213 * Fixing i18n key. * Adding QR codes for cryptos. Fixes #219 * Addressing PR comments. * Fixing news preview. * Adding registration mode to details modal. Fixes #153 * Filter out bot instances. * Using glide carousel. * Adding glide min css. * Adding donation platform fetching. Fixes #248 * Prettying glide css. * Change dev goal to 3 * Adding sign up button. * Minifying docker image. * Removing sortpack.
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
import fs from "fs";
|
|
import fetch from "node-fetch";
|
|
|
|
const donationStatsFile = "src/shared/donation_stats.ts";
|
|
|
|
const USDtoEURUrl =
|
|
"https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/usd/eur.json";
|
|
|
|
const liberaPayUrl = "https://liberapay.com/Lemmy/public.json";
|
|
const openCollectiveUrl = "https://opencollective.com/lemmy.json";
|
|
const patreonUrl = "https://www.patreon.com/api/campaigns/2692831";
|
|
|
|
const usdToEurRes = await fetch(USDtoEURUrl);
|
|
const usdToEur = (await usdToEurRes.json()).eur;
|
|
|
|
// In weekly USD
|
|
const liberaPayRes = await fetch(liberaPayUrl);
|
|
const liberaPayData = await liberaPayRes.json();
|
|
|
|
// In yearly USD, decimal
|
|
const openCollectiveRes = await fetch(openCollectiveUrl);
|
|
const openCollectiveData = await openCollectiveRes.json();
|
|
|
|
// In monthly USD, decimal
|
|
const patreonRes = await fetch(patreonUrl);
|
|
const patreonData = await patreonRes.json();
|
|
|
|
const donationData = [
|
|
{
|
|
name_: "liberapay",
|
|
patrons: liberaPayData.npatrons,
|
|
amount: Number(liberaPayData.receiving.amount) * 4.348214 * usdToEur,
|
|
},
|
|
{
|
|
name_: "opencollective",
|
|
patrons: openCollectiveData.backersCount,
|
|
amount: (Number(openCollectiveData.yearlyIncome) / 100 / 12) * usdToEur,
|
|
},
|
|
{
|
|
name_: "patreon",
|
|
patrons: patreonData.data.attributes.patron_count,
|
|
amount: (Number(patreonData.data.attributes.pledge_sum) / 100) * usdToEur,
|
|
},
|
|
];
|
|
|
|
let data = `export const donation_stats = \n `;
|
|
data += JSON.stringify(donationData, null, 2) + ";";
|
|
fs.writeFileSync(donationStatsFile, data);
|