mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-18 06:54:15 +00:00
- Introduces a new Music Library system for managing favorites (tracks, playlists, releases), replacing the previous TrackLike model. - Completely revamps the Studio TV profile page, adding live statistics, stream configuration, restream management, and media URL display. - Enhances the media player with a custom seekbar and improved audio playback logic for MPD and non-MPD sources. - Lays foundational groundwork for chat encryption with new models and APIs. - Refactors critical UI components like PlaylistView and PagePanel. - Standardizes monorepo development scripts to use npm. - Updates comty.js submodule and adds various new UI components.
50 lines
843 B
JavaScript
50 lines
843 B
JavaScript
import React from "react"
|
|
|
|
const defaultURL = "ws://localhost:19236"
|
|
|
|
function useLoquiWs() {
|
|
const [socket, setSocket] = React.useState(null)
|
|
|
|
function create() {
|
|
const s = new WebSocket(defaultURL)
|
|
|
|
s.addEventListener("open", (event) => {
|
|
console.log("WebSocket connection opened")
|
|
})
|
|
|
|
s.addEventListener("close", (event) => {
|
|
console.log("WebSocket connection closed")
|
|
})
|
|
|
|
s.addEventListener("error", (event) => {
|
|
console.log("WebSocket error", event)
|
|
})
|
|
|
|
s.addEventListener("message", (event) => {
|
|
console.log("Message from server ", event.data)
|
|
})
|
|
|
|
setSocket(s)
|
|
}
|
|
|
|
React.useEffect(() => {
|
|
create()
|
|
|
|
return () => {
|
|
if (socket) {
|
|
socket.close()
|
|
}
|
|
}
|
|
}, [])
|
|
|
|
return [socket]
|
|
}
|
|
|
|
const Loqui = () => {
|
|
const [socket] = useLoquiWs()
|
|
|
|
return <div>{defaultURL}</div>
|
|
}
|
|
|
|
export default Loqui
|