feat: connection notification

This commit is contained in:
Timothy J. Baek 2024-03-13 00:08:42 -07:00
parent f5e8dcfbbf
commit 51d339b8a7
4 changed files with 12 additions and 2 deletions

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Hello World!</title> <title>Open WebUI Assistant</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -6,7 +6,7 @@ import { ref, onBeforeMount } from 'vue';
const url = ref('http://localhost:3000') const url = ref('http://localhost:3000')
const token = ref('your_jwt') const token = ref('your_jwt')
const submitHandler = () => { const submitHandler = async () => {
console.log(url.value, token.value) console.log(url.value, token.value)
@ -20,6 +20,12 @@ const submitHandler = () => {
token: token.value token: token.value
}) })
const res = await window.electron.checkConnection()
new Notification("Open WebUI", { body: res ? 'Server Connection Verified' : 'Server Connection Failed' })
console.log(res)
} }
@ -30,6 +36,8 @@ onBeforeMount(async () => {
url.value = res.url url.value = res.url
token.value = res.token token.value = res.token
} }
}) })

View File

@ -2,6 +2,7 @@ import {
app, app,
BrowserWindow, BrowserWindow,
globalShortcut, globalShortcut,
Notification,
clipboard, clipboard,
ipcMain, ipcMain,
} from "electron"; } from "electron";

View File

@ -8,6 +8,7 @@ contextBridge.exposeInMainWorld("electron", {
ipcRenderer.on(event, callback); ipcRenderer.on(event, callback);
}, },
checkConnection: () => ipcRenderer.invoke("check-connection"),
loadConfig: () => ipcRenderer.invoke("load-config"), loadConfig: () => ipcRenderer.invoke("load-config"),
saveConfig: (data) => ipcRenderer.send("save-config", data), saveConfig: (data) => ipcRenderer.send("save-config", data),
}); });