Fehldende messages hinzugefügt
All checks were successful
Deploy to production / deploy (push) Successful in 2m14s
All checks were successful
Deploy to production / deploy (push) Successful in 2m14s
This commit is contained in:
@@ -143,11 +143,15 @@ export default {
|
||||
}
|
||||
if (typeof raw === 'string') {
|
||||
const trimmed = raw.trim();
|
||||
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
||||
const jsonStart = trimmed.indexOf('{');
|
||||
if (jsonStart >= 0 && trimmed.endsWith('}')) {
|
||||
try {
|
||||
const parsed = JSON.parse(trimmed);
|
||||
const parsed = JSON.parse(trimmed.slice(jsonStart));
|
||||
if (parsed && typeof parsed === 'object') {
|
||||
merged = { ...merged, ...parsed };
|
||||
if (!parsed.tr && parsed.event && /^falukant\.notifications\.\s*\{/.test(trimmed)) {
|
||||
merged.tr = parsed.event;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
/* Rohstring bleibt in merged.tr */
|
||||
@@ -175,17 +179,29 @@ export default {
|
||||
let raw = payload.tr || '';
|
||||
let key = raw;
|
||||
let params = {};
|
||||
const isMissingNotificationKey = (value) => {
|
||||
if (value == null) return true;
|
||||
const text = String(value).trim();
|
||||
return !text || text === 'falukant.notifications.' || text === 'notifications.';
|
||||
};
|
||||
|
||||
// Fallback: Manche Daemon-Events liefern event_id/event_type, aber kein tr.
|
||||
if ((!raw || !String(raw).trim()) && payload?.event_id) {
|
||||
if (isMissingNotificationKey(raw) && payload?.event_id) {
|
||||
raw = payload.event_type === 'random_event'
|
||||
? `random_event.${payload.event_id}`
|
||||
: String(payload.event_id);
|
||||
key = raw;
|
||||
}
|
||||
|
||||
// Fallback: direkte Daemon-Events wie director_death liefern den Typ
|
||||
// im Feld event, waehrend tr historisch leer oder nur der Namespace sein kann.
|
||||
if (isMissingNotificationKey(raw) && payload?.event) {
|
||||
raw = String(payload.event);
|
||||
key = raw;
|
||||
}
|
||||
|
||||
// Fallback: use payload.type if present (e.g. storage_damage)
|
||||
if ((!raw || !String(raw).trim()) && payload?.type) {
|
||||
if (isMissingNotificationKey(raw) && payload?.type) {
|
||||
raw = String(payload.type);
|
||||
key = raw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user