Update daemon socket URL and enhance message rendering in frontend
- Changed the default value for `VITE_DAEMON_SOCKET` in `deploy-frontend.sh` and `update-frontend.sh` to use the `/ws/` path. - Updated the message rendering logic in `MessagesDialog.vue` to utilize a new `formatBody` method for improved translation handling. - Added a new translation for "overproduction" in both English and German localization files.
This commit is contained in:
@@ -26,7 +26,7 @@ fi
|
|||||||
# 5. Frontend neu bauen – VITE_* aus Environment übernehmen oder Defaults setzen
|
# 5. Frontend neu bauen – VITE_* aus Environment übernehmen oder Defaults setzen
|
||||||
echo "Baue Frontend neu..."
|
echo "Baue Frontend neu..."
|
||||||
export VITE_API_BASE_URL=${VITE_API_BASE_URL:-https://www.your-part.de}
|
export VITE_API_BASE_URL=${VITE_API_BASE_URL:-https://www.your-part.de}
|
||||||
export VITE_DAEMON_SOCKET=${VITE_DAEMON_SOCKET:-wss://www.your-part.de:4551}
|
export VITE_DAEMON_SOCKET=${VITE_DAEMON_SOCKET:-wss://www.your-part.de/ws/}
|
||||||
export VITE_CHAT_WS_URL=${VITE_CHAT_WS_URL:-wss://www.your-part.de:1235}
|
export VITE_CHAT_WS_URL=${VITE_CHAT_WS_URL:-wss://www.your-part.de:1235}
|
||||||
|
|
||||||
echo "VITE_API_BASE_URL=$VITE_API_BASE_URL"
|
echo "VITE_API_BASE_URL=$VITE_API_BASE_URL"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
>
|
>
|
||||||
<ul class="messages">
|
<ul class="messages">
|
||||||
<li v-for="n in messages" :key="n.id" :class="{ unread: !n.shown }">
|
<li v-for="n in messages" :key="n.id" :class="{ unread: !n.shown }">
|
||||||
<div class="body">{{ $t('falukant.notifications.' + n.tr) }}</div>
|
<div class="body">{{ formatBody(n) }}</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<span>{{ formatDate(n.createdAt) }}</span>
|
<span>{{ formatDate(n.createdAt) }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,6 +116,26 @@ export default {
|
|||||||
try {
|
try {
|
||||||
return new Date(dt).toLocaleString();
|
return new Date(dt).toLocaleString();
|
||||||
} catch { return dt; }
|
} catch { return dt; }
|
||||||
|
},
|
||||||
|
formatBody(n) {
|
||||||
|
let key = n.tr;
|
||||||
|
let params = {};
|
||||||
|
if (typeof key === 'string') {
|
||||||
|
const trimmed = key.trim();
|
||||||
|
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(trimmed);
|
||||||
|
if (parsed && parsed.tr) {
|
||||||
|
key = parsed.tr;
|
||||||
|
params = { ...parsed };
|
||||||
|
delete params.tr;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Fallback: ignore parse error and use raw key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.$t('falukant.notifications.' + key, params);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
"empty": "Keine Nachrichten vorhanden."
|
"empty": "Keine Nachrichten vorhanden."
|
||||||
},
|
},
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"notify_election_created": "Es wurde eine neue Wahl ausgeschrieben."
|
"notify_election_created": "Es wurde eine neue Wahl ausgeschrieben.",
|
||||||
|
"production.overproduction": "Überproduktion: Deine Produktion liegt {value}% über dem Bedarf."
|
||||||
},
|
},
|
||||||
"health": {
|
"health": {
|
||||||
"amazing": "Super",
|
"amazing": "Super",
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
"empty": "No messages."
|
"empty": "No messages."
|
||||||
},
|
},
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"notify_election_created": "A new election has been scheduled."
|
"notify_election_created": "A new election has been scheduled.",
|
||||||
|
"production.overproduction": "Overproduction: your production is {value}% above demand."
|
||||||
},
|
},
|
||||||
"statusbar": {
|
"statusbar": {
|
||||||
"age": "Age",
|
"age": "Age",
|
||||||
|
|||||||
@@ -270,10 +270,9 @@ const store = createStore({
|
|||||||
|
|
||||||
// Wenn Umgebungsvariable nicht gesetzt ist oder leer, verwende Fallback-Logik
|
// Wenn Umgebungsvariable nicht gesetzt ist oder leer, verwende Fallback-Logik
|
||||||
if (!daemonUrl || (typeof daemonUrl === 'string' && daemonUrl.trim() === '')) {
|
if (!daemonUrl || (typeof daemonUrl === 'string' && daemonUrl.trim() === '')) {
|
||||||
// Fallback: basierend auf Protokoll und Hostname (dynamisch generiert, keine hardcodierten Werte)
|
// Fallback: gleiche Origin + Pfad /ws/ (Apache/Proxy routet intern auf Port 4551)
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||||
const port = '4551';
|
daemonUrl = `${protocol}//${hostname}/ws/`;
|
||||||
daemonUrl = `${protocol}//${hostname}:${port}`;
|
|
||||||
console.log('[Daemon] Verwende Fallback basierend auf Hostname und Protokoll');
|
console.log('[Daemon] Verwende Fallback basierend auf Hostname und Protokoll');
|
||||||
} else {
|
} else {
|
||||||
console.log('[Daemon] Verwende Umgebungsvariable');
|
console.log('[Daemon] Verwende Umgebungsvariable');
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ fi
|
|||||||
# 5. Frontend neu bauen – VITE_* aus Environment übernehmen oder Defaults setzen
|
# 5. Frontend neu bauen – VITE_* aus Environment übernehmen oder Defaults setzen
|
||||||
echo "Baue Frontend neu..."
|
echo "Baue Frontend neu..."
|
||||||
export VITE_API_BASE_URL=${VITE_API_BASE_URL:-https://www.your-part.de}
|
export VITE_API_BASE_URL=${VITE_API_BASE_URL:-https://www.your-part.de}
|
||||||
export VITE_DAEMON_SOCKET=${VITE_DAEMON_SOCKET:-wss://www.your-part.de:4551}
|
export VITE_DAEMON_SOCKET=${VITE_DAEMON_SOCKET:-wss://www.your-part.de/ws/}
|
||||||
export VITE_CHAT_WS_URL=${VITE_CHAT_WS_URL:-wss://www.your-part.de:1235}
|
export VITE_CHAT_WS_URL=${VITE_CHAT_WS_URL:-wss://www.your-part.de:1235}
|
||||||
|
|
||||||
echo "VITE_API_BASE_URL=$VITE_API_BASE_URL"
|
echo "VITE_API_BASE_URL=$VITE_API_BASE_URL"
|
||||||
|
|||||||
Reference in New Issue
Block a user