mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Added download badges
This commit is contained in:
parent
8d8395c226
commit
ab8115b89d
3
.gitignore
vendored
3
.gitignore
vendored
@ -33,4 +33,5 @@ sync_staging.sh
|
||||
*.swp
|
||||
_vieux/
|
||||
_mydocs
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
Assets/DownloadBadges*.psd
|
@ -57,9 +57,9 @@ async function main() {
|
||||
|
||||
let content = readmeContent();
|
||||
|
||||
if (winUrl) content = content.replace(/(\(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/.*?\.exe\))/, '(' + winUrl + ')');
|
||||
if (macOsUrl) content = content.replace(/(\(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/.*?\.dmg\))/, '(' + macOsUrl + ')');
|
||||
if (linuxUrl) content = content.replace(/(\(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/.*?\.AppImage\))/, '(' + linuxUrl + ')');
|
||||
if (winUrl) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/.*?\.exe)/, winUrl);
|
||||
if (macOsUrl) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/.*?\.dmg)/, macOsUrl);
|
||||
if (linuxUrl) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/.*?\.AppImage)/, linuxUrl);
|
||||
|
||||
setReadmeContent(content);
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const https = require('https');
|
||||
const request = require('request');
|
||||
|
||||
const url = 'https://api.github.com/repos/laurent22/joplin/releases/latest';
|
||||
|
||||
async function gitHubLatestRelease() {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get({
|
||||
url: url,
|
||||
json: true,
|
||||
headers: {'User-Agent': 'Joplin Readme Updater'}
|
||||
}, (error, response, data) => {
|
||||
if (err) {
|
||||
reject(error);
|
||||
} else if (response.statusCode !== 200) {
|
||||
reject(new Error('Error HTTP ' + response.statusCode));
|
||||
} else {
|
||||
resolve(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function downloadUrl(release, os) {
|
||||
if (!release || !release.assets || !release.assets.length) return null;
|
||||
|
||||
for (let i = 0; i < release.assets.length; i++) {
|
||||
const asset = release.assets[i];
|
||||
const name = asset.name;
|
||||
|
||||
if (name.indexOf('.dmg') > 0 && os === 'macos') return asset.browser_download_url;
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const release = await gitHubLatestRelease();
|
||||
console.info(downloadUrl(release, 'windows'));
|
||||
console.info(downloadUrl(release, 'macos'));
|
||||
console.info(downloadUrl(release, 'linux'));
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error('Fatal error', error);
|
||||
});
|
10
README.md
10
README.md
@ -18,16 +18,16 @@ Three types of applications are available: **desktop** (Windows, macOS and Linux
|
||||
|
||||
Operating system | Link
|
||||
-----------------|--------
|
||||
Windows | [Download Joplin for Windows](https://github.com/laurent22/joplin/releases/download/v0.10.20/Joplin-Setup-0.10.20.exe)
|
||||
macOS | [Download Joplin for macOS](https://github.com/laurent22/joplin/releases/download/v0.10.20/Joplin-0.10.20.dmg)
|
||||
Linux | [Download Joplin for Linux](https://github.com/laurent22/joplin/releases/download/v0.10.20/Joplin-0.10.20-x86_64.AppImage)
|
||||
Windows | <a href='https://github.com/laurent22/joplin/releases/download/v0.10.22/Joplin-Setup-0.10.22.exe'><img alt='Get it on Windows' height="60px" src='https://raw.githubusercontent.com/laurent22/joplin/master/docs/images/BadgeWindows.png'/></a>
|
||||
macOS | <a href='https://github.com/laurent22/joplin/releases/download/v0.10.22/Joplin-0.10.22.dmg'><img alt='Get it on macOS' height="60px" src='https://raw.githubusercontent.com/laurent22/joplin/master/docs/images/BadgeMacOS.png'/></a>
|
||||
Linux | <a href='https://github.com/laurent22/joplin/releases/download/v0.10.22/Joplin-0.10.22-x86_64.AppImage'><img alt='Get it on macOS' height="60px" src='https://raw.githubusercontent.com/laurent22/joplin/master/docs/images/BadgeLinux.png'/></a>
|
||||
|
||||
## Mobile applications
|
||||
|
||||
Operating system | Link
|
||||
-----------------|--------
|
||||
Android | <a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="60px" src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png'/></a>
|
||||
iOS | Coming soon!
|
||||
Android | <a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="60px" src='https://raw.githubusercontent.com/laurent22/joplin/master/docs/images/BadgeAndroid.png'/></a>
|
||||
iOS | <a href='#'><img alt='Get it on the App Store' height="60px" src='https://raw.githubusercontent.com/laurent22/joplin/master/docs/images/BadgeIOS.png'/></a>
|
||||
|
||||
## Terminal application
|
||||
|
||||
|
BIN
docs/images/BadgeAndroid.png
Normal file
BIN
docs/images/BadgeAndroid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
docs/images/BadgeIOS.png
Normal file
BIN
docs/images/BadgeIOS.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
docs/images/BadgeLinux.png
Normal file
BIN
docs/images/BadgeLinux.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
docs/images/BadgeMacOS.png
Normal file
BIN
docs/images/BadgeMacOS.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
BIN
docs/images/BadgeWindows.png
Normal file
BIN
docs/images/BadgeWindows.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
Loading…
Reference in New Issue
Block a user