Commit 1c7dd7b8 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac: openwebui.com integration

parent 32a8884c
...@@ -138,13 +138,9 @@ ...@@ -138,13 +138,9 @@
onMount(async () => { onMount(async () => {
window.addEventListener('message', async (event) => { window.addEventListener('message', async (event) => {
if ( if (
![ !['https://openwebui.com', 'https://www.openwebui.com', 'http://localhost:5173'].includes(
'https://ollamahub.com', event.origin
'https://www.ollamahub.com', )
'https://openwebui.com',
'https://www.openwebui.com',
'http://localhost:5173'
].includes(event.origin)
) )
return; return;
......
...@@ -57,13 +57,9 @@ ...@@ -57,13 +57,9 @@
onMount(async () => { onMount(async () => {
window.addEventListener('message', async (event) => { window.addEventListener('message', async (event) => {
if ( if (
![ !['https://openwebui.com', 'https://www.openwebui.com', 'http://localhost:5173'].includes(
'https://ollamahub.com', event.origin
'https://www.ollamahub.com', )
'https://openwebui.com',
'https://www.openwebui.com',
'http://localhost:5173'
].includes(event.origin)
) )
return; return;
const prompt = JSON.parse(event.data); const prompt = JSON.parse(event.data);
......
<script lang="ts">
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
onMount(async () => {
window.addEventListener('message', async (event) => {
if (
![
'https://ollamahub.com',
'https://www.ollamahub.com',
'https://openwebui.com',
'https://www.openwebui.com',
'http://localhost:5173'
].includes(event.origin)
)
return;
const prompts = JSON.parse(event.data);
sessionStorage.modelfile = JSON.stringify(prompts);
goto('/workspace/prompts/create');
});
if (window.opener ?? false) {
window.opener.postMessage('loaded', '*');
}
});
</script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment