mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
feat(updater): add feed-config to map channel setting to feed URL
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const REPO = 'amitwh/markdown-converter';
|
||||
|
||||
const FEEDS = {
|
||||
github: {
|
||||
base: `https://github.com/${REPO}/releases/download`,
|
||||
},
|
||||
concreteinfo: {
|
||||
base: 'https://updates.concreteinfo.co.in/v5',
|
||||
},
|
||||
};
|
||||
|
||||
function platformSuffix(platform) {
|
||||
if (platform === 'darwin' || platform === 'mac') return 'mac';
|
||||
if (platform === 'win32' || platform === 'windows') return 'windows';
|
||||
return 'linux';
|
||||
}
|
||||
|
||||
function feedForChannel(channel, version, platform) {
|
||||
const suffix = platformSuffix(platform);
|
||||
const f = FEEDS[channel] || FEEDS.github;
|
||||
if (channel === 'github') {
|
||||
return `${f.base}/v${version}/latest-${suffix}.yml`;
|
||||
}
|
||||
return `${f.base}/latest-${suffix}.yml`;
|
||||
}
|
||||
|
||||
function resolveFeedUrl(channel, version, platform) {
|
||||
return feedForChannel(channel, version, platform);
|
||||
}
|
||||
|
||||
module.exports = { resolveFeedUrl, FEEDS };
|
||||
Reference in New Issue
Block a user