-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backend for auto-updating APK #83
base: master
Are you sure you want to change the base?
Conversation
```bash curl -vv -H 'x-om-appversion: 2022.08.01-1-Web' http://localhost:59830/releases ``` ```json { "published_at": "2024-02-06T15:08:00Z", "code": 24020611, "news": { "en-US": "<TEXT>" }, "apk": { "name": "OrganicMaps-24020611-web-release.apk", "size": 62334329, "url": "https://github.com/organicmaps/organicmaps/releases/download/2024.02.06-11-android/OrganicMaps-24020611-web-release.apk" } } ``` Signed-off-by: Roman Tsisyk <[email protected]>
f21156b
to
1f49ae1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Введём новый app id или переименуем web? Переименование поломает текущих пользователей.
const GITHUB_RELEASES_URL: string = 'https://api.github.com/repos/organicmaps/organicmaps/releases'; | ||
// https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token | ||
const GITHUB_BEARER_TOKEN: string = | ||
'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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может лучше его из секретов подтягивать? Мало ли опенсорснем потом? Тогда лучше перегенерить.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я посмотрю как убрать в секреты. Вообще пока кажется, что работает даже без него.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тогда убрать, если не нужно. Релизы же публичные, ключ тоже тогда публичный может быть или вообще ненужен.
// 2022.11.20 for iOS versions released before November 21 (without donate menu) | ||
// 2022.11.24-4-ios for newer iOS versions (with donate menu) | ||
// 2022.12.24-10-Google for Android | ||
// 2022.12.24-10-Google-beta for Android |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Web-beta supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'2022.08.23-5-Google-debug', | ||
'2022.08.23-1-fdroid-beta', | ||
'2022.08.23-1-fdroid-debug', | ||
'2022.08.23-1-web-beta', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этот надо поддерживать.
Или ввести новый флейвор, придумать хорошее название и сделать другой app id, чтобы ставился рядом с уже имеющимися fdroid и web и google и мог их заменить легко. Может даже импортнуть метки автоматом.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Текущий PR добавляет проверку релизов на GitHub. На GitHub выкладывается "web-release". Ничего другого туда не выкладывается.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Будет работать сейчас, после переименования?
Это отдельная проблема, которая никак не затрагивается в этом PR. |
Мы просто так тратим время, или решаем задачу, как дать людям замену версии в фдроиде? Удаление приложения (с удалением меток), чтобы установить его же версию из другого стора — не сработает, сам же понимаешь. |
Я пришлю PR в основную репу. Давай здесь закончим хотя бы с автообновлением web. Потом посмотрим стоит ли эту APK совать юзерам в F-Droid напрямую или надо еще что-нибудь там сделать. Может быть какую-нибудь магическую кнопку, которая сама всё поставит и мигрирует. Посмотри плз формат json в api - это будет трудно менять. Я добавил то, что технически нужно. |
const GITHUB_RELEASES_URL: string = 'https://api.github.com/repos/organicmaps/organicmaps/releases'; | ||
// https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token | ||
const GITHUB_BEARER_TOKEN: string = | ||
'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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тогда убрать, если не нужно. Релизы же публичные, ключ тоже тогда публичный может быть или вообще ненужен.
type?: string; | ||
apk: { | ||
url: string; | ||
name: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что будет в имени?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Название файла. Пока не уверен что прям остро необходимо, может не понадобится.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filename тогда?
Что там ещё есть полезного?
published_at: Date; | ||
draft: boolean; | ||
prerelease: boolean; | ||
body: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это описание воцнью на гитхабе? В каком формате? Ссылка на него есть?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это текст из релиза на гитхабе в формате markdown текста.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Херово что маркдаун, у нас же нет рендерера на девайсе, верно?
Если простого решения нет, то придётся присылать ссылку на гитхаб страницу с этим текстом.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Рендерить маркдаун пока не будем, верно?
const appVersion = parseAppVersion(request.headers.get('x-om-appversion')); | ||
if (!appVersion) return new Response('Unknown app version', { status: 400 }); | ||
|
||
// The release version doesn't have `-release` suffix, thus type should be `undefined`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пояснишь, о каких версиях речь? У нас же много разных билдов и сборок, плюс не забывай, что все, кто нас форкает, будут тоже автоматом стучаться на мета сервер с их собственными версиями и названиями. Мы видели их уже в юзер агентах.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Релизные версии не имеют суффикса "-Release" в версии, поэтому type == undefined => "release".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А если в type мусор от всяких форков? Лучше явно проверять на наши типы.
@@ -18,6 +18,22 @@ describe('parseDataVersion', () => { | |||
test('', () => expect(parseDataVersion(null)).toEqual(null)); | |||
}); | |||
|
|||
describe('parseApkName', () => { | |||
const tests: { [key: string]: object | null } = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В моём PR было больше тестов на не поддерживаемые кейзы https://github.com/organicmaps/meta/pull/65/files#diff-4a1ee83ef3a98a79eeaeb2506070a86479a12bad67c28ba34045f71159794373R35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Разве там был парсинг имени APK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Там тесты на кривые x-om-appversion.
@rtsisyk давай проверим, что работает с новой веб апк и замержим? |
curl -vv -H 'x-om-appversion: 2022.08.01-1-Web' http://localhost:59830/releases