Do not allow enabling federation features on if not port 443. Closes #2008

This commit is contained in:
Gabe Kangas 2022-10-03 22:24:12 -07:00
parent cb65dde46a
commit 215a3096db
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA

View File

@ -244,6 +244,18 @@ const ConfigFederation = () => {
/> />
</> </>
); );
const invalidPortWarning = (
<Alert
message="Only Owncast instances available on the default SSL port 443 support this feature."
type="warning"
showIcon
/>
);
const hasInvalidPort =
instanceUrl && new URL(instanceUrl).port !== '' && new URL(instanceUrl).port !== '443';
return ( return (
<div> <div>
<Title>Configure Social Features</Title> <Title>Configure Social Features</Title>
@ -263,12 +275,13 @@ const ConfigFederation = () => {
<Row> <Row>
<Col span={15} className="form-module" style={{ marginRight: '15px' }}> <Col span={15} className="form-module" style={{ marginRight: '15px' }}>
{configurationWarning} {configurationWarning}
{hasInvalidPort && invalidPortWarning}
<ToggleSwitch <ToggleSwitch
fieldName="enabled" fieldName="enabled"
onChange={handleEnabledSwitchChange} onChange={handleEnabledSwitchChange}
{...FIELD_PROPS_ENABLE_FEDERATION} {...FIELD_PROPS_ENABLE_FEDERATION}
checked={formDataValues.enabled} checked={formDataValues.enabled}
disabled={!hasInstanceUrl || !isInstanceUrlSecure} disabled={hasInvalidPort || !hasInstanceUrl || !isInstanceUrlSecure}
/> />
<ToggleSwitch <ToggleSwitch
fieldName="isPrivate" fieldName="isPrivate"
@ -281,7 +294,7 @@ const ConfigFederation = () => {
useSubmit useSubmit
{...FIELD_PROPS_FEDERATION_NSFW} {...FIELD_PROPS_FEDERATION_NSFW}
checked={formDataValues.nsfw} checked={formDataValues.nsfw}
disabled={!hasInstanceUrl} disabled={hasInvalidPort || !hasInstanceUrl}
/> />
<TextFieldWithSubmit <TextFieldWithSubmit
required required