Skip to content

Commit bba4d79

Browse files
committed
web: use manifest_hash and effective_url when triggering an install
This ensures that the exact bundle (content) that the user agreed to install is actually installed. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
1 parent 8a21535 commit bba4d79

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

web/src/TacComponents.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ type Duration = {
114114
type UpstreamBundle = {
115115
compatible: string;
116116
version: string;
117+
manifest_hash: string;
118+
effective_url: string;
117119
newer_than_installed: boolean;
118120
};
119121

@@ -128,6 +130,11 @@ type Channel = {
128130
bundle?: UpstreamBundle;
129131
};
130132

133+
type UpdateRequest = {
134+
manifest_hash: string;
135+
url: string;
136+
};
137+
131138
interface SlotStatusProps {
132139
setCmdHint: (hint: React.ReactNode | null) => void;
133140
}
@@ -401,11 +408,16 @@ export function UpdateChannels(props: UpdateChannelsProps) {
401408
return "Up to date";
402409
}
403410

411+
const request: UpdateRequest = {
412+
manifest_hash: e.bundle.manifest_hash,
413+
url: e.bundle.effective_url,
414+
};
415+
404416
return (
405417
<MqttButton
406418
iconName="download"
407419
topic="/v1/tac/update/install"
408-
send={e.url}
420+
send={request}
409421
>
410422
Upgrade
411423
</MqttButton>
@@ -538,7 +550,16 @@ export function UpdateNotification() {
538550
if (channels !== undefined) {
539551
for (let ch of channels) {
540552
if (ch.enabled && ch.bundle && ch.bundle.newer_than_installed) {
541-
updates.push(ch);
553+
const request: UpdateRequest = {
554+
manifest_hash: ch.bundle.manifest_hash,
555+
url: ch.bundle.effective_url,
556+
};
557+
558+
updates.push({
559+
name: ch.name,
560+
display_name: ch.display_name,
561+
request: request,
562+
});
542563
}
543564
}
544565
}
@@ -548,7 +569,7 @@ export function UpdateNotification() {
548569
key={u.name}
549570
iconName="download"
550571
topic="/v1/tac/update/install"
551-
send={u.url}
572+
send={u.request}
552573
>
553574
Install new {u.display_name} bundle
554575
</MqttButton>

0 commit comments

Comments
 (0)