From f52dd4f098d0e10bf7486054c09c556b7d6b5fe5 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 11 May 2023 18:44:02 +0100 Subject: [PATCH] Doc: Update download links --- Joplin_install_and_update.sh | 8 ++++++- README.md | 10 ++++----- packages/app-desktop/checkForUpdates.ts | 3 ++- packages/tools/update-readme-download.ts | 27 +++++++++++++----------- readme/download.md | 2 +- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/Joplin_install_and_update.sh b/Joplin_install_and_update.sh index 37ae13678..a0866067f 100755 --- a/Joplin_install_and_update.sh +++ b/Joplin_install_and_update.sh @@ -134,10 +134,16 @@ else print "The latest version is ${RELEASE_VERSION}, but you have ${CURRENT_VERSION:-no version} installed." fi +# Check if it's an update or a new install +DOWNLOAD_TYPE="New" +if [[ -f ~/.joplin/Joplin.AppImage ]]; then + DOWNLOAD_TYPE="Update" +fi + #----------------------------------------------------- print 'Downloading Joplin...' TEMP_DIR=$(mktemp -d) -wget -O "${TEMP_DIR}/Joplin.AppImage" "https://github.com/laurent22/joplin/releases/download/v${RELEASE_VERSION}/Joplin-${RELEASE_VERSION}.AppImage" +wget -O "${TEMP_DIR}/Joplin.AppImage" "https://objects.joplinusercontent.com/v${RELEASE_VERSION}/Joplin-${RELEASE_VERSION}.AppImage?source=LinuxInstallScript&type=$DOWNLOAD_TYPE" wget -O "${TEMP_DIR}/joplin.png" https://joplinapp.org/images/Icon512.png #----------------------------------------------------- diff --git a/README.md b/README.md index 8094ee3ac..b9f21ef38 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ Three types of applications are available: for **desktop** (Windows, macOS and L Operating System | Download ---|--- -Windows (32 and 64-bit) | Get it on Windows -macOS | Get it on macOS -Linux | Get it on Linux +Windows (32 and 64-bit) | Get it on Windows +macOS | Get it on macOS +Linux | Get it on Linux -**On Windows**, you may also use the Portable version. The [portable application](https://en.wikipedia.org/wiki/Portable_application) allows installing the software on a portable device such as a USB key. Simply copy the file JoplinPortable.exe in any directory on that USB key ; the application will then create a directory called "JoplinProfile" next to the executable file. +**On Windows**, you may also use the Portable version. The [portable application](https://en.wikipedia.org/wiki/Portable_application) allows installing the software on a portable device such as a USB key. Simply copy the file JoplinPortable.exe in any directory on that USB key ; the application will then create a directory called "JoplinProfile" next to the executable file. **On Linux**, the recommended way is to use the following installation script as it will handle the desktop icon too: @@ -36,7 +36,7 @@ Linux | Get it on Google Play | or download the APK file: [64-bit](https://github.com/laurent22/joplin-android/releases/download/android-v2.9.8/joplin-v2.9.8.apk) [32-bit](https://github.com/laurent22/joplin-android/releases/download/android-v2.9.8/joplin-v2.9.8-32bit.apk) +Android | Get it on Google Play | or download the APK file: [64-bit](https://objects.joplinusercontent.com/android-v2.9.8/joplin-v2.9.8.apk?source=JoplinWebsite&type=New) [32-bit](https://objects.joplinusercontent.com/android-v2.9.8/joplin-v2.9.8-32bit.apk?source=JoplinWebsite&type=New) iOS | Get it on the App Store | - ## Terminal application diff --git a/packages/app-desktop/checkForUpdates.ts b/packages/app-desktop/checkForUpdates.ts index 3d5c3087f..38ad91c15 100644 --- a/packages/app-desktop/checkForUpdates.ts +++ b/packages/app-desktop/checkForUpdates.ts @@ -97,7 +97,8 @@ async function fetchLatestRelease(options: CheckForUpdateOptions) { } if (found) { - downloadUrl = asset.browser_download_url; + downloadUrl = asset.browser_download_url.replace('github.com/laurent22/joplin/releases/download', 'objects.joplinusercontent.com'); + downloadUrl.concat('?source=DesktopApp&type=Update'); break; } } diff --git a/packages/tools/update-readme-download.ts b/packages/tools/update-readme-download.ts index 22f18cafe..e275860e2 100644 --- a/packages/tools/update-readme-download.ts +++ b/packages/tools/update-readme-download.ts @@ -19,21 +19,24 @@ function downloadUrl(release: GitHubRelease, os: string, portable = false) { const name = asset.name; const ext = fileExtension(name); - if (ext === 'dmg' && os === 'macos') return asset.browser_download_url; + const githubUrl = 'github.com/laurent22/joplin/releases/download'; + const joplinDomain = 'objects.joplinusercontent.com'; + + if (ext === 'dmg' && os === 'macos') return asset.browser_download_url.replace(githubUrl, joplinDomain); if (ext === 'exe' && os === 'windows') { if (portable) { - if (name === 'JoplinPortable.exe') return asset.browser_download_url; + if (name === 'JoplinPortable.exe') return asset.browser_download_url.replace(githubUrl, joplinDomain); } else { - if (name.match(/^Joplin-Setup-[\d.]+\.exe$/)) return asset.browser_download_url; + if (name.match(/^Joplin-Setup-[\d.]+\.exe$/)) return asset.browser_download_url.replace(githubUrl, joplinDomain); } } - if (ext === 'AppImage' && os === 'linux') return asset.browser_download_url; + if (ext === 'AppImage' && os === 'linux') return asset.browser_download_url.replace(githubUrl, joplinDomain); - if (os === 'android32' && name.endsWith('32bit.apk')) return asset.browser_download_url; + if (os === 'android32' && name.endsWith('32bit.apk')) return asset.browser_download_url.replace(githubUrl, joplinDomain); - if (os === 'android' && ext === 'apk' && !name.endsWith('32bit.apk')) return asset.browser_download_url; + if (os === 'android' && ext === 'apk' && !name.endsWith('32bit.apk')) return asset.browser_download_url.replace(githubUrl, joplinDomain); } throw new Error(`Could not find download URL for: ${os}`); @@ -85,16 +88,16 @@ async function main(argv: any) { let content = readmeContent(); - if (winUrl) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/v\d+\.\d+\.\d+\/Joplin-Setup-.*?\.exe)/, winUrl); - if (winPortableUrl) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/v\d+\.\d+\.\d+\/JoplinPortable.exe)/, winPortableUrl); - if (macOsUrl) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/v\d+\.\d+\.\d+\/Joplin-.*?\.dmg)/, macOsUrl); - if (linuxUrl) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin\/releases\/download\/v\d+\.\d+\.\d+\/Joplin-.*?\.AppImage)/, linuxUrl); + if (winUrl) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/v\d+\.\d+\.\d+\/Joplin-Setup-.*?\.exe)/, winUrl); + if (winPortableUrl) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/v\d+\.\d+\.\d+\/JoplinPortable.exe)/, winPortableUrl); + if (macOsUrl) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/v\d+\.\d+\.\d+\/Joplin-.*?\.dmg)/, macOsUrl); + if (linuxUrl) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/v\d+\.\d+\.\d+\/Joplin-.*?\.AppImage)/, linuxUrl); // Disable for now due to broken /latest API end point, which returns a // version from 6 months ago. - if (androidUrl) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin-android\/releases\/download\/android-v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+\.apk)/, androidUrl); - if (android32Url) content = content.replace(/(https:\/\/github.com\/laurent22\/joplin-android\/releases\/download\/android-v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+-32bit\.apk)/, android32Url); + if (androidUrl) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/android-v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+\.apk)/, androidUrl); + if (android32Url) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/android-v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+-32bit\.apk)/, android32Url); setReadmeContent(content); diff --git a/readme/download.md b/readme/download.md index df296bf21..f35531e7e 100644 --- a/readme/download.md +++ b/readme/download.md @@ -10,7 +10,7 @@ Your download of Joplin is in progress. Access your notes on Windows, macOS or Linux. -Get it on Windows Get it on macOS Get it on Linux +Get it on Windows Get it on macOS Get it on Linux