Skip to content

Commit

Permalink
Add a warning when the user runs an outdated Raspberry Pi OS
Browse files Browse the repository at this point in the history
  • Loading branch information
TojikCZ committed May 23, 2024
1 parent f44c327 commit 609e1c3
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 23 deletions.
2 changes: 2 additions & 0 deletions src/locales/c.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
"msg.modal-p2": "",
"msg.offline.not-responsing": "",
"msg.offline.please-wait": "",
"msg.outdated-os.message": "",
"msg.outdated-os.title": "",
"msg.sla-pour-resin": "",
"msg.sla-refill": "",
"msg.sysupgrade.pending": "",
Expand Down
4 changes: 3 additions & 1 deletion src/locales/source/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,7 @@
"logs.file-size-unknown": "",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
"ntf.low-resin.title": "",
"msg.outdated-os.message": "PrusaLink běží na zastaralém obrazu systému. Nahrajte ho prosím znovu podle <a href='https://help.prusa3d.com/guide/_221744#222170'>tohoto návodu</a>. Bohužel bude nutné PrusaLink znovu nastavit",
"msg.outdated-os.title": "Raspberry Pi OS je zastaralý"
}
4 changes: 3 additions & 1 deletion src/locales/source/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,7 @@
"logs.file-size-unknown": "Die Protokolldatei hat eine unbekannte Größe und ist daher nur zum Herunterladen verfügbar",
"ntf.calibration-error": "Kalibrierungsfehler",
"ntf.low-resin.message": "Die gemessene Harzmenge ist zu gering. Der Druck kann fortgesetzt werden, es kann jedoch ein Nachfüllen erforderlich sein.",
"ntf.low-resin.title": "Harz niedrig"
"ntf.low-resin.title": "Harz niedrig",
"msg.outdated-os.message": "Ihr PrusaLink läuft mit einem veralteten Raspberry Pi Betriebssystem. Folgen Sie <a href='https://help.prusa3d.com/guide/_221744#222170'>dieser Anleitung, um die neueste Version zu flashen</a>. Dies wird PrusaLink zurücksetzen",
"msg.outdated-os.title": "Raspberry Pi OS ist veraltet"
}
4 changes: 3 additions & 1 deletion src/locales/source/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,7 @@
"msg.sysupgrade.title": "Upgrade System Package?",
"msg.sysupgrade.wait-for-printer": "Waiting for the printer...",
"conn.error_status": "Error",
"conn.printer.not-supported": ""
"conn.printer.not-supported": "",
"msg.outdated-os.message": "Your PrusaLink is running on an outdated Raspberry Pi OS. Follow <a href='https://help.prusa3d.com/guide/_221744#222170'>this guide to flash the latest version</a>. This will reset PrusaLink",
"msg.outdated-os.title": "Raspberry Pi OS is out-of-date"
}
4 changes: 3 additions & 1 deletion src/locales/source/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,7 @@
"logs.file-size-unknown": "El archivo de registro es de tamaño desconocido y, por lo tanto, solo está disponible para su descarga.",
"ntf.calibration-error": "Error de calibración",
"ntf.low-resin.message": "El volumen de resina medido es demasiado bajo. La impresión puede continuar, sin embargo, es posible que se requiera una recarga.",
"ntf.low-resin.title": "Poca resina"
"ntf.low-resin.title": "Poca resina",
"msg.outdated-os.message": "Tu PrusaLink está funcionando con un Raspberry Pi OS obsoleto. Sigue <a href='https://help.prusa3d.com/guide/_221744#222170'>esta guía para flashear la última versión</a>. Esto reiniciará PrusaLink",
"msg.outdated-os.title": "El SO de la Raspberry Pi está desactualizado"
}
4 changes: 3 additions & 1 deletion src/locales/source/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,7 @@
"logs.file-size-unknown": "Le fichier de journal est d'une taille inconnue et n'est donc disponible que pour le téléchargement",
"ntf.calibration-error": "Erreur de Calibration",
"ntf.low-resin.message": "Le volume de résine mesuré est trop bas. L'impression peut continuer, mais un remplissage pourra être nécessaire.",
"ntf.low-resin.title": "Niveau de résine bas"
"ntf.low-resin.title": "Niveau de résine bas",
"msg.outdated-os.message": "Votre PrusaLink fonctionne sur un système un Raspberry Pi OS obsolète. Suivez <a href='https://help.prusa3d.com/guide/_221744#222170'>ce guide pour flasher la dernière version</a>. Cela réinitialisera PrusaLink",
"msg.outdated-os.title": "Raspberry Pi OS est obsolète"
}
4 changes: 3 additions & 1 deletion src/locales/source/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,7 @@
"logs.file-size-unknown": "Il file di log è di dimensioni sconosciute e quindi è disponibile solo per il download.",
"ntf.calibration-error": "Errore di calibrazione",
"ntf.low-resin.message": "Il volume di resina misurato è troppo basso. La stampa può continuare, ma potrebbe essere necessaria una ricarica.",
"ntf.low-resin.title": "Resina bassa"
"ntf.low-resin.title": "Resina bassa",
"msg.outdated-os.message": "Il sistema PrusaLink è in esecuzione su un sistema operativo Raspberry Pi non aggiornato. Seguire <a href='https://help.prusa3d.com/it/guide/impostazione-prusalink-e-prusa-connect-mk3-s-_221744#222176'>questa guida per flashare l'ultima versione</a>. Questo ripristinerà PrusaLink",
"msg.outdated-os.title": "Il sistema operativo di Raspberry Pi è obsoleto"
}
6 changes: 4 additions & 2 deletions src/locales/source/kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,7 @@
"logs.file-size-unknown": "로그파일의 크기를 알 수 없으므로 다운로드만 가능합니다.",
"ntf.calibration-error": "캘리브레이션 에러",
"ntf.low-resin.message": "측정된 레진양이 적습니다. 인쇄는 계속할 수 있지만 리필이 필요할 수는 있습니다.",
"ntf.low-resin.title": "레진 부족함"
}
"ntf.low-resin.title": "레진 부족함",
"msg.outdated-os.message": "",
"msg.outdated-os.title": ""
}
4 changes: 3 additions & 1 deletion src/locales/source/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,7 @@
"logs.file-size-unknown": "",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
"ntf.low-resin.title": "",
"msg.outdated-os.message": "",
"msg.outdated-os.title": ""
}
4 changes: 3 additions & 1 deletion src/locales/source/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,7 @@
"logs.file-size-unknown": "",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
"ntf.low-resin.title": "",
"msg.outdated-os.message": "",
"msg.outdated-os.title": ""
}
4 changes: 3 additions & 1 deletion src/locales/source/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,7 @@
"logs.file-size-unknown": "Plik logu ma nieznany rozmiar i dlatego jest dostępny tylko do pobrania",
"ntf.calibration-error": "Błąd kalibracji",
"ntf.low-resin.message": "Zmierzona ilość żywicy jest zbyt niska. Drukowanie można kontynuować, jednak konieczne może być uzupełnienie w trakcie.",
"ntf.low-resin.title": "Niski poziom żywicy"
"ntf.low-resin.title": "Niski poziom żywicy",
"msg.outdated-os.message": "Twój PrusaLink działa na nieaktualnej wersji systemu operacyjnego Raspberry Pi. Postępuj zgodnie z <a href='https://help.prusa3d.com/pl/guide/konfiguracja-prusalink-i-prusa-connect-mk3-s-_221744'>tym przewodnikiem, aby wgrać najnowszą wersję</a>. Spowoduje to zresetowanie PrusaLink",
"msg.outdated-os.title": "System operacyjny Raspberry Pi jest nieaktualny"
}
4 changes: 3 additions & 1 deletion src/locales/source/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,7 @@
"logs.file-size-unknown": "",
"ntf.calibration-error": "",
"ntf.low-resin.message": "",
"ntf.low-resin.title": ""
"ntf.low-resin.title": "",
"msg.outdated-os.message": "",
"msg.outdated-os.title": ""
}
17 changes: 16 additions & 1 deletion src/printer/components/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import {
getSerialNumber,
} from "./settingsActions";
import { handleError } from "./errors";
import { success } from "./toast";
import { success, warning } from "./toast";
import { modal } from "./modal";

