forked from OwnZones/orchestration-gui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support media and html sources in prod and web sockets
- Loading branch information
Showing
27 changed files
with
602 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import WebSocket from 'ws'; | ||
|
||
function createWebSocket(): Promise<WebSocket> { | ||
return new Promise((resolve, reject) => { | ||
const ws = new WebSocket(`ws://${process.env.AGILE_WEBSOCKET}`); | ||
ws.on('error', reject); | ||
ws.on('open', () => { | ||
// const send = ws.send.bind(ws); | ||
// ws.send = (message) => { | ||
// console.debug(`[websocket] sending message: ${message}`); | ||
// send(message); | ||
// }; | ||
resolve(ws); | ||
}); | ||
}); | ||
} | ||
|
||
export async function createControlPanelWebSocket() { | ||
const ws = await createWebSocket(); | ||
return { | ||
createHtml: (input: number) => { | ||
ws.send('html reset'); | ||
ws.send(`html create ${input} 1920 1080`); | ||
setTimeout(() => { | ||
ws.send( | ||
`html load ${input} ${process.env.NEXTAUTH_URL}/html_input?input=${input}` | ||
); | ||
}, 1000); | ||
}, | ||
createMediaplayer: (input: number) => { | ||
ws.send('media reset'); | ||
ws.send(`media create ${input} ${process.env.MEDIAPLAYER_PLACEHOLDER}`); | ||
ws.send(`media play ${input}`); | ||
}, | ||
closeHtml: (input: number) => { | ||
ws.send(`html close ${input}`); | ||
}, | ||
closeMediaplayer: (input: number) => { | ||
ws.send(`media close ${input}`); | ||
}, | ||
close: () => { | ||
ws.close(); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { PageProps } from '../../../.next/types/app/html_input/page'; | ||
|
||
export default function HtmlInput({ searchParams: { input } }: PageProps) { | ||
return ( | ||
<div className="fixed top-0 left-0 h-screen w-screen bg-white flex flex-col gap-12 justify-center items-center"> | ||
<p className="text-9xl font-extrabold">HTML INPUT</p> | ||
<p className="text-8xl font-bold">{input}</p> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.