Implement customizable buttons via env vars (fixes #214)

This commit is contained in:
schlagmichdoch 2023-12-13 17:40:48 +01:00
parent 09451caf86
commit e06fa47c96
5 changed files with 124 additions and 7 deletions

View file

@ -61,6 +61,38 @@ else {
}
}
conf.rateLimit = rateLimit;
conf.buttons = {
"donation_button": {
"active": process.env.DONATION_BUTTON_ACTIVE,
"link": process.env.DONATION_BUTTON_LINK,
"title": process.env.DONATION_BUTTON_TITLE
},
"twitter_button": {
"active": process.env.TWITTER_BUTTON_ACTIVE,
"link": process.env.TWITTER_BUTTON_LINK,
"title": process.env.TWITTER_BUTTON_TITLE
},
"mastodon_button": {
"active": process.env.MASTODON_BUTTON_ACTIVE,
"link": process.env.MASTODON_BUTTON_LINK,
"title": process.env.MASTODON_BUTTON_TITLE
},
"bluesky_button": {
"active": process.env.BLUESKY_BUTTON_ACTIVE,
"link": process.env.BLUESKY_BUTTON_LINK,
"title": process.env.BLUESKY_BUTTON_TITLE
},
"custom_button": {
"active": process.env.CUSTOM_BUTTON_ACTIVE,
"link": process.env.CUSTOM_BUTTON_LINK,
"title": process.env.CUSTOM_BUTTON_TITLE
},
"privacypolicy_button": {
"active": process.env.PRIVACYPOLICY_BUTTON_ACTIVE,
"link": process.env.PRIVACYPOLICY_BUTTON_LINK,
"title": process.env.PRIVACYPOLICY_BUTTON_TITLE
}
};
// Evaluate arguments for deployment with Node.js only
conf.autoStart = process.argv.includes('--auto-restart');

View file

@ -49,7 +49,8 @@ export default class PairDropServer {
// By using `WS_SERVER`, you can host an instance that uses another signaling server.
app.get('/config', (req, res) => {
res.send({
signalingServer: conf.signalingServer
signalingServer: conf.signalingServer,
buttons: conf.buttons
});
});