diff --git a/apps/client/src/common/utils/regex.ts b/apps/client/src/common/utils/regex.ts
index 0d31fa1d6..db78eb3cf 100644
--- a/apps/client/src/common/utils/regex.ts
+++ b/apps/client/src/common/utils/regex.ts
@@ -1,3 +1,4 @@
export const isOnlyNumbers = /^\d+$/;
export const isIPAddress = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/;
export const startsWithHttp = /^http:\/\//;
+export const startsWithHttpOrS = /^https?:\/\//;
diff --git a/apps/client/src/features/modals/integration-modal/http/HttpSubscriptionRow.tsx b/apps/client/src/features/modals/integration-modal/http/HttpSubscriptionRow.tsx
index bd01eec05..3e7349cef 100644
--- a/apps/client/src/features/modals/integration-modal/http/HttpSubscriptionRow.tsx
+++ b/apps/client/src/features/modals/integration-modal/http/HttpSubscriptionRow.tsx
@@ -5,7 +5,7 @@ import { IoRemove } from '@react-icons/all-files/io5/IoRemove';
import { HttpSettings, TimerLifeCycle } from 'ontime-types';
import { useEmitLog } from '../../../../common/stores/logger';
-import { startsWithHttp } from '../../../../common/utils/regex';
+import { startsWithHttpOrS } from '../../../../common/utils/regex';
import collapseStyles from '../../../../common/components/collapse-bar/CollapseBar.module.scss';
import styles from '../../Modal.module.scss';
@@ -36,7 +36,7 @@ export default function SubscriptionRow(props: SubscriptionRowProps) {
const handleAddNew = () => {
if (hasTooManyOptions) {
- emitError('Maximum amount of onLoad subscriptions reached (3)');
+ emitError(`Maximum amount of ${cycle} subscriptions reached (3)`);
return;
}
append({
@@ -71,7 +71,7 @@ export default function SubscriptionRow(props: SubscriptionRowProps) {
variant='ontime-filled-on-light'
autoComplete='off'
{...register(`subscriptions.${cycle}.${index}.message`, {
- pattern: { value: startsWithHttp, message: 'Request address must start with http://' },
+ pattern: { value: startsWithHttpOrS, message: 'Request address must start with http://' },
})}
/>
diff --git a/apps/server/src/services/integration-service/HttpIntegration.ts b/apps/server/src/services/integration-service/HttpIntegration.ts
index fa407b01f..db5a6abff 100644
--- a/apps/server/src/services/integration-service/HttpIntegration.ts
+++ b/apps/server/src/services/integration-service/HttpIntegration.ts
@@ -85,13 +85,13 @@ export class HttpIntegration implements IIntegration {
const parsedMessage = parseTemplateNested(message, state || {});
try {
const parsedUrl = new globalThis.URL(parsedMessage);
- if (parsedUrl.protocol != 'http:') {
- logger.error(LogOrigin.Tx, `HTTP Integration: Only HTTP allowed, got ${parsedUrl.protocol}`);
- return {
- success: false,
- message: `Only HTTP allowed, got ${parsedUrl.protocol}`,
- };
- }
+ // if (parsedUrl.protocol != 'http:') {
+ // logger.error(LogOrigin.Tx, `HTTP Integration: Only HTTP allowed, got ${parsedUrl.protocol}`);
+ // return {
+ // success: false,
+ // message: `Only HTTP allowed, got ${parsedUrl.protocol}`,
+ // };
+ // }
this.emit(parsedUrl);
} catch (err) {
logger.error(LogOrigin.Tx, `HTTP Integration: ${err}`);
diff --git a/apps/server/src/utils/__tests__/parserFunctions.test.ts b/apps/server/src/utils/__tests__/parserFunctions.test.ts
index 10970592f..333c1233c 100644
--- a/apps/server/src/utils/__tests__/parserFunctions.test.ts
+++ b/apps/server/src/utils/__tests__/parserFunctions.test.ts
@@ -81,21 +81,22 @@ describe('validateHttpSubscriptionCycle()', () => {
it('should return false when given an HttpSubscription with an invalid property value', () => {
const invalidBoolean = [{ message: 'http://', enabled: 'not a boolean' }];
const invalidHttp = [{ message: 'test', enabled: true }];
- const noHttps = [{ message: 'https://test', enabled: true }];
+ const noFtp = [{ message: 'ftp://test', enabled: true }];
const noEmpty = [{ message: '', enabled: true }];
// @ts-expect-error -- since this comes from the client, we check things that typescript would have caught
expect(validateHttpSubscriptionCycle(invalidBoolean)).toBe(false);
expect(validateHttpSubscriptionCycle(invalidHttp)).toBe(false);
- expect(validateHttpSubscriptionCycle(noHttps)).toBe(false);
+ expect(validateHttpSubscriptionCycle(noFtp)).toBe(false);
expect(validateHttpSubscriptionCycle(noEmpty)).toBe(false);
});
it('should return true when given an HttpSubscription matches definition', () => {
const validHttp = [{ message: 'http://', enabled: true }];
+ const validHttps = [{ message: 'https://', enabled: true }];
- const result = validateHttpSubscriptionCycle(validHttp);
- expect(result).toBe(true);
+ expect(validateHttpSubscriptionCycle(validHttp)).toBe(true);
+ expect(validateHttpSubscriptionCycle(validHttps)).toBe(true);
});
});
diff --git a/apps/server/src/utils/parserFunctions.ts b/apps/server/src/utils/parserFunctions.ts
index 23cdeed93..08c630211 100644
--- a/apps/server/src/utils/parserFunctions.ts
+++ b/apps/server/src/utils/parserFunctions.ts
@@ -227,7 +227,8 @@ export const parseOsc = (data: { osc?: Partial }): OSCSettings => {
*/
export const validateHttpSubscriptionCycle = (data: HttpSubscriptionOptions[]): boolean => {
for (const subscriptionOption of data) {
- const isHttp = subscriptionOption.message?.startsWith('http://');
+ const isHttp =
+ subscriptionOption.message?.startsWith('http://') || subscriptionOption.message?.startsWith('https://');
if (typeof subscriptionOption.message !== 'string' || !isHttp || typeof subscriptionOption.enabled !== 'boolean') {
return false;
}