mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 17:40:46 -04:00
rover self updating!
This commit is contained in:
@@ -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
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user