let serialNumber = null;
let prusaLinkVersion = null;
let connectUrl = null;
let shownOutdatedOs = false;

const logsModule = process.env.WITH_LOGS
? require("./settings/logs").default
Expand Down Expand Up @@ -68,13 +69,27 @@ function updateApiKey(apiKey) {
}
}

function checkOldLink(data) {
if (shownOutdatedOs ||
typeof data.version.system === "undefined" ||
typeof data.version.system.DESCRIPTION === "undefined" ||
data.version.system.DESCRIPTION !== "Raspbian GNU/Linux 11 (bullseye)") {
return;
}
const message = translate("msg.outdated-os.message");
const title = translate("msg.outdated-os.title");
warning(title, message, ()=> {}, false);
shownOutdatedOs = true;
}

function initBaseSettings() {
getJson("/api/version?system=1")
.then((result) => {
const data = {
version: result.data,
};
prusaLinkVersion = data.version.server;
checkOldLink(data);
updateProperties("settings", data);
updateSystemVersionProperties(data);
})
Expand Down
20 changes: 10 additions & 10 deletions src/printer/components/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const createToast = (title, message, type) => {
* onClose: () => void,
* }}
*/
function show({ title, message, type, onClose }) {
function show({ title, message, type, onClose, autoClose = true }) {
const article = createToast(title, message, type);
const close = () => {
if (toast_context.contains(article)) {
Expand All @@ -50,7 +50,7 @@ function show({ title, message, type, onClose }) {
});

const timeout = timeouts[type];
if (timeout)
if (timeout && autoClose)
setTimeout(close, timeout);

toast_context.appendChild(article);
Expand All @@ -62,8 +62,8 @@ function show({ title, message, type, onClose }) {
* @param {string} message
* @param {() => void | undefined} onClose
*/
export function info(title, message, onClose) {
show({ type: "info", title, message, onClose });
export function info(title, message, onClose , autoClose = true ) {
show({ type: "info", title, message, onClose, autoClose });
}

/**
Expand All @@ -72,8 +72,8 @@ export function info(title, message, onClose) {
* @param {string} message
* @param {() => void | undefined} onClose
*/
export function warning(title, message, onClose) {
show({ type: "warning", title, message, onClose });
export function warning(title, message, onClose , autoClose = true ) {
show({ type: "warning", title, message, onClose, autoClose });
}

/**
Expand All @@ -82,8 +82,8 @@ export function warning(title, message, onClose) {
* @param {string} message
* @param {() => void | undefined} onClose
*/
export function success(title, message, onClose) {
show({ type: "success", title, message, onClose });
export function success(title, message, onClose , autoClose = true ) {
show({ type: "success", title, message, onClose, autoClose });
}

/**
Expand All @@ -92,8 +92,8 @@ export function success(title, message, onClose) {
* @param {string} message
* @param {() => void | undefined} onClose
*/
export function error(title, message, onClose) {
show({ type: "error", title, message, onClose });
export function error(title, message, onClose , autoClose = true ) {
show({ type: "error", title, message, onClose, autoClose });
}

export default { info, warning, success, error };

0 comments on commit 609e1c3

Please sign in to comment.