fix: Meldungsseite benutzt noch falsche Funktion zur Darstellung der Meldungen.
This commit is contained in:
@@ -31,22 +31,20 @@ const Last20MessagesTable: React.FC = () => {
|
||||
|
||||
// Hilfsfunktion zum Parsen der Nachrichten
|
||||
const parseMessages = (messages: string | null) => {
|
||||
if (typeof messages === "string") {
|
||||
messages = messages
|
||||
.replace(/<tr>/g, "\n")
|
||||
.replace(/<\/?td>/g, "")
|
||||
.replace(/<\/tr>/g, "")
|
||||
.trim();
|
||||
const rows = messages.split("\n");
|
||||
return rows.map((row) => [
|
||||
row.substring(0, 5),
|
||||
row.substring(5, 10),
|
||||
row.substring(10, 29),
|
||||
row.substring(33, row.length - 1),
|
||||
row.substring(row.length - 1),
|
||||
]);
|
||||
}
|
||||
return [];
|
||||
if (!messages) return [];
|
||||
|
||||
const rows = messages
|
||||
.split("<tr>")
|
||||
.slice(1) // erstes Element ist leer
|
||||
.map((row) => {
|
||||
const cols = row
|
||||
.replace(/<\/tr>/, "")
|
||||
.split("</td><td>")
|
||||
.map((col) => col.replace(/<[^>]+>/g, ""));
|
||||
return cols;
|
||||
});
|
||||
|
||||
return rows;
|
||||
};
|
||||
|
||||
const last20Messages = parseMessages(rawLast20Messages);
|
||||
|
||||
Reference in New Issue
Block a user