create-expo-updates-server 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/template/.dockerignore +16 -0
  2. package/dist/template/README.md +51 -660
  3. package/dist/template/app/api/admin/device-targets/route.test.ts +43 -0
  4. package/dist/template/app/api/admin/device-targets/route.ts +91 -0
  5. package/dist/template/app/api/admin/devices/route.test.ts +41 -0
  6. package/dist/template/app/api/admin/devices/route.ts +15 -0
  7. package/dist/template/app/api/admin/updates/[encodedKey]/audience/route.ts +75 -0
  8. package/dist/template/app/api/device-heartbeat/route.ts +2 -0
  9. package/dist/template/app/globals.css +114 -15
  10. package/dist/template/app/layout.tsx +12 -4
  11. package/dist/template/app/login/page.tsx +22 -18
  12. package/dist/template/app/updates/[encodedKey]/page.tsx +112 -88
  13. package/dist/template/app/updates/devices/page.tsx +264 -0
  14. package/dist/template/app/updates/embedded/page.tsx +102 -68
  15. package/dist/template/app/updates/emergency-redirects/page.tsx +144 -111
  16. package/dist/template/app/updates/layout.tsx +6 -1
  17. package/dist/template/app/updates/page.tsx +262 -212
  18. package/dist/template/components/admin/admin-shell.tsx +196 -0
  19. package/dist/template/components/admin/language-switcher.tsx +25 -0
  20. package/dist/template/components/admin/theme-provider.tsx +15 -0
  21. package/dist/template/components/ui/alert.tsx +65 -0
  22. package/dist/template/components/ui/badge.tsx +47 -0
  23. package/dist/template/components/ui/button.tsx +63 -0
  24. package/dist/template/components/ui/card.tsx +91 -0
  25. package/dist/template/components/ui/chart.tsx +373 -0
  26. package/dist/template/components/ui/checkbox.tsx +31 -0
  27. package/dist/template/components/ui/dialog.tsx +158 -0
  28. package/dist/template/components/ui/dropdown-menu.tsx +256 -0
  29. package/dist/template/components/ui/input.tsx +20 -0
  30. package/dist/template/components/ui/label.tsx +23 -0
  31. package/dist/template/components/ui/native-select.tsx +61 -0
  32. package/dist/template/components/ui/popover.tsx +88 -0
  33. package/dist/template/components/ui/scroll-area.tsx +57 -0
  34. package/dist/template/components/ui/select.tsx +189 -0
  35. package/dist/template/components/ui/separator.tsx +27 -0
  36. package/dist/template/components/ui/sheet.tsx +142 -0
  37. package/dist/template/components/ui/sidebar.tsx +736 -0
  38. package/dist/template/components/ui/skeleton.tsx +13 -0
  39. package/dist/template/components/ui/switch.tsx +34 -0
  40. package/dist/template/components/ui/table.tsx +115 -0
  41. package/dist/template/components/ui/tabs.tsx +90 -0
  42. package/dist/template/components/ui/textarea.tsx +17 -0
  43. package/dist/template/components/ui/tooltip.tsx +56 -0
  44. package/dist/template/components.json +22 -0
  45. package/dist/template/docs/admin-ui.md +35 -0
  46. package/dist/template/docs/device-targeting.md +129 -0
  47. package/dist/template/docs/doctor.md +137 -0
  48. package/dist/template/docs/expo-app-setup.md +174 -47
  49. package/dist/template/docs/getting-started.md +105 -146
  50. package/dist/template/docs/getting-started.ru.md +106 -191
  51. package/dist/template/docs/index.md +14 -33
  52. package/dist/template/docs/installation-telemetry.md +233 -0
  53. package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +89 -0
  54. package/dist/template/docs/migrations/2026-10-19-device-heartbeat.sql +131 -0
  55. package/dist/template/docs/migrations/2026-10-22-device-analytics.sql +264 -0
  56. package/dist/template/docs/migrations/2026-10-22-device-targeting-activation.sql +108 -0
  57. package/dist/template/docs/migrations/2026-10-22-device-targeting.sql +130 -0
  58. package/dist/template/docs/migrations/2026-10-22-device-version-metadata.sql +154 -0
  59. package/dist/template/docs/migrations/schema.sql +868 -6
  60. package/dist/template/docs/npm-installer.md +15 -30
  61. package/dist/template/docs/operations-guide.md +87 -0
  62. package/dist/template/docs/ota-client-lifecycle.md +263 -0
  63. package/dist/template/docs/ota-update-policy.md +36 -2
  64. package/dist/template/docs/supabase-setup.md +4 -0
  65. package/dist/template/hooks/use-mobile.ts +21 -0
  66. package/dist/template/lib/utils.ts +6 -0
  67. package/dist/template/package-lock.json +2325 -101
  68. package/dist/template/package.json +13 -3
  69. package/dist/template/scripts/configure-expo-app.mjs +11 -15
  70. package/dist/template/scripts/doctor.mjs +51 -0
  71. package/dist/template/scripts/ensure-test-bucket.mjs +21 -0
  72. package/dist/template/scripts/lib/device-identity.test.ts +29 -0
  73. package/dist/template/scripts/lib/doctor-probes.mjs +139 -0
  74. package/dist/template/scripts/lib/doctor.mjs +208 -0
  75. package/dist/template/scripts/lib/doctor.test.mjs +262 -0
  76. package/dist/template/scripts/lib/expo-app-configurator.mjs +14 -9
  77. package/dist/template/scripts/lib/expo-app-configurator.test.ts +3 -2
  78. package/dist/template/scripts/lib/ota-client-configurator.mjs +69 -0
  79. package/dist/template/scripts/lib/ota-client-configurator.test.ts +88 -0
  80. package/dist/template/scripts/lib/ota-client.test.ts +55 -0
  81. package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +173 -0
  82. package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +123 -0
  83. package/dist/template/scripts/lib/ota-update-controller.test.ts +231 -0
  84. package/dist/template/scripts/tests/device-analytics-migrations.mjs +80 -0
  85. package/dist/template/scripts/tests/device-analytics.mjs +126 -0
  86. package/dist/template/scripts/tests/device-heartbeat.mjs +86 -0
  87. package/dist/template/scripts/tests/device-targeting-activation.mjs +111 -0
  88. package/dist/template/scripts/tests/device-targeting.mjs +39 -0
  89. package/dist/template/scripts/tests/device-version-metadata.mjs +31 -0
  90. package/dist/template/scripts/tests/manifest-identity-concurrency.mjs +106 -0
  91. package/dist/template/scripts/tests/manifest-identity.sql +204 -0
  92. package/dist/template/src/client/admin-types.ts +1 -0
  93. package/dist/template/src/client/devices/analytics.tsx +429 -0
  94. package/dist/template/src/client/devices/device-name.tsx +82 -0
  95. package/dist/template/src/client/devices/registry.tsx +399 -0
  96. package/dist/template/src/client/devices/use-devices-report.ts +108 -0
  97. package/dist/template/src/client/devices/version-adoption-chart.tsx +269 -0
  98. package/dist/template/src/client/devices/version-groups.test.ts +57 -0
  99. package/dist/template/src/client/devices/version-groups.ts +101 -0
  100. package/dist/template/src/client/distribution-control.tsx +135 -81
  101. package/dist/template/src/client/guard-action-combobox.tsx +13 -24
  102. package/dist/template/src/client/i18n/en.json +286 -0
  103. package/dist/template/src/client/i18n/messages.test.ts +42 -0
  104. package/dist/template/src/client/i18n/messages.ts +31 -0
  105. package/dist/template/src/client/i18n/provider.tsx +55 -0
  106. package/dist/template/src/client/i18n/use-formatters.ts +38 -0
  107. package/dist/template/src/client/logout-button.tsx +3 -1
  108. package/dist/template/src/client/update-audience-editor.tsx +285 -0
  109. package/dist/template/src/client/update-policy-editor.tsx +53 -41
  110. package/dist/template/src/server/controllers/manifest.test.ts +250 -7
  111. package/dist/template/src/server/controllers/manifest.ts +39 -31
  112. package/dist/template/src/server/devices/audience.test.ts +48 -0
  113. package/dist/template/src/server/devices/audience.ts +86 -0
  114. package/dist/template/src/server/devices/heartbeat.test.ts +39 -0
  115. package/dist/template/src/server/devices/heartbeat.ts +75 -0
  116. package/dist/template/src/server/devices/report-types.ts +114 -0
  117. package/dist/template/src/server/devices/report.test.ts +29 -0
  118. package/dist/template/src/server/devices/report.ts +27 -0
  119. package/dist/template/src/server/lib/admin-audience-activation.test.ts +94 -0
  120. package/dist/template/src/server/lib/admin-updates.ts +32 -168
  121. package/dist/template/src/server/lib/distribution-control.test.ts +23 -2
  122. package/dist/template/src/server/lib/distribution-control.ts +13 -4
  123. package/dist/template/src/server/lib/supabase.js +10 -10
  124. package/dist/template/src/server/lib/supabase.test.ts +11 -0
  125. package/dist/template/src/server/manifest/manifest-identity.test.ts +30 -0
  126. package/dist/template/src/server/manifest/manifest-identity.ts +24 -0
  127. package/dist/template/src/server/manifest/manifest-repository.ts +31 -102
  128. package/dist/template/src/server/manifest/manifest-response.ts +1 -1
  129. package/dist/template/templates/expo-app/ota-client/README.md +59 -0
  130. package/dist/template/templates/expo-app/ota-client/controller.js +60 -0
  131. package/dist/template/templates/expo-app/ota-client/device-identity.js +26 -0
  132. package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +52 -0
  133. package/dist/template/templates/expo-app/ota-client/index.d.ts +47 -0
  134. package/dist/template/templates/expo-app/ota-client/index.js +3 -0
  135. package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.js +48 -0
  136. package/dist/template/templates/expo-app/ota-client/model/update-controller.js +182 -0
  137. package/dist/template/templates/expo-app/ota-client/runtime.js +112 -0
  138. package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.js +56 -0
  139. package/dist/template-manifest.json +582 -77
  140. package/lib/cli.mjs +4 -6
  141. package/package.json +1 -1
