import React, { useState, useContext, useEffect } from 'react'; import { Collapse, Typography } from 'antd'; import { TEXTFIELD_TYPE_NUMBER, TEXTFIELD_TYPE_PASSWORD, TEXTFIELD_TYPE_URL } from './TextField'; import { TextFieldWithSubmit } from './TextFieldWithSubmit'; import { ServerStatusContext } from '../../utils/server-status-context'; import { AlertMessageContext } from '../../utils/alert-message-context'; import { TEXTFIELD_PROPS_FFMPEG, TEXTFIELD_PROPS_RTMP_PORT, TEXTFIELD_PROPS_SOCKET_HOST_OVERRIDE, TEXTFIELD_PROPS_ADMIN_PASSWORD, TEXTFIELD_PROPS_WEB_PORT, TEXTFIELD_PROPS_VIDEO_SERVING_ENDPOINT, } from '../../utils/config-constants'; import { UpdateArgs } from '../../types/config-section'; import { ResetYP } from './ResetYP'; const { Panel } = Collapse; // eslint-disable-next-line react/function-component-definition export default function EditInstanceDetails() { const [formDataValues, setFormDataValues] = useState(null); const serverStatusData = useContext(ServerStatusContext); const { setMessage } = useContext(AlertMessageContext); const { serverConfig } = serverStatusData || {}; const { ffmpegPath, rtmpServerPort, webServerPort, yp, socketHostOverride, videoServingEndpoint, } = serverConfig; useEffect(() => { setFormDataValues({ ffmpegPath, rtmpServerPort, webServerPort, socketHostOverride, videoServingEndpoint, }); }, [serverConfig]); if (!formDataValues) { return null; } const handleFieldChange = ({ fieldName, value }: UpdateArgs) => { setFormDataValues({ ...formDataValues, [fieldName]: value, }); }; const showConfigurationRestartMessage = () => { setMessage('Updating server settings requires a restart of your Owncast server.'); }; const showStreamKeyChangeMessage = () => { setMessage( 'Changing your password will log you out of the admin. You may want to refresh the page to force yourself to log back in if not prompted.', ); }; const showFfmpegChangeMessage = () => { if (serverStatusData.online) { setMessage('The updated ffmpeg path will be used when starting your next live stream.'); } }; return (
If you have a CDN in front of your entire Owncast instance, specify your origin server here for the websocket to connect to. Most people will never need to set this. {yp.enabled && }
); }