Skip to content

Commit 24138c3

Browse files
rfaystasadev
andauthored
build: Change to use redirected sponsorship feed (#413)
Co-authored-by: Stanislav Zhuk <stasadev@gmail.com>
1 parent ee2883d commit 24138c3

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

public/_redirects

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/s/divide-and-conquer-drupal4gov https://docs.google.com/presentation/d/1_OyAwQGTtz9xv1e_Qzau4Rarum5xQpPy0uS7ntA9leI/edit?usp=sharing 301
99
/s/divide-conquer-dcco https://docs.google.com/presentation/d/1JBSXLP59E8DSzkvxqPPKuceQ_fSMXoW_tySs_jXe8Pg/edit?usp=sharing 301
1010
/s/addon-update-checker.sh https://raw.githubusercontent.com/ddev/ddev-addon-template/main/.github/scripts/update-checker.sh 301
11-
/s/sponsorship-data.json https://rfay.github.io/sponsorship-data/data/all-sponsorships.json 301
11+
/s/sponsorship-data.json https://ddev.github.io/sponsorship-data/data/all-sponsorships.json 301
1212

1313
# Generic blog redirects
1414
/ddev-local /blog 301

src/components/SponsorsBanner.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
import { getSponsorshipData } from "../lib/api";
33
4-
const goal = 12000;
54
const data = await getSponsorshipData();
5+
const goal = data?.current_goal?.target_amount || 12000;
66
const income = data?.total_monthly_average_income || 0;
77
const percentage = Math.min((income / goal) * 100, 100).toFixed(0);
88
@@ -141,7 +141,7 @@ function formatCurrency(value: number): string {
141141
const goal = 12000;
142142
const cacheKey = 'ddevSponsorshipData';
143143
const cacheTTL = 12 * 60 * 60 * 1000; // 12 hours in ms
144-
const apiUrl = 'https://raw.githubusercontent.com/ddev/sponsorship-data/refs/heads/main/data/all-sponsorships.json';
144+
const apiUrl = '/s/sponsorship-data.json';
145145

146146
function formatCurrency(value) {
147147
return new Intl.NumberFormat('en-US', {
@@ -155,10 +155,11 @@ function formatCurrency(value: number): string {
155155
function updateUI(data) {
156156
try {
157157
const income = data.total_monthly_average_income;
158-
const percentage = Math.min((income / goal) * 100, 100).toFixed(0);
158+
const currentGoal = data.current_goal?.target_amount || goal;
159+
const percentage = Math.min((income / currentGoal) * 100, 100).toFixed(0);
159160

160161
document.querySelector('.ddev-sponsor-us-banner__raised').textContent = `Raised: ${formatCurrency(income)}`;
161-
document.querySelector('.ddev-sponsor-us-banner__goal').textContent = `Goal: ${formatCurrency(goal)}`;
162+
document.querySelector('.ddev-sponsor-us-banner__goal').textContent = `Goal: ${formatCurrency(currentGoal)}`;
162163
document.querySelector('.ddev-sponsor-us-banner__percent').textContent = `${percentage}% of monthly goal`;
163164
document.querySelector('.ddev-sponsor-us-banner__fill').style.width = `${percentage}%`;
164165
} catch (error) {

src/content/blog/ddev-april-2025-newsletter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ categories:
2929

3030
**Thanks for subscribing to the newsletter! We love to have this way to keep in touch.** If you're not getting it yet by email, please sign up at [ddev.com/newsletter](/newsletter).
3131

32-
**Great News: Sponsorship Level is Increasing!** According to our [open sponsorship feed](https://github.com/ddev/sponsorship-data/blob/main/data/all-sponsorships.json) our total monthly average income went up from $7099 to $7639 since March 1, a $540 bump in one month. Wow, you're awesome, thank you! If your organization or you aren't on the bandwagon yet, [join us to help make DDEV sustainable](https://github.com/sponsors/ddev). GitHub Sponsors is great, but we also do support contracts, invoicing, PayPal — anything that works for you! Our goal is $12,000/month, so we're more than halfway there. Special thanks to new $100/month sponsors [@fullfatthings](http://www.fullfatthings.com/), [@liip](https://www.liip.ch/en), [@andreas-anwesoft](https://www.anwesoft.com/), [@wearrudder](https://wearerudder.com/)!
32+
**Great News: Sponsorship Level is Increasing!** According to our [open sponsorship feed](https://ddev.com/s/sponsorship-data.json) our total monthly average income went up from $7099 to $7639 since March 1, a $540 bump in one month. Wow, you're awesome, thank you! If your organization or you aren't on the bandwagon yet, [join us to help make DDEV sustainable](https://github.com/sponsors/ddev). GitHub Sponsors is great, but we also do support contracts, invoicing, PayPal — anything that works for you! Our goal is $12,000/month, so we're more than halfway there. Special thanks to new $100/month sponsors [@fullfatthings](http://www.fullfatthings.com/), [@liip](https://www.liip.ch/en), [@andreas-anwesoft](https://www.anwesoft.com/), [@wearrudder](https://wearerudder.com/)!
3333

3434
**THANKS to all of you who are supporting DDEV’s path to sustainability** and who have gotten your organizations to do so.
3535

src/content/blog/ddev-feb-2025-newsletter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ categories:
3535
- **Node.js** improved support: People have asked for some time for Node.js to be the primary web server (instead of Nginx+php-fpm, etc), and now it can be done in a number of ways. This is now in [DDEV HEAD](https://ddev.readthedocs.io/en/stable/developers/building-contributing/#testing-latest-commits-on-head) and there are Quickstarts for [Simple Node.js](https://ddev.readthedocs.io/en/latest/users/quickstart/#nodejs-nodejs-web-server) and [SvelteKit](https://ddev.readthedocs.io/en/latest/users/quickstart/#nodejs-sveltekit). Incidentally, this also provides experimental support for [FrankenPHP](https://frankenphp.dev/) and provides a [Quickstart](https://ddev.readthedocs.io/en/latest/users/quickstart/#generic-frankenphp) for it as a demonstration of the "generic" web server type.
3636
- **Web-based Add-on Registry**: As add-ons have become so very popular it's hard to sort them out and understand which ones are meaningful for a particular need. This long-term goal is nearing completion as Stas has a proof of concept and now has to push it through to a maintained production status.
3737
- **Automated Tests for Quickstarts**: You won't see these, but it's a big step for us. Because our [Quickstarts](https://ddev.readthedocs.io/en/stable/users/quickstart/) are so dependent on the behavior of the upstream projects, it's always been hard for us to know when the target project has had a change that invalidates them. Now we have automated tests for the quickstarts of number of project types, and will add others as maintenance is done. Thanks to [Ralf Koller](https://github.com/rpkoller) for extensive work on the Drupal, WordPress, and TYPO3 quickstarts.
38-
- **Funding situation data feed**: Aiming for ever-increasing transparency in the DDEV funding situation, we now have an automatically-updated feed showing our [funding situation from all sources](https://github.com/ddev/sponsorship-data). You can see the [exact situation](https://github.com/ddev/sponsorship-data/blob/main/data/all-sponsorships.json) at any time. We expect to use this feed in the message-of-the-day on DDEV, as well as ddev.com and the DDEV README.
38+
- **Funding situation data feed**: Aiming for ever-increasing transparency in the DDEV funding situation, we now have an automatically-updated feed showing our [funding situation from all sources](https://github.com/ddev/sponsorship-data). You can see the [exact situation](/s/sponsorship-data.json) at any time. We expect to use this feed in the message-of-the-day on DDEV, as well as ddev.com and the DDEV README.
3939
- **New contributors and maintainers**: As DDEV's community grows, we always need new contributors and maintainers. We love to get contributors trained and get privileges to maintainers as needed! We already have lots of [Contributor Training](https://ddev.com/blog/category/training/) material, and [docs on how to contribute](https://ddev.readthedocs.io/en/stable/developers/) but we'll do anything you ask for! Need help with something? Need updates? Join us in [Discord](/s/discord) or [make an appointment with me](https://cal.com/randyfay/30min).
4040

4141
The next **DDEV Advisory Group Meeting** is Wednesday, March 5, 2025. We'll be doing a review of DDEV's 2024 and a discussion of [proposed plans for 2025](2025-plans.md). This is open to all and we'd love to have you!

src/content/blog/sponsor-thanks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ And please don't forget that the [open-source Docker project](https://github.com
4040

4141
## JSON Detail about Sponsorships
4242

43-
We recently set up a [full updated JSON feed](https://github.com/ddev/sponsorship-data) that can be used to see exactly where DDEV's sponsorship comes from and how we're doing. You can see the latest data any day in the [all sponsorships](https://github.com/ddev/sponsorship-data/blob/main/data/all-sponsorships.json) feed. And [Mark Conroy](https://bsky.app/profile/mark.ie) has built a [web component](https://web-components.mark.ie/web-components/ddev/sponsors-banner/) that can be used to show where we're at on any website. Thank you!
43+
We recently set up a [full updated JSON feed](/s/sponsorship-data.json) that can be used to see exactly where DDEV's sponsorship comes from and how we're doing. You can see the latest data any day in the [all sponsorships](https://github.com/ddev/sponsorship-data/blob/main/data/all-sponsorships.json) feed. And [Mark Conroy](https://bsky.app/profile/mark.ie) has built a [web component](https://web-components.mark.ie/web-components/ddev/sponsors-banner/) that can be used to show where we're at on any website. Thank you!
4444

4545
## Many Ways to Sponsor
4646

src/content/blog/sustainability-for-ddev.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ We work hard to identify areas that are dependent on a single maintainer, and to
5656

5757
## Current Financial Status
5858

59-
As of June, 2025, DDEV's monthly support is at the $7800 USD level. Our goal is $12,000. You can see this at any time on the top of [ddev.com](/), and a full accounting updated daily is in the [sponsorship-data](https://github.com/ddev/sponsorship-data/blob/main/data/all-sponsorships.json) repository. Our current bank balance is about $19,000 USD.
59+
As of June, 2025, DDEV's monthly support is at the $7800 USD level. Our goal is $12,000. You can see this at any time on the top of [ddev.com](/), and a full accounting updated daily is in the [sponsorship-data](https://github.com/ddev/sponsorship-data/) repository. Our current bank balance is about $19,000 USD.
6060

6161
## Share Your Thoughts!
6262

src/lib/api.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const githubTokenIsSet: boolean = (() => {
2222
process.env.GITHUB_TOKEN === ""
2323
) {
2424
// add warning for production builds
25-
if (import.meta.env.MODE === "production") {
25+
if (import.meta.env.PROD) {
2626
console.warn(
2727
"GITHUB_TOKEN not set or empty. You can ignore this warning for local development."
2828
)
@@ -265,13 +265,17 @@ export async function getSponsorshipData() {
265265
return cachedData
266266
}
267267

268-
const response = await octokit().request(
269-
`GET https://api.github.com/repos/ddev/sponsorship-data/contents/data/all-sponsorships.json`
270-
)
268+
// Construct the full URL for the redirect
269+
const baseUrl = import.meta.env.PROD
270+
? "https://ddev.com"
271+
: import.meta.env.SITE || "https://ddev.com"
272+
const response = await fetch(`${baseUrl}/s/sponsorship-data.json`)
271273

272-
const content = Buffer.from(response.data.content, "base64").toString("utf8")
274+
if (!response.ok) {
275+
throw new Error(`HTTP error! status: ${response.status}`)
276+
}
273277

274-
const sponsorshipData = JSON.parse(content)
278+
const sponsorshipData = await response.json()
275279

276280
putCache(cacheFilename, JSON.stringify(sponsorshipData))
277281

0 commit comments

Comments
 (0)