@@ -0,0 +1,286 @@
1
+ {
2
+ "Не удалось загрузить глобальный статус OTA": "Could not load global OTA status",
3
+ "Проверка глобального статуса OTA…": "Checking global OTA status…",
4
+ "Глобальный статус OTA недоступен. Распространяющие действия отключены до восстановления связи.": "Global OTA status is unavailable. Distribution actions are disabled until the connection is restored.",
5
+ "Распространение OTA остановлено": "OTA distribution is stopped",
6
+ "Укажите причину аварийной блокировки.": "Enter a reason for the emergency stop.",
7
+ "Немедленно остановить выдачу manifest и всех OTA assets для всех клиентов?": "Immediately stop serving manifests and all OTA assets to every client?",
8
+ "Возобновить глобальное OTA-распространение?": "Resume global OTA distribution?",
9
+ "OTA-распространение остановлено.": "OTA distribution stopped.",
10
+ "OTA-распространение возобновлено.": "OTA distribution resumed.",
11
+ "Состояние уже изменил другой оператор. Данные обновлены; проверьте их и повторите действие.": "Another operator already changed the state. Data has been refreshed; review it and try again.",
12
+ "Не удалось изменить глобальный статус OTA": "Could not change global OTA status",
13
+ "Распространение OTA": "OTA distribution",
14
+ "Проверка…": "Checking…",
15
+ "Недоступно": "Unavailable",
16
+ "Остановлено": "Stopped",
17
+ "Работает": "Running",
18
+ "Глобальное управление выдачей manifest и assets.": "Global control over manifest and asset delivery.",
19
+ "Управление": "Management",
20
+ "Изменено: ": "Changed: ",
21
+ "Причина остановки": "Stop reason",
22
+ "Причина аварийной блокировки OTA": "Reason for the emergency OTA stop",
23
+ "Обязательная причина остановки (до 500 символов)": "Required stop reason (up to 500 characters)",
24
+ "Сохранение…": "Saving…",
25
+ "Возобновить OTA": "Resume OTA",
26
+ "Остановить все OTA": "Stop all OTA",
27
+ "Ошибка запроса": "Request failed",
28
+ "Аудитория сохранена. Для черновика отдельно включите распространение.": "Audience saved. Enable distribution separately for a draft.",
29
+ "Аудитория обновления": "Update audience",
30
+ "Сначала ограничьте аудиторию черновика, затем активируйте OTA. После smoke-теста выберите «Все» и сохраните. Runtime, канал и платформа по-прежнему должны совпадать.": "Restrict the draft audience first, then activate the OTA. After the smoke test, select “All” and save. Runtime, channel and platform must still match.",
31
+ "Кому доступен OTA": "Who can receive this OTA",
32
+ "Все совместимые устройства": "All compatible devices",
33
+ "Только выбранные устройства / установки": "Selected devices / installations only",
34
+ "Поиск адресата": "Find a recipient",
35
+ "Имя, ID, runtime или канал": "Name, ID, runtime or channel",
36
+ "Последние 500 установок ": "Latest 500 installations ",
37
+ ", до 50 совпадений. Device ID сохраняет адресата при переустановке; Installation ID относится к одной установке.": ", up to 50 matches. Device ID retains the recipient across reinstalls; Installation ID identifies one installation.",
38
+ "Устройство": "Device",
39
+ "Установка": "Installation",
40
+ "Устройства не найдены. Запустите приложение с обновлённым OTA-клиентом или укажите ID ниже.": "No devices found. Launch the app with the updated OTA client or enter an ID below.",
41
+ "Выбранные ID и ручное добавление ·": "Selected IDs and manual entry ·",
42
+ "Device ID (по одному в строке)": "Device IDs (one per line)",
43
+ "Installation ID (по одному в строке)": "Installation IDs (one per line)",
44
+ "Ограничение влияет на следующие проверки OTA. Уже скачанное обновление нельзя отозвать изменением аудитории. Force update действует только для её участников.": "This restriction applies to subsequent OTA checks. Changing the audience cannot revoke an already downloaded update. Force update only applies to audience members.",
45
+ "Сохранить аудиторию": "Save audience",
46
+ "Перечитать": "Reload",
47
+ "Не определён": "Unknown",
48
+ "Канал {0}, {1}": "Channel {0}, {1}",
49
+ "Канал": "Channel",
50
+ "Активных установок:": "Active installations:",
51
+ "Версия приложения / OTA": "App version / OTA",
52
+ "Количество · доля": "Count · share",
53
+ "Версии в {0}, {1}": "Versions in {0}, {1}",
54
+ "Версия не указана": "Version not specified",
55
+ "Полный ID": "Full ID",
56
+ "{0}, {1} {2}: {3} установок, {4} внутри канала {5}, {6}": "{0}, {1} {2}: {3} installations, {4} within channel {5}, {6}",
57
+ "Показано ": "Showing ",
58
+ " из ": " of ",
59
+ " версий. Доли учитывают весь блок.": " versions. Shares include the entire group.",
60
+ "Свернуть": "Collapse",
61
+ "Показать все ({0})": "Show all ({0})",
62
+ "24 часа": "24 hours",
63
+ "{0} дней": "{0} days",
64
+ "Активные установки по версиям": "Active installations by version",
65
+ "Всего: ": "Total: ",
66
+ "Активность за последние ": "Activity in the last ",
67
+ ". Runtime → канал → платформа → версия. Доля считается внутри каждого блока канала и платформы.": ". Runtime → channel → platform → version. Shares are calculated within each channel and platform group.",
68
+ "Установок: ": "Installations: ",
69
+ "Версия берётся из опубликованной сборки. ID различает OTA с одинаковой версией; одна OTA на разных native-сборках объединяется в одну полосу. Учитываются установки приложения за период.": "The version comes from the published build. IDs distinguish OTAs with the same version; one OTA running on different native builds appears in one bar. Counts include app installations active during the selected period.",
70
+ "Нет активных установок в этой выборке": "No active installations in this selection",
71
+ "Измените фильтры или дождитесь heartbeat от приложения.": "Change the filters or wait for an app heartbeat.",
72
+ "Ошибка входа": "Sign-in failed",
73
+ "Вход в панель управления обновлениями": "Sign in to the update management panel",
74
+ "Логин": "Username",
75
+ "Пароль": "Password",
76
+ "Вход...": "Signing in...",
77
+ "Войти": "Sign in",
78
+ "Установки": "Installations",
79
+ "OTA-обновления": "OTA updates",
80
+ "Embedded-сборки": "Embedded builds",
81
+ "Аварийные маршруты": "Emergency redirects",
82
+ "Не удалось выйти. Попробуйте ещё раз.": "Could not sign out. Please try again.",
83
+ "К содержимому": "Skip to content",
84
+ "Выход…": "Signing out…",
85
+ "Выйти": "Sign out",
86
+ "Открыть или скрыть навигацию": "Show or hide navigation",
87
+ "Управление обновлениями": "Update management",
88
+ "Переключить светлую и тёмную тему": "Switch between light and dark themes",
89
+ "Выход...": "Signing out...",
90
+ "Не удалось загрузить статистику": "Could not load analytics",
91
+ "Скопировать {0}": "Copy {0}",
92
+ "Скопировано": "Copied",
93
+ "Не удалось скопировать. Выделите текст вручную.": "Could not copy. Select the text manually.",
94
+ "Реестр установок": "Installation registry",
95
+ "Последнее известное состояние. Нажмите на ID, чтобы посмотреть детали.": "Last known state. Select an ID to view details.",
96
+ "Все версии · ": "All versions · ",
97
+ "Платформа / канал": "Platform / channel",
98
+ "Версия": "Version",
99
+ "Запуск": "Launch",
100
+ "Последняя связь · UTC": "Last seen · UTC",
101
+ "Детали установки {0}": "Installation details {0}",
102
+ "С ": "Since ",
103
+ "Установки не найдены": "No installations found",
104
+ "Измените фильтры или дождитесь heartbeat от приложения с подключённой телеметрией.": "Change the filters or wait for a heartbeat from an app with telemetry enabled.",
105
+ "{0}–{1} из {2}": "{0}–{1} of {2}",
106
+ "0 установок": "0 installations",
107
+ "Назад": "Back",
108
+ "Далее": "Next",
109
+ "Версия / ID": "Version / ID",
110
+ "Доля": "Share",
111
+ "Нет версий в выбранной выборке.": "No versions in this selection.",
112
+ "Детали установки": "Installation details",
113
+ "Идентификатор установки приложения и последнее зарегистрированное состояние.": "The app installation identifier and its last reported state.",
114
+ "Платформа": "Platform",
115
+ "Тип запуска": "Launch type",
116
+ "Название обновления": "Update label",
117
+ "Да": "Yes",
118
+ "Нет": "No",
119
+ "Первый heartbeat": "First heartbeat",
120
+ "Последний heartbeat": "Last heartbeat",
121
+ "Время события на устройстве": "Device event time",
122
+ "Не удалось загрузить имя": "Could not load the name",
123
+ "Не удалось сохранить": "Could not save",
124
+ "Имя сохранено — устройство можно выбрать в аудитории OTA.": "Name saved — the device can now be selected in an OTA audience.",
125
+ "Имя устройства": "Device name",
126
+ "Мой телефон": "My phone",
127
+ "Сохранить имя": "Save name",
128
+ "Активные установки": "Active installations",
129
+ "Heartbeat за последние {0}": "Heartbeats in the last {0}",
130
+ "Используют OTA": "Using OTA",
131
+ "{0} из {1} установок": "{0} of {1} installations",
132
+ "Встроенная версия": "Embedded version",
133
+ "Сочетаний версий в выборке: {0}": "Version combinations in this selection: {0}",
134
+ "Аварийный запуск": "Emergency launch",
135
+ "Не определён тип запуска: {0}": "Unknown launch type: {0}",
136
+ "Активность установок": "Installation activity",
137
+ "Уникальные установки с heartbeat за день · UTC": "Unique installations with a heartbeat per day · UTC",
138
+ "Активные": "Active",
139
+ "Новые": "New",
140
+ "График ежедневных активных и новых установок": "Daily active and new installations chart",
141
+ "Сбор с ": "Collecting since ",
142
+ " · Сегодня — неполный день. До начала сбора данных нет; история хранится 90 дней.": " · Today is a partial day. No data is available before collection began; history is retained for 90 days.",
143
+ "Показать значения по дням": "Show daily values",
144
+ "Дата UTC": "Date UTC",
145
+ "Покрытие": "Coverage",
146
+ "Полный день": "Full day",
147
+ "Неполный день": "Partial day",
148
+ "Нет данных": "No data",
149
+ "Текущее состояние активных установок": "Current state of active installations",
150
+ "Нет установок с выбранными фильтрами.": "No installations match the selected filters.",
151
+ "Когорты установок": "Installation cohorts",
152
+ "Группы по неделе первого heartbeat. Одна установка — одна запись, переустановка может создать новую.": "Grouped by the week of the first heartbeat. One installation is one record; reinstalling may create another.",
153
+ "Текущие версии": "Current versions",
154
+ "Возвращаемость": "Retention",
155
+ "Активные за выбранный период, сгруппированные по неделе первого появления. Проценты внутри каждой когорты.": "Installations active during the selected period, grouped by the week first seen. Percentages are calculated within each cohort.",
156
+ "Неделя · UTC": "Week · UTC",
157
+ "Пока нет когорт для этой выборки.": "No cohorts in this selection yet.",
158
+ "Новые установки за последние 90 дней после начала сбора. Фильтры платформы, канала, runtime и типа запуска применяются на момент первого heartbeat. D1/D7 — heartbeat ровно через 1/7 дней, даже если версия изменилась. D0 — исходная когорта (100%); для D1 и дальше неполные дни исключены. «—» означает, что день ещё не наблюдался полностью.": "New installations observed in the last 90 days since collection began. Platform, channel, runtime and launch-type filters apply at the first heartbeat. D1/D7 means a heartbeat exactly 1/7 days later, even if the version changed. D0 is the baseline cohort (100%); incomplete days are excluded from D1 onward. “—” means the day has not been fully observed yet.",
159
+ "Нет полностью наблюдаемых дней": "No fully observed days",
160
+ "D0: исходная когорта, включая сегодняшние установки": "D0: baseline cohort, including today's installations",
161
+ "{0} из {1} установок с полностью наблюдаемым днём": "{0} of {1} installations with a fully observed day",
162
+ "нет данных": "no data",
163
+ "Возвращаемость появится для новых установок после начала сбора": "Retention will become available for new installations after collection began",
164
+ "Навигация": "Navigation",
165
+ "Разделы панели управления OTA.": "OTA management panel sections.",
166
+ "Аналитика приложения": "Application analytics",
167
+ "Версии, активность и переход на OTA в одном месте.": "Versions, activity and OTA adoption in one place.",
168
+ "Обновление…": "Refreshing…",
169
+ "Обновить": "Refresh",
170
+ "Фильтры": "Filters",
171
+ "Вся выборка": "Entire selection",
172
+ "Период активности": "Activity period",
173
+ "7 дней": "7 days",
174
+ "30 дней": "30 days",
175
+ "Все платформы": "All platforms",
176
+ "Все каналы": "All channels",
177
+ "Все runtime": "All runtimes",
178
+ "Все типы": "All launch types",
179
+ "ID или часть ID": "ID or part of an ID",
180
+ "Часть UUID: цифры, буквы a–f и дефисы": "Partial UUID: digits, letters a–f and hyphens",
181
+ "Применить": "Apply",
182
+ "Сбросить": "Reset",
183
+ "Есть неприменённые изменения": "There are unapplied changes",
184
+ "Данные на {0}": "Data as of {0}",
185
+ "Не удалось обновить данные": "Could not refresh data",
186
+ " Ниже показан предыдущий успешный результат.": " The last successful result is shown below.",
187
+ "Повторить": "Retry",
188
+ "Загрузка статистики": "Loading analytics",
189
+ "Метрика считает установки приложения, а не уникальных людей. Сводка и реестр отражают последнее состояние; график — состояние на конец каждого дня. Переустановка может изменить Installation ID.": "This metric counts app installations, not unique people. The summary and registry show the latest state; the daily chart shows the state at the end of each day. Reinstalling may change the Installation ID.",
190
+ "Не удалось загрузить детали": "Could not load details",
191
+ "Некорректный JSON": "Invalid JSON",
192
+ "Файл {0} обновлён": "File {0} updated",
193
+ "Ошибка сохранения": "Could not save changes",
194
+ "Вы действительно хотите начать распространение предыдущей версии обновления?": "Are you sure you want to start distributing the previous update version?",
195
+ "Rollback активирован": "Rollback activated",
196
+ "Rollback не выполнен": "Rollback failed",
197
+ "Вернуть распространение к последнему апдейту (promote)?": "Return distribution to the latest update (promote)?",
198
+ "Promote выполнен: распространение возвращено к latest": "Promote completed: distribution returned to latest",
199
+ "Promote не выполнен": "Promote failed",
200
+ "Апдейт деактивирован": "Update deactivated",
201
+ "Апдейт активирован": "Update activated",
202
+ "Не удалось изменить статус": "Could not change status",
203
+ "Нельзя удалить активный апдейт": "Cannot delete an active update",
204
+ "Удалить апдейт полностью из bucket?": "Delete the update and all its files from the bucket?",
205
+ "Не удалось удалить апдейт": "Could not delete update",
206
+ "← Все обновления": "← All updates",
207
+ "Детали обновления": "Update details",
208
+ "Метаданные, политика доставки и управление публикацией.": "Metadata, delivery policy and release management.",
209
+ "Загрузка...": "Loading...",
210
+ "⚠️ Rollback активен в этом канале/платформе.": "⚠️ Rollback is active in this channel/platform.",
211
+ "Сейчас раздаётся updateId: ": "Currently serving update ID: ",
212
+ "Новые апдейты автоматически игнорируются до выполнения Promote.": "New updates are ignored until Promote is performed.",
213
+ "Этот апдейт сейчас не доставляется.": "This update is not being delivered.",
214
+ "Причина: активен rollback, автодоставка новых апдейтов выключена.": "Reason: rollback is active and automatic delivery of new updates is disabled.",
215
+ "Активен": "Active",
216
+ "Доставка": "Delivery",
217
+ "Комментарий": "Message",
218
+ "Активный update ID": "Active update ID",
219
+ "Активировать": "Activate",
220
+ "Деактивировать": "Deactivate",
221
+ "Удалить апдейт": "Delete update",
222
+ "JSON файл": "JSON file",
223
+ "Выбор JSON файла": "Select JSON file",
224
+ "Сохранить JSON": "Save JSON",
225
+ "Редактирование channel latest.json заблокировано: активен rollback или глобальный аварийный выключатель.": "Editing channel latest.json is blocked: rollback or the global emergency stop is active.",
226
+ "Активация через update-meta.json недоступна при глобальной блокировке. Деактивация с isActive=false остаётся доступна.": "Activation through update-meta.json is unavailable during a global stop. Deactivation with isActive=false remains available.",
227
+ "Редактор JSON": "JSON editor",
228
+ "Не удалось загрузить emergency redirects": "Could not load emergency redirects",
229
+ "Emergency redirect обновлён": "Emergency redirect updated",
230
+ "Emergency redirect создан": "Emergency redirect created",
231
+ "Не удалось сохранить emergency redirect": "Could not save emergency redirect",
232
+ "Redirect отключён": "Redirect disabled",
233
+ "Redirect включён": "Redirect enabled",
234
+ "Удалить emergency redirect \"{0}\"?": "Delete emergency redirect \"{0}\"?",
235
+ "Emergency redirect удалён": "Emergency redirect deleted",
236
+ "Не удалось удалить redirect": "Could not delete redirect",
237
+ "Точечное перенаправление ошибочных embedded builds между каналами.": "Targeted cross-channel recovery for faulty embedded builds.",
238
+ " правил": " rules",
239
+ "Редактирование правила": "Edit rule",
240
+ "Новое правило": "New rule",
241
+ "Отменить": "Cancel",
242
+ "Название": "Name",
243
+ "Включить правило сразу после сохранения": "Enable rule immediately after saving",
244
+ "Сохранение...": "Saving...",
245
+ "Сохранить изменения": "Save changes",
246
+ "Создать redirect": "Create redirect",
247
+ "Emergency redirects не настроены": "No emergency redirects configured",
248
+ "Не удалось загрузить embedded обновления": "Could not load embedded updates",
249
+ "Удалить запись embedded update {0}?": "Delete embedded update record {0}?",
250
+ "Запись удалена: {0}": "Record deleted: {0}",
251
+ "Не удалось удалить запись embedded update": "Could not delete embedded update record",
252
+ "Встроенные версии приложения и регистрация нативных сборок.": "Embedded app versions and native build registration.",
253
+ " сборок": " builds",
254
+ "Embedded записи не найдены": "No embedded records found",
255
+ "Удаление...": "Deleting...",
256
+ "Удалить": "Delete",
257
+ "Не удалось загрузить список": "Could not load updates",
258
+ "Публикации, версии и управление доставкой обновлений.": "Releases, versions and update delivery management.",
259
+ " Обновить": " Refresh",
260
+ "Rollback активен": "Rollback active",
261
+ "Автодоставка новых обновлений временно отключена.": "Automatic delivery of new updates is temporarily disabled.",
262
+ " Новые публикации в этих scope помечены как ignored.": " New releases in these scopes are marked as ignored.",
263
+ "Публикации": "Releases",
264
+ "Сортировка списка апдейтов": "Sort update list",
265
+ "По дате": "By date",
266
+ "По runtime": "By runtime",
267
+ "По платформе": "By platform",
268
+ "По каналу": "By channel",
269
+ "По stage": "By stage",
270
+ "По статусу": "By status",
271
+ "По ID": "By ID",
272
+ "Сортировать по убыванию": "Sort descending",
273
+ "Сортировать по возрастанию": "Sort ascending",
274
+ "Обновление": "Update",
275
+ "Состояние": "Status",
276
+ "Создано": "Created",
277
+ "Загрузка обновлений…": "Loading updates…",
278
+ "Обновлений пока нет": "No updates yet",
279
+ "Опубликуйте OTA, чтобы управлять его доставкой здесь.": "Publish an OTA to manage its delivery here.",
280
+ "Без комментария": "No message",
281
+ "Выбранные устройства": "Selected devices",
282
+ "Страница ": "Page ",
283
+ "Вперёд": "Next",
284
+ "Неверные учётные данные": "Invalid credentials",
285
+ "Вход временно недоступен": "Login is temporarily unavailable"
286
+ }
@@ -0,0 +1,42 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { createTranslator, resolveLocale } from "./messages";
3
+ import english from "./en.json";
4
+
5
+ describe("admin interface language", () => {
6
+ it("defaults to English regardless of an absent or unsupported preference", () => {
7
+ expect(resolveLocale(undefined)).toBe("en");
8
+ expect(resolveLocale("uk")).toBe("en");
9
+ expect(resolveLocale("en")).toBe("en");
10
+ expect(resolveLocale("ru")).toBe("ru");
11
+ });
12
+ it("translates labels without translating recipient data", () => {
13
+ expect(createTranslator("en")("Установки")).toBe("Installations");
14
+ expect(createTranslator("ru")("Установки")).toBe("Установки");
15
+ expect(createTranslator("ru")("Invalid credentials")).toBe(
16
+ "Неверные учётные данные",
17
+ );
18
+ expect(
19
+ createTranslator("en")("Канал {0}, {1}", ["Мой канал", "android"]),
20
+ ).toBe("Channel Мой канал, android");
21
+ expect(createTranslator("en")("Скопировать {0}", ["$& <script>"])).toBe(
22
+ "Copy $& <script>",
23
+ );
24
+ });
25
+ it("preserves every interpolation slot in the English catalog", () => {
26
+ const slots = (s: string) =>
27
+ [...s.matchAll(/\{\d+\}/g)].map(([value]) => value).sort();
28
+ for (const [source, translated] of Object.entries(english)) {
29
+ expect(translated.trim(), source).not.toBe("");
30
+ expect(translated, source).not.toMatch(/[А-Яа-яЁё]/);
31
+ expect(slots(translated), source).toEqual(slots(source));
32
+ }
33
+ });
34
+ it("preserves unknown technical errors and incomplete placeholders", () => {
35
+ expect(createTranslator("en")("HTTP 503")).toBe("HTTP 503");
36
+ expect(createTranslator("en")("constructor")).toBe("constructor");
37
+ expect(createTranslator("ru")("toString")).toBe("toString");
38
+ expect(createTranslator("en")("Канал {0}, {1}", ["preview"])).toBe(
39
+ "Channel preview, {1}",
40
+ );
41
+ });
42
+ });
@@ -0,0 +1,31 @@
1
+ import english from "./en.json";
2
+
3
+ const englishByRussian = new Map<string, string>(Object.entries(english));
4
+ const russianByEnglish = new Map<string, string>(
5
+ Object.entries(english).map(([russian, translated]) => [translated, russian]),
6
+ );
7
+
8
+ export type Locale = "en" | "ru";
9
+ export const LOCALE_COOKIE = "ota-locale";
10
+ export const defaultLocale: Locale = "en";
11
+ export function resolveLocale(value: string | undefined): Locale {
12
+ return value === "ru" ? "ru" : defaultLocale;
13
+ }
14
+
15
+ /** Original Russian messages are keys; interpolate values without translating user data. */
16
+ export function createTranslator(locale: Locale) {
17
+ return (
18
+ message: string,
19
+ values: readonly (string | number | null | undefined)[] = [],
20
+ ) => {
21
+ const translated =
22
+ locale === "en"
23
+ ? (englishByRussian.get(message) ?? message)
24
+ : (russianByEnglish.get(message) ?? message);
25
+ return translated.replace(/\{(\d+)\}/g, (placeholder, index) =>
26
+ values[Number(index)] === undefined
27
+ ? placeholder
28
+ : String(values[Number(index)]),
29
+ );
30
+ };
31
+ }
@@ -0,0 +1,55 @@
1
+ "use client";
2
+
3
+ import {
4
+ createContext,
5
+ useContext,
6
+ useMemo,
7
+ useState,
8
+ type ReactNode,
9
+ } from "react";
10
+ import {
11
+ createTranslator,
12
+ defaultLocale,
13
+ LOCALE_COOKIE,
14
+ type Locale,
15
+ } from "./messages";
16
+
17
+ const defaultValue = {
18
+ locale: defaultLocale,
19
+ formatLocale: "en-US",
20
+ t: createTranslator(defaultLocale),
21
+ setLocale: (_locale: Locale) => {
22
+ void _locale;
23
+ },
24
+ };
25
+ const LocaleContext = createContext(defaultValue);
26
+
27
+ export function LocaleProvider({
28
+ initialLocale,
29
+ children,
30
+ }: {
31
+ initialLocale: Locale;
32
+ children: ReactNode;
33
+ }) {
34
+ const [locale, updateLocale] = useState(initialLocale);
35
+ const value = useMemo(
36
+ () => ({
37
+ locale,
38
+ formatLocale: locale === "ru" ? "ru-RU" : "en-US",
39
+ t: createTranslator(locale),
40
+ setLocale(next: Locale) {
41
+ document.cookie = `${LOCALE_COOKIE}=${next}; Path=/; Max-Age=31536000; SameSite=Lax`;
42
+ document.documentElement.lang = next;
43
+ updateLocale(next);
44
+ },
45
+ }),
46
+ [locale],
47
+ );
48
+ return (
49
+ <LocaleContext.Provider value={value}>{children}</LocaleContext.Provider>
50
+ );
51
+ }
52
+
53
+ export function useI18n() {
54
+ return useContext(LocaleContext);
55
+ }
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { useMemo } from "react";
3
+ import { useI18n } from "./provider";
4
+
5
+ export function useFormatters() {
6
+ const { formatLocale } = useI18n();
7
+ return useMemo(
8
+ () => ({
9
+ number: (value: number) =>
10
+ new Intl.NumberFormat(formatLocale).format(value),
11
+ date: (value: string) =>
12
+ new Intl.DateTimeFormat(formatLocale, {
13
+ day: "2-digit",
14
+ month: "short",
15
+ timeZone: "UTC",
16
+ }).format(new Date(value)),
17
+ fullDate: (value: string | null) =>
18
+ value
19
+ ? new Intl.DateTimeFormat(formatLocale, {
20
+ dateStyle: "medium",
21
+ timeStyle: "short",
22
+ timeZone: "UTC",
23
+ }).format(new Date(value)) + " UTC"
24
+ : "—",
25
+ share: (count: number, total: number) => {
26
+ if (!total) return "—";
27
+ const formatter = new Intl.NumberFormat(formatLocale, {
28
+ style: "percent",
29
+ maximumFractionDigits: 1,
30
+ });
31
+ if (count > 0 && count / total < 0.001)
32
+ return "<" + formatter.format(0.001);
33
+ return formatter.format(count / total);
34
+ },
35
+ }),
36
+ [formatLocale],
37
+ );
38
+ }
@@ -1,10 +1,12 @@
1
1
  "use client";
2
+ import { useI18n } from "@/src/client/i18n/provider";
2
3
 
3
4
  import { adminLogout } from "@/src/client/admin-api";
4
5
  import { useRouter } from "next/navigation";
5
6
  import { useState } from "react";
6
7
 
7
8
  export default function LogoutButton() {
9
+ const { t } = useI18n();
8
10
  const [isLoading, setIsLoading] = useState(false);
9
11
  const router = useRouter();
10
12
 
@@ -25,7 +27,7 @@ export default function LogoutButton() {
25
27
  disabled={isLoading}
26
28
  className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-zinc-700 dark:hover:bg-zinc-900"
27
29
  >
28
- {isLoading ? "Выход..." : "Выйти"}
30
+ {isLoading ? t("Выход...") : t("Выйти")}
29
31
  </button>
30
32
  );
31
33
  }