create-expo-updates-server 0.1.6 → 0.2.1
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.
- package/dist/template/.dockerignore +16 -0
- package/dist/template/Dockerfile +5 -0
- package/dist/template/README.md +51 -660
- package/dist/template/app/api/admin/device-targets/route.test.ts +43 -0
- package/dist/template/app/api/admin/device-targets/route.ts +91 -0
- package/dist/template/app/api/admin/devices/route.test.ts +41 -0
- package/dist/template/app/api/admin/devices/route.ts +15 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/audience/route.ts +75 -0
- package/dist/template/app/api/device-heartbeat/route.ts +2 -0
- package/dist/template/app/globals.css +114 -15
- package/dist/template/app/layout.tsx +12 -4
- package/dist/template/app/login/page.tsx +22 -18
- package/dist/template/app/updates/[encodedKey]/page.tsx +112 -88
- package/dist/template/app/updates/devices/page.tsx +264 -0
- package/dist/template/app/updates/embedded/page.tsx +102 -68
- package/dist/template/app/updates/emergency-redirects/page.tsx +144 -111
- package/dist/template/app/updates/layout.tsx +6 -1
- package/dist/template/app/updates/page.tsx +262 -212
- package/dist/template/components/admin/admin-shell.tsx +196 -0
- package/dist/template/components/admin/language-switcher.tsx +25 -0
- package/dist/template/components/admin/theme-provider.tsx +15 -0
- package/dist/template/components/ui/alert.tsx +65 -0
- package/dist/template/components/ui/badge.tsx +47 -0
- package/dist/template/components/ui/button.tsx +63 -0
- package/dist/template/components/ui/card.tsx +91 -0
- package/dist/template/components/ui/chart.tsx +373 -0
- package/dist/template/components/ui/checkbox.tsx +31 -0
- package/dist/template/components/ui/dialog.tsx +158 -0
- package/dist/template/components/ui/dropdown-menu.tsx +256 -0
- package/dist/template/components/ui/input.tsx +20 -0
- package/dist/template/components/ui/label.tsx +23 -0
- package/dist/template/components/ui/native-select.tsx +61 -0
- package/dist/template/components/ui/popover.tsx +88 -0
- package/dist/template/components/ui/scroll-area.tsx +57 -0
- package/dist/template/components/ui/select.tsx +189 -0
- package/dist/template/components/ui/separator.tsx +27 -0
- package/dist/template/components/ui/sheet.tsx +142 -0
- package/dist/template/components/ui/sidebar.tsx +736 -0
- package/dist/template/components/ui/skeleton.tsx +13 -0
- package/dist/template/components/ui/switch.tsx +34 -0
- package/dist/template/components/ui/table.tsx +115 -0
- package/dist/template/components/ui/tabs.tsx +90 -0
- package/dist/template/components/ui/textarea.tsx +17 -0
- package/dist/template/components/ui/tooltip.tsx +56 -0
- package/dist/template/components.json +22 -0
- package/dist/template/docker/minio.Dockerfile +11 -0
- package/dist/template/docker-compose.yml +7 -9
- package/dist/template/docs/admin-ui.md +35 -0
- package/dist/template/docs/device-targeting.md +129 -0
- package/dist/template/docs/doctor.md +137 -0
- package/dist/template/docs/expo-app-setup.md +174 -47
- package/dist/template/docs/getting-started.md +109 -146
- package/dist/template/docs/getting-started.ru.md +110 -193
- package/dist/template/docs/index.md +14 -33
- package/dist/template/docs/installation-telemetry.md +233 -0
- package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +89 -0
- package/dist/template/docs/migrations/2026-10-19-device-heartbeat.sql +131 -0
- package/dist/template/docs/migrations/2026-10-22-device-analytics.sql +264 -0
- package/dist/template/docs/migrations/2026-10-22-device-targeting-activation.sql +108 -0
- package/dist/template/docs/migrations/2026-10-22-device-targeting.sql +130 -0
- package/dist/template/docs/migrations/2026-10-22-device-version-metadata.sql +154 -0
- package/dist/template/docs/migrations/schema.sql +868 -6
- package/dist/template/docs/npm-installer.md +15 -30
- package/dist/template/docs/operations-guide.md +87 -0
- package/dist/template/docs/ota-client-lifecycle.md +263 -0
- package/dist/template/docs/ota-update-policy.md +36 -2
- package/dist/template/docs/supabase-setup.md +4 -0
- package/dist/template/hooks/use-mobile.ts +21 -0
- package/dist/template/lib/utils.ts +6 -0
- package/dist/template/package-lock.json +2325 -101
- package/dist/template/package.json +13 -3
- package/dist/template/scripts/configure-expo-app.mjs +11 -15
- package/dist/template/scripts/doctor.mjs +51 -0
- package/dist/template/scripts/ensure-storage-bucket.mjs +25 -0
- package/dist/template/scripts/ensure-test-bucket.mjs +21 -0
- package/dist/template/scripts/lib/device-identity.test.ts +29 -0
- package/dist/template/scripts/lib/doctor-probes.mjs +139 -0
- package/dist/template/scripts/lib/doctor.mjs +208 -0
- package/dist/template/scripts/lib/doctor.test.mjs +262 -0
- package/dist/template/scripts/lib/expo-app-configurator.mjs +14 -9
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +3 -2
- package/dist/template/scripts/lib/ota-client-configurator.mjs +69 -0
- package/dist/template/scripts/lib/ota-client-configurator.test.ts +88 -0
- package/dist/template/scripts/lib/ota-client.test.ts +55 -0
- package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +173 -0
- package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +123 -0
- package/dist/template/scripts/lib/ota-update-controller.test.ts +231 -0
- package/dist/template/scripts/tests/device-analytics-migrations.mjs +80 -0
- package/dist/template/scripts/tests/device-analytics.mjs +126 -0
- package/dist/template/scripts/tests/device-heartbeat.mjs +86 -0
- package/dist/template/scripts/tests/device-targeting-activation.mjs +111 -0
- package/dist/template/scripts/tests/device-targeting.mjs +39 -0
- package/dist/template/scripts/tests/device-version-metadata.mjs +31 -0
- package/dist/template/scripts/tests/manifest-identity-concurrency.mjs +106 -0
- package/dist/template/scripts/tests/manifest-identity.sql +204 -0
- package/dist/template/src/client/admin-types.ts +1 -0
- package/dist/template/src/client/devices/analytics.tsx +429 -0
- package/dist/template/src/client/devices/device-name.tsx +82 -0
- package/dist/template/src/client/devices/registry.tsx +399 -0
- package/dist/template/src/client/devices/use-devices-report.ts +108 -0
- package/dist/template/src/client/devices/version-adoption-chart.tsx +269 -0
- package/dist/template/src/client/devices/version-groups.test.ts +57 -0
- package/dist/template/src/client/devices/version-groups.ts +101 -0
- package/dist/template/src/client/distribution-control.tsx +135 -81
- package/dist/template/src/client/guard-action-combobox.tsx +13 -24
- package/dist/template/src/client/i18n/en.json +286 -0
- package/dist/template/src/client/i18n/messages.test.ts +42 -0
- package/dist/template/src/client/i18n/messages.ts +31 -0
- package/dist/template/src/client/i18n/provider.tsx +55 -0
- package/dist/template/src/client/i18n/use-formatters.ts +38 -0
- package/dist/template/src/client/logout-button.tsx +3 -1
- package/dist/template/src/client/update-audience-editor.tsx +285 -0
- package/dist/template/src/client/update-policy-editor.tsx +53 -41
- package/dist/template/src/server/controllers/manifest.test.ts +250 -7
- package/dist/template/src/server/controllers/manifest.ts +39 -31
- package/dist/template/src/server/devices/audience.test.ts +48 -0
- package/dist/template/src/server/devices/audience.ts +86 -0
- package/dist/template/src/server/devices/heartbeat.test.ts +39 -0
- package/dist/template/src/server/devices/heartbeat.ts +75 -0
- package/dist/template/src/server/devices/report-types.ts +114 -0
- package/dist/template/src/server/devices/report.test.ts +29 -0
- package/dist/template/src/server/devices/report.ts +27 -0
- package/dist/template/src/server/lib/admin-audience-activation.test.ts +94 -0
- package/dist/template/src/server/lib/admin-updates.ts +32 -168
- package/dist/template/src/server/lib/supabase.js +10 -10
- package/dist/template/src/server/lib/supabase.test.ts +11 -0
- package/dist/template/src/server/manifest/manifest-identity.test.ts +30 -0
- package/dist/template/src/server/manifest/manifest-identity.ts +24 -0
- package/dist/template/src/server/manifest/manifest-repository.ts +31 -102
- package/dist/template/src/server/manifest/manifest-response.ts +1 -1
- package/dist/template/templates/expo-app/ota-client/README.md +59 -0
- package/dist/template/templates/expo-app/ota-client/controller.js +60 -0
- package/dist/template/templates/expo-app/ota-client/device-identity.js +26 -0
- package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +52 -0
- package/dist/template/templates/expo-app/ota-client/index.d.ts +47 -0
- package/dist/template/templates/expo-app/ota-client/index.js +3 -0
- package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.js +48 -0
- package/dist/template/templates/expo-app/ota-client/model/update-controller.js +182 -0
- package/dist/template/templates/expo-app/ota-client/runtime.js +112 -0
- package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.js +56 -0
- package/dist/template-manifest.json +592 -77
- package/lib/cli.mjs +4 -6
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
|
|
3
|
+
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
data-slot="skeleton"
|
|
7
|
+
className={cn("animate-pulse rounded-md bg-accent", className)}
|
|
8
|
+
{...props}
|
|
9
|
+
/>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Skeleton };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
6
|
+
|
|
7
|
+
function Switch({
|
|
8
|
+
className,
|
|
9
|
+
size = "default",
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
12
|
+
size?: "sm" | "default";
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<SwitchPrimitive.Root
|
|
16
|
+
data-slot="switch"
|
|
17
|
+
data-size={size}
|
|
18
|
+
className={cn(
|
|
19
|
+
"peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
<SwitchPrimitive.Thumb
|
|
25
|
+
data-slot="switch-thumb"
|
|
26
|
+
className={cn(
|
|
27
|
+
"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground",
|
|
28
|
+
)}
|
|
29
|
+
/>
|
|
30
|
+
</SwitchPrimitive.Root>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Switch };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
data-slot="table-container"
|
|
10
|
+
className="relative w-full overflow-x-auto"
|
|
11
|
+
>
|
|
12
|
+
<table
|
|
13
|
+
data-slot="table"
|
|
14
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
|
22
|
+
return (
|
|
23
|
+
<thead
|
|
24
|
+
data-slot="table-header"
|
|
25
|
+
className={cn("[&_tr]:border-b", className)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
|
|
32
|
+
return (
|
|
33
|
+
<tbody
|
|
34
|
+
data-slot="table-body"
|
|
35
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
|
42
|
+
return (
|
|
43
|
+
<tfoot
|
|
44
|
+
data-slot="table-footer"
|
|
45
|
+
className={cn(
|
|
46
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
|
55
|
+
return (
|
|
56
|
+
<tr
|
|
57
|
+
data-slot="table-row"
|
|
58
|
+
className={cn(
|
|
59
|
+
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
60
|
+
className,
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
68
|
+
return (
|
|
69
|
+
<th
|
|
70
|
+
data-slot="table-head"
|
|
71
|
+
className={cn(
|
|
72
|
+
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
73
|
+
className,
|
|
74
|
+
)}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
|
81
|
+
return (
|
|
82
|
+
<td
|
|
83
|
+
data-slot="table-cell"
|
|
84
|
+
className={cn(
|
|
85
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
86
|
+
className,
|
|
87
|
+
)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function TableCaption({
|
|
94
|
+
className,
|
|
95
|
+
...props
|
|
96
|
+
}: React.ComponentProps<"caption">) {
|
|
97
|
+
return (
|
|
98
|
+
<caption
|
|
99
|
+
data-slot="table-caption"
|
|
100
|
+
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
Table,
|
|
108
|
+
TableHeader,
|
|
109
|
+
TableBody,
|
|
110
|
+
TableFooter,
|
|
111
|
+
TableHead,
|
|
112
|
+
TableRow,
|
|
113
|
+
TableCell,
|
|
114
|
+
TableCaption,
|
|
115
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
7
|
+
|
|
8
|
+
function Tabs({
|
|
9
|
+
className,
|
|
10
|
+
orientation = "horizontal",
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof TabsPrimitive.Root>) {
|
|
13
|
+
return (
|
|
14
|
+
<TabsPrimitive.Root
|
|
15
|
+
data-slot="tabs"
|
|
16
|
+
data-orientation={orientation}
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
className={cn(
|
|
19
|
+
"group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const tabsListVariants = cva(
|
|
28
|
+
"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
variant: {
|
|
32
|
+
default: "bg-muted",
|
|
33
|
+
line: "gap-1 bg-transparent",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
variant: "default",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
function TabsList({
|
|
43
|
+
className,
|
|
44
|
+
variant = "default",
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<typeof TabsPrimitive.List> &
|
|
47
|
+
VariantProps<typeof tabsListVariants>) {
|
|
48
|
+
return (
|
|
49
|
+
<TabsPrimitive.List
|
|
50
|
+
data-slot="tabs-list"
|
|
51
|
+
data-variant={variant}
|
|
52
|
+
className={cn(tabsListVariants({ variant }), className)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function TabsTrigger({
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
|
|
62
|
+
return (
|
|
63
|
+
<TabsPrimitive.Trigger
|
|
64
|
+
data-slot="tabs-trigger"
|
|
65
|
+
className={cn(
|
|
66
|
+
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
67
|
+
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent",
|
|
68
|
+
"data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground",
|
|
69
|
+
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",
|
|
70
|
+
className,
|
|
71
|
+
)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function TabsContent({
|
|
78
|
+
className,
|
|
79
|
+
...props
|
|
80
|
+
}: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
|
81
|
+
return (
|
|
82
|
+
<TabsPrimitive.Content
|
|
83
|
+
data-slot="tabs-content"
|
|
84
|
+
className={cn("flex-1 outline-none", className)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
5
|
+
return (
|
|
6
|
+
<textarea
|
|
7
|
+
data-slot="textarea"
|
|
8
|
+
className={cn(
|
|
9
|
+
"flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
10
|
+
className,
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Textarea };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
6
|
+
|
|
7
|
+
function TooltipProvider({
|
|
8
|
+
delayDuration = 0,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
11
|
+
return (
|
|
12
|
+
<TooltipPrimitive.Provider
|
|
13
|
+
data-slot="tooltip-provider"
|
|
14
|
+
delayDuration={delayDuration}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function Tooltip({
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
23
|
+
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function TooltipTrigger({
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
29
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function TooltipContent({
|
|
33
|
+
className,
|
|
34
|
+
sideOffset = 0,
|
|
35
|
+
children,
|
|
36
|
+
...props
|
|
37
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
38
|
+
return (
|
|
39
|
+
<TooltipPrimitive.Portal>
|
|
40
|
+
<TooltipPrimitive.Content
|
|
41
|
+
data-slot="tooltip-content"
|
|
42
|
+
sideOffset={sideOffset}
|
|
43
|
+
className={cn(
|
|
44
|
+
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
|
51
|
+
</TooltipPrimitive.Content>
|
|
52
|
+
</TooltipPrimitive.Portal>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "app/globals.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"iconLibrary": "lucide",
|
|
14
|
+
"aliases": {
|
|
15
|
+
"components": "@/components",
|
|
16
|
+
"utils": "@/lib/utils",
|
|
17
|
+
"ui": "@/components/ui",
|
|
18
|
+
"lib": "@/lib",
|
|
19
|
+
"hooks": "@/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {}
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Community images are no longer published on Docker Hub. Build a pinned release.
|
|
2
|
+
FROM golang:1.24.8-alpine AS builder
|
|
3
|
+
RUN apk add --no-cache git ca-certificates
|
|
4
|
+
ENV CGO_ENABLED=0 GOMAXPROCS=2
|
|
5
|
+
RUN go install -p 2 github.com/minio/minio@RELEASE.2025-10-15T17-29-55Z \
|
|
6
|
+
&& go clean -cache -modcache
|
|
7
|
+
|
|
8
|
+
FROM alpine:3.22
|
|
9
|
+
RUN apk add --no-cache ca-certificates curl
|
|
10
|
+
COPY --from=builder /go/bin/minio /usr/local/bin/minio
|
|
11
|
+
ENTRYPOINT ["minio"]
|
|
@@ -22,7 +22,9 @@ services:
|
|
|
22
22
|
retries: 20
|
|
23
23
|
|
|
24
24
|
minio:
|
|
25
|
-
|
|
25
|
+
build:
|
|
26
|
+
context: .
|
|
27
|
+
dockerfile: docker/minio.Dockerfile
|
|
26
28
|
restart: unless-stopped
|
|
27
29
|
command: server /data --console-address ":9001"
|
|
28
30
|
environment:
|
|
@@ -40,17 +42,13 @@ services:
|
|
|
40
42
|
retries: 20
|
|
41
43
|
|
|
42
44
|
minio-init:
|
|
43
|
-
|
|
45
|
+
build:
|
|
46
|
+
context: .
|
|
47
|
+
dockerfile: Dockerfile
|
|
48
|
+
target: storage-init
|
|
44
49
|
depends_on:
|
|
45
50
|
minio:
|
|
46
51
|
condition: service_healthy
|
|
47
|
-
entrypoint:
|
|
48
|
-
- /bin/sh
|
|
49
|
-
- -c
|
|
50
|
-
- >
|
|
51
|
-
mc alias set local http://minio:9000
|
|
52
|
-
"$${MINIO_ROOT_USER}" "$${MINIO_ROOT_PASSWORD}" &&
|
|
53
|
-
mc mb --ignore-existing "local/$${OTA_STORAGE_BUCKET}"
|
|
54
52
|
environment:
|
|
55
53
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-expo_updates}
|
|
56
54
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-expo_updates_local}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Панель управления
|
|
2
|
+
|
|
3
|
+
Админка использует общий UI kit shadcn/ui (Radix), Tailwind CSS 4, Lucide и Recharts. Исходники компонентов находятся в `components/ui`, тема — в `app/globals.css`, оболочка — в `components/admin`. Светлая и тёмная темы используют одни семантические токены. Новые страницы должны использовать эти компоненты и токены, сохраняя серверную проверку сессии в `app/updates/layout.tsx`.
|
|
4
|
+
|
|
5
|
+
## Навигация и данные
|
|
6
|
+
|
|
7
|
+
- **Установки** (`/updates/devices`): общие серверные фильтры, KPI, дневная активность, распределение версий, когорты и реестр. Часть Installation ID можно использовать для поиска конкретной установки. Полные идентификаторы и диагностика доступны по нажатию на ID.
|
|
8
|
+
- **OTA-обновления** (`/updates`): список публикаций, сортировка, пагинация и переход к редактированию. Аварийная остановка распространения находится в раскрываемой панели «Управление».
|
|
9
|
+
- **Embedded-сборки** и **Аварийные маршруты** сохраняют существующие ограничения по ролям и действия управления.
|
|
10
|
+
|
|
11
|
+
Фильтры применяются кнопкой «Применить» ко всей выборке. Ошибка запроса оставляет предыдущий результат с явным сообщением. Если последняя страница исчезла при обновлении, реестр переходит на последнюю существующую страницу. Статистика считает установки, а не уникальных людей.
|
|
12
|
+
|
|
13
|
+
Подробная семантика дневных данных, когорт, возвращаемости и миграция существующей базы: [Телеметрия установок](./installation-telemetry.md). Для существующей базы нужна миграция `2026-10-22-device-analytics.sql`; новая база получает её из канонического `schema.sql`.
|
|
14
|
+
|
|
15
|
+
## Проверка интерфейса
|
|
16
|
+
|
|
17
|
+
При изменениях проверяйте ширины 1440 и 390 px, обе темы, фильтры с пустым результатом, сброс фильтров, раскрытие и копирование ID, клавиатурное закрытие боковых панелей с возвратом фокуса, повтор пагинации после ошибки и уменьшение числа записей на последней странице. Таблицы могут прокручиваться внутри карточки; горизонтальная прокрутка всей страницы не нужна. Историю до начала сбора нельзя заменять нулями или демонстрационными данными.
|
|
18
|
+
|
|
19
|
+
Команды проверки: `npm run lint`, `npx tsc --noEmit`, `npm test`, `npm run build`, `npm run installer:check`. Новые папки UI включены в шаблон npm-инсталлятора, поэтому панель получает тот же интерфейс при установке из коробки.
|
|
20
|
+
|
|
21
|
+
## Interface language
|
|
22
|
+
|
|
23
|
+
The admin panel defaults to English, including when the browser prefers another
|
|
24
|
+
language. Select **English** or **Русский** on the sign-in screen or in the admin
|
|
25
|
+
header. The choice persists in the `ota-locale` cookie for one year and is applied
|
|
26
|
+
on the server for the next page load. Unknown locale values fall back to English.
|
|
27
|
+
Switching languages preserves filters and unsaved form data; number/date formatting
|
|
28
|
+
follows the selected locale. Analytics date boundaries remain UTC.
|
|
29
|
+
|
|
30
|
+
UI translations live in `src/client/i18n/`. Russian source messages are catalog keys
|
|
31
|
+
and `en.json` supplies their English equivalents. Use `useI18n().t` for interface
|
|
32
|
+
copy and `useFormatters()` for analytics values. Keep interpolation slots intact.
|
|
33
|
+
Do not translate API enum values, IDs, JSON, device names or user-written messages.
|
|
34
|
+
Adding a language requires an explicit supported locale, catalog and selector option;
|
|
35
|
+
browser language detection is deliberately not used for the default.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Device-targeted OTA releases
|
|
2
|
+
|
|
3
|
+
A release has an audience (`all` or `devices`) independently of its delivery/guard policy.
|
|
4
|
+
The audience is checked before choosing a manifest. Runtime, channel and platform still
|
|
5
|
+
have to match. A force-update guard does not bypass the audience.
|
|
6
|
+
|
|
7
|
+
## Smoke test, then release
|
|
8
|
+
|
|
9
|
+
1. Configure the application with `npm run configure-app`. The generated `ota-entry.js`
|
|
10
|
+
starts the client before the original Router/custom entry; no manual hook or ID wiring
|
|
11
|
+
is required. Existing generated files can be refreshed with `--force` (review local edits).
|
|
12
|
+
2. Rebuild the native app after adding `expo-secure-store`; use a new runtime so older
|
|
13
|
+
binaries cannot download JavaScript importing a missing native module.
|
|
14
|
+
3. Open the app. In **Установки → installation details**, copy its Device ID or name it
|
|
15
|
+
**Мой телефон**. Older clients still report Installation ID and can be targeted by it.
|
|
16
|
+
4. Publish with the generated `npm run ota:publish -- --platform android --message "Smoke"`.
|
|
17
|
+
Publishing creates a draft. In its detail page select **Аудитория обновления → Только
|
|
18
|
+
выбранные устройства / установки**, choose your phone, and **save before activation**.
|
|
19
|
+
5. Activate the draft. Your device gets it; other compatible devices get the previous
|
|
20
|
+
eligible public update, or no update if one does not exist.
|
|
21
|
+
6. After testing, set the audience to **Все совместимые устройства** and save. The same
|
|
22
|
+
artifact is now eligible for everyone. No second publish is needed.
|
|
23
|
+
|
|
24
|
+
Changing an active audience affects future checks immediately. It does not uninstall or
|
|
25
|
+
revoke cached/downloaded OTA bundles. Use the existing rollback flow to change the running
|
|
26
|
+
version. Targeting is a rollout mechanism, not authentication or confidential asset storage:
|
|
27
|
+
client IDs can be supplied by a modified client and asset URLs remain accessible.
|
|
28
|
+
|
|
29
|
+
## Two identities
|
|
30
|
+
|
|
31
|
+
- **Installation ID**: random UUID in AsyncStorage. Continues through OTA, changes after
|
|
32
|
+
uninstall/clear data. It remains the unit counted in installation/cohort analytics.
|
|
33
|
+
- **Device ID**: SHA-256 value scoped to the app ID and an OTA-server namespace. On Android,
|
|
34
|
+
the input is `expo-application.getAndroidId()` (signing key + Android user + device). On
|
|
35
|
+
iOS, the input is a random UUID stored through `expo-secure-store` with
|
|
36
|
+
`WHEN_UNLOCKED_THIS_DEVICE_ONLY`, so a backup restored on a different phone does not
|
|
37
|
+
deliberately copy this identity. Raw platform IDs are never sent to the server.
|
|
38
|
+
|
|
39
|
+
Android reinstall with the same signing key normally keeps Device ID. Factory reset,
|
|
40
|
+
Android user/profile or signing key changes can change it. iOS Keychain often survives
|
|
41
|
+
reinstall with the same bundle ID, but persistence across uninstall is not guaranteed.
|
|
42
|
+
If Device ID changes, select the new device in the audience again. There is no universal,
|
|
43
|
+
permanent physical-device identity. The admin name belongs to Device ID, not Installation ID.
|
|
44
|
+
|
|
45
|
+
`ota-client/config.json.identityNamespace` is preserved on reconfiguration, including
|
|
46
|
+
server/tunnel URL changes. Keep this generated file with application source. Runtime and
|
|
47
|
+
channel are deliberately not part of Device ID. A separate application or server should
|
|
48
|
+
use its own namespace.
|
|
49
|
+
|
|
50
|
+
Official API references: [Expo Application](https://docs.expo.dev/versions/v58.0.0/sdk/application/),
|
|
51
|
+
[Expo SecureStore](https://docs.expo.dev/versions/v58.0.0/sdk/securestore/),
|
|
52
|
+
[Expo extra parameters](https://docs.expo.dev/versions/v58.0.0/sdk/updates/#updatessetextraparamasynckey-value).
|
|
53
|
+
|
|
54
|
+
## Client initialization
|
|
55
|
+
|
|
56
|
+
Generated entry calls `start()` automatically, persists installation identity and sets
|
|
57
|
+
`installation_id` / `device_id` via `Updates.setExtraParamAsync`. Heartbeat adds optional
|
|
58
|
+
`deviceId`. The durable queue and monotonic per-installation sequence are unchanged.
|
|
59
|
+
An unavailable Device ID does not stop installation telemetry; device targeting fails closed.
|
|
60
|
+
The iOS identity read retries after temporary Keychain failure without replacing its seed.
|
|
61
|
+
|
|
62
|
+
For custom check/download UI use the generated `checkForUpdateAsync` and `fetchUpdateAsync`:
|
|
63
|
+
these wait for initialization. Direct calls to `expo-updates` before initialization can
|
|
64
|
+
perform an anonymous check; anonymous clients only receive public updates. Configuration
|
|
65
|
+
sets `checkAutomatically: NEVER`, preserving explicit update-check control. The initializer
|
|
66
|
+
itself does not download/reload updates or alter application navigation.
|
|
67
|
+
|
|
68
|
+
Optional `getInstallationId()` / `getDeviceId()` exports are for displaying diagnostics,
|
|
69
|
+
not required to register the device. Both return null when updates are disabled (web/dev).
|
|
70
|
+
|
|
71
|
+
## Server migration and behavior
|
|
72
|
+
|
|
73
|
+
Apply `docs/migrations/2026-10-22-device-targeting.sql` after the analytics/version migrations,
|
|
74
|
+
before deploying the server. Fresh installations use `docs/migrations/schema.sql`.
|
|
75
|
+
Then apply `docs/migrations/2026-10-22-device-targeting-activation.sql` before deploying
|
|
76
|
+
server changes from the cross review. It atomically applies the public/targeted activation
|
|
77
|
+
rules, preserves deactivation during a global stop, and adds the `ota-force-update` guard
|
|
78
|
+
catalog entry alongside the separate native/store update action. Both migrations are
|
|
79
|
+
repeatable and do not change the audience or active state of existing releases.
|
|
80
|
+
|
|
81
|
+
The targeting migration removes the single-active-release index because a targeted
|
|
82
|
+
release must coexist with its public fallback. Existing releases have audience `all`.
|
|
83
|
+
|
|
84
|
+
Activation, rollback and promotion of a targeted release preserve other active releases.
|
|
85
|
+
Normal public activation keeps the previous behavior of disabling older releases.
|
|
86
|
+
Widening an already-active targeted release leaves the prior public fallback eligible;
|
|
87
|
+
the newer release wins selection. Disabling the targeted release restores fallback selection.
|
|
88
|
+
Explicit rollback has priority, subject to the same audience and compatibility checks.
|
|
89
|
+
Emergency pinned redirects still fail closed when the selected artifact differs.
|
|
90
|
+
|
|
91
|
+
Admin API:
|
|
92
|
+
|
|
93
|
+
- `GET/PUT /api/admin/updates/:encodedKey/audience` uses existing read/write permissions.
|
|
94
|
+
PUT replaces mode and both ID lists with `audience_version` for optimistic concurrency.
|
|
95
|
+
At least one target is required in `devices` mode; maximum 100 IDs of each type.
|
|
96
|
+
The DB serializes audience changes with the emergency distribution switch.
|
|
97
|
+
- `GET /api/admin/device-targets?platform=android|ios` requires an admin session and lists
|
|
98
|
+
the latest 500 installations, including old runtimes. UI search shows up to 50 matches;
|
|
99
|
+
older IDs can be entered manually.
|
|
100
|
+
- `PUT /api/admin/device-targets` names a Device ID (admin/operator session only).
|
|
101
|
+
|
|
102
|
+
Manifest requests read the Expo Structured Field Dictionary `Expo-Extra-Params`.
|
|
103
|
+
Missing/malformed IDs never match a private audience. Responses use `private, no-store`.
|
|
104
|
+
Selection applies eligibility before the latest-active fallback query, never after taking
|
|
105
|
+
only one unfiltered row. Accepted heartbeats can associate a new installation with the same
|
|
106
|
+
Device ID; duplicate/stale events do not relink it or merge installation history.
|
|
107
|
+
|
|
108
|
+
For isolated local Docker configurations, `configure-app --server-env .env.ota-test` uses
|
|
109
|
+
that file's published database/storage ports when generating `.env.ota`.
|
|
110
|
+
|
|
111
|
+
## Verification
|
|
112
|
+
|
|
113
|
+
`npm test`, `npm run lint`, `npx tsc --noEmit` and `npm run installer:check` cover server and
|
|
114
|
+
packaging checks. Run `OTA_TEST_DATABASE_URL=... node scripts/tests/device-targeting.mjs`
|
|
115
|
+
against a migrated disposable/test DB for real PostgreSQL eligibility, compatibility,
|
|
116
|
+
CAS, global block and reinstall tests. Fixtures are rolled back. Device reinstall/Keychain
|
|
117
|
+
behavior additionally requires physical-device testing with the native build.
|
|
118
|
+
|
|
119
|
+
Activation and audience changes are serialized in PostgreSQL. Public activation disables
|
|
120
|
+
other active releases in the same scope within the same statement; a failed activation
|
|
121
|
+
cannot partially disable the previous public release. This also covers the existing
|
|
122
|
+
`update-meta.json` editor. Targeted activation preserves other audiences. During a global
|
|
123
|
+
stop, deactivation can repair stale pointers to the remaining active fallback; activating,
|
|
124
|
+
promoting a live rollback, and changing audiences stay blocked.
|
|
125
|
+
|
|
126
|
+
Run `scripts/tests/device-targeting-activation.mjs` against an **empty disposable database**
|
|
127
|
+
with the complete schema to check concurrent audience changes, failed activation atomicity,
|
|
128
|
+
and incident deactivation. It refuses a database containing releases. The analytics
|
|
129
|
+
migration runner also checks this suite for both fresh and upgrade paths.
|