rover self updating!

This commit is contained in:
legop3
2026-06-05 15:09:10 -04:00
parent 870de4f135
commit c097d94ba8
14 changed files with 359 additions and 132 deletions
@@ -21,6 +21,7 @@ Rules:
- Only talk in first person, do not narrate yourself.
- It is not possible for you to control the rovers.
- All rovers are female. Neato is nonbinary.
- Do not play a neato sound unless you are instructed to.
Chat style:
- Always use English.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -11,7 +11,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Roomba Rover" />
<title>Roomba Rover</title>
<script type="module" crossorigin src="/assets/index-DxjZG9qS.js"></script>
<script type="module" crossorigin src="/assets/index-BTF4sS2O.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D6X9qUts.css">
</head>
<body>
+7 -2
View File
@@ -82,15 +82,20 @@ io.on('connection', (socket) => {
}
const payload = data ? { ...data } : {};
const isRebootCommand = type === 'reboot';
const isUpdateCommand = type === 'update';
const isSongCommand = type === 'song' || (type === 'raw' && isSongRawPayload(payload));
const isAdminSocket = isAdmin(socket);
if (!isAdminSocket && isDeterred(socket)) {
throw new Error('Not authorized');
}
if (isRebootCommand && !isAdminSocket) {
// Rover updates run a privileged, root-owned helper on the Pi. Keep this
// in the same explicit admin-only branch as reboot instead of relying on
// drive ownership checks, because having a turn should not grant system
// maintenance privileges.
if ((isRebootCommand || isUpdateCommand) && !isAdminSocket) {
throw new Error('Not authorized');
}
if (!isSongCommand && !isRebootCommand && !roverManager.canDrive(roverId, socket)) {
if (!isSongCommand && !isRebootCommand && !isUpdateCommand && !roverManager.canDrive(roverId, socket)) {
throw new Error('Not your turn or no control');
}
const driveDirect = payload?.driveDirect;