diff --git a/README.md b/README.md index ba4751885..c9f686179 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The install and update script supports the [following flags](https://github.com/ Operating System | Download | Alt. Download ---|---|--- -Android | Get it on Google Play | or download the APK file: [64-bit](https://objects.joplinusercontent.com/v2.9.8/joplin-v2.9.8.apk?source=JoplinWebsite&type=New) [32-bit](https://objects.joplinusercontent.com/v2.9.8/joplin-v2.9.8-32bit.apk?source=JoplinWebsite&type=New) +Android | Get it on Google Play | or download the [APK file](https://objects.joplinusercontent.com/v2.11.31/joplin-v2.11.31.apk?source=JoplinWebsite&type=New) iOS | Get it on the App Store | - ## Terminal application diff --git a/packages/tools/tool-utils.ts b/packages/tools/tool-utils.ts index d14d321ed..21dd0a234 100644 --- a/packages/tools/tool-utils.ts +++ b/packages/tools/tool-utils.ts @@ -334,7 +334,23 @@ export function githubOauthToken() { // says that nothing has changed on the API, although it used to work. So since // we can't use /latest anymore, we need to fetch all the releases to find the // latest published one. +// +// As of July 2023 /latest seems to be working again, so switching back to this +// method, but let's keep the old method just in case they break the API again. export async function gitHubLatestRelease(repoName: string): Promise { + const response: any = await fetch(`https://api.github.com/repos/laurent22/${repoName}/releases/latest`, { + headers: { + 'Content-Type': 'application/json', + 'User-Agent': 'Joplin Readme Updater', + }, + }); + + if (!response.ok) throw new Error(`Cannot fetch releases: ${response.statusText}`); + + return response.json(); +} + +export async function gitHubLatestRelease_KeepInCaseMicrosoftBreaksTheApiAgain(repoName: string): Promise { let pageNum = 1; while (true) { diff --git a/packages/tools/update-readme-download.ts b/packages/tools/update-readme-download.ts index 3607a5e5f..7b3652f84 100644 --- a/packages/tools/update-readme-download.ts +++ b/packages/tools/update-readme-download.ts @@ -81,7 +81,7 @@ async function main(argv: any) { const androidRelease = await gitHubLatestRelease('joplin-android'); - const android32Url = downloadUrl(androidRelease, OS.Android32); + // const android32Url = downloadUrl(androidRelease, OS.Android32); const androidUrl = downloadUrl(androidRelease, OS.Android); const winUrl = downloadUrl(release, OS.Windows); const winPortableUrl = downloadUrl(release, OS.Windows, true); @@ -93,7 +93,7 @@ async function main(argv: any) { console.info('macOS: ', macOsUrl); console.info('Linux: ', linuxUrl); console.info('Android: ', androidUrl); - console.info('Android 32: ', android32Url); + // console.info('Android 32: ', android32Url); let content = readmeContent(); @@ -103,7 +103,7 @@ async function main(argv: any) { if (linuxUrl) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/v\d+\.\d+\.\d+\/Joplin-.*?\.AppImage)/, linuxUrl); if (androidUrl) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+\.apk)/, androidUrl); - if (android32Url) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+-32bit\.apk)/, android32Url); + // if (android32Url) content = content.replace(/(https:\/\/objects.joplinusercontent.com\/v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+-32bit\.apk)/, android32Url); setReadmeContent(content); }