Skip to content

Commit

Permalink
add prefix to git version
Browse files Browse the repository at this point in the history
  • Loading branch information
federicocarboni committed Dec 17, 2023
1 parent c20ca83 commit e503716
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53684,19 +53684,20 @@ async function downloadToFile(url, file) {
* @returns {Promise<string>}
*/
async function getToolVersion(version) {
const prefix = version === 'git' ? '0.0.0-' : '';
const platform = external_os_.platform();
if (platform === 'linux') {
const readme = await downloadText(`https://johnvansickle.com/ffmpeg/${version === 'git' ? 'git-' : ''}readme.txt`);
return readme.match(/version\: (.+)\n/)[1].trim()
return prefix + readme.match(/version\: (.+)\n/)[1].trim()
} else if (platform === 'win32') {
const ver = await downloadText(`https://www.gyan.dev/ffmpeg/builds/${version}-version`);
return ver.trim();
return prefix + ver.trim();
} else if (platform === 'darwin') {
const res = await undici/* request */.WY(`https://evermeet.cx/ffmpeg/info/ffmpeg/${version === 'git' ? 'snapshot' : 'release'}`, {
maxRedirections: 5,
});
const body = await res.body.json();
return body.version + '';
return prefix + body.version;
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,20 @@ async function downloadToFile(url, file) {
* @returns {Promise<string>}
*/
export async function getToolVersion(version) {
const prefix = version === 'git' ? '0.0.0-' : '';
const platform = os.platform();
if (platform === 'linux') {
const readme = await downloadText(`https://johnvansickle.com/ffmpeg/${version === 'git' ? 'git-' : ''}readme.txt`);
return readme.match(/version\: (.+)\n/)[1].trim()
return prefix + readme.match(/version\: (.+)\n/)[1].trim()
} else if (platform === 'win32') {
const ver = await downloadText(`https://www.gyan.dev/ffmpeg/builds/${version}-version`);
return ver.trim();
return prefix + ver.trim();
} else if (platform === 'darwin') {
const res = await http.request(`https://evermeet.cx/ffmpeg/info/ffmpeg/${version === 'git' ? 'snapshot' : 'release'}`, {
maxRedirections: 5,
});
const body = await res.body.json();
return body.version + '';
return prefix + body.version;
}
}

Expand Down

0 comments on commit e503716

Please sign in to comment.