Skip to content

Commit

Permalink
properly send json objects between node backend
Browse files Browse the repository at this point in the history
  • Loading branch information
naeruru committed Jan 31, 2024
1 parent f1f3182 commit 9b52b02
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default {
created() {
if (this.is_electron())
this.$router.push('/')
}
},
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/router.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RouteRecordRaw } from 'vue-router'
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import { createRouter, createWebHistory } from 'vue-router'

import Header from '@/components/Header.vue'
import Footer from '@/components/Footer.vue'
Expand Down
14 changes: 12 additions & 2 deletions src/stores/speech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,20 @@ export const useSpeechStore = defineStore('speech', {
if (is_electron() && (oscStore.osc_text) && defaultStore.broadcasting) {
if (log.isTranslationFinal && log.translation) {
const transcript = (translationStore.show_original) ? `${log.transcript} (${log.translation})` : log.translation
window.ipcRenderer.send('send-text-event', `{ "transcript": "${transcript}", "hide_ui": ${!oscStore.show_keyboard}, "sfx": ${oscStore.sfx} }`)
const data = {
transcript,
hide_ui: !oscStore.show_keyboard,
sfx: oscStore.sfx,
}
window.ipcRenderer.send('send-text-event', JSON.stringify(data))
}
else if (log.isFinal && !log.translate) {
window.ipcRenderer.send('send-text-event', `{ "transcript": "${log.transcript}", "hide_ui": ${!oscStore.show_keyboard}, "sfx": ${oscStore.sfx} }`)
const data = {
transcript: log.transcript,
hide_ui: !oscStore.show_keyboard,
sfx: oscStore.sfx,
}
window.ipcRenderer.send('send-text-event', JSON.stringify(data))
}
}
else if (defaultStore.ws) {
Expand Down

0 comments on commit 9b52b02

Please sign in to comment.