mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-11-24 01:52:12 +00:00
4031362fd6
Acknowledge first GitHub Sponsors Bronze tier (50 USD/month) in SPONSORS.md, README, and the console Help panel with a dedicated bronze section. Thanks: INSOLVE (Honorary); betterde.sk (@trybetterdesk) (Bronze); Marco Jakobs (@jacotec); MyNameisStitch (@MyNameisStitch); Redspin (@playerumpknow); muopc (@muopc)
53 lines
1.6 KiB
JavaScript
53 lines
1.6 KiB
JavaScript
/**
|
|
* BetterDesk Console — project supporters list for the Help panel.
|
|
* Mirrors SPONSORS.md via config/supporters.json (manual sync).
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const CONFIG_PATH = path.join(__dirname, '..', 'config', 'supporters.json');
|
|
|
|
const EMPTY = Object.freeze({
|
|
honorary: [],
|
|
bronze: [],
|
|
individuals: [],
|
|
links: {
|
|
repo: 'https://github.com/UNITRONIX/BetterDesk',
|
|
issues: 'https://github.com/UNITRONIX/BetterDesk/issues',
|
|
sponsors: 'https://github.com/sponsors/UNITRONIX',
|
|
buyMeACoffee: 'https://buymeacoffee.com/unitronix',
|
|
sponsorsMd: 'https://github.com/UNITRONIX/BetterDesk/blob/main/SPONSORS.md'
|
|
}
|
|
});
|
|
|
|
let _cache = null;
|
|
|
|
function loadSupporters() {
|
|
if (_cache) return _cache;
|
|
try {
|
|
const raw = fs.readFileSync(CONFIG_PATH, 'utf8');
|
|
const data = JSON.parse(raw);
|
|
_cache = {
|
|
honorary: Array.isArray(data.honorary) ? data.honorary : [],
|
|
bronze: Array.isArray(data.bronze) ? data.bronze : [],
|
|
individuals: Array.isArray(data.individuals) ? data.individuals : [],
|
|
links: { ...EMPTY.links, ...(data.links && typeof data.links === 'object' ? data.links : {}) }
|
|
};
|
|
} catch (err) {
|
|
console.warn('[supportersService] Failed to load supporters.json:', err.message);
|
|
_cache = { ...EMPTY, honorary: [], bronze: [], individuals: [], links: { ...EMPTY.links } };
|
|
}
|
|
return _cache;
|
|
}
|
|
|
|
/** Clear in-memory cache (tests / hot reload). */
|
|
function resetCache() {
|
|
_cache = null;
|
|
}
|
|
|
|
module.exports = {
|
|
loadSupporters,
|
|
resetCache
|
|
};
|