reject unauthorized

This commit is contained in:
Alex Holliday committed 2025-11-27 20:41:49 +00:00
1 parent 686b96d4b3
commit 5876b97ede
19 files changed
+37 -14

No files matched your search

@@ -37,8 +37,6 @@ export const HistogramResponseTime = ({
data = normalized;
}
console.log(data);
const chartHeight = typeof height === "number" ? `${height}px` : height;
const gridGap = gap ?? theme.spacing(0.5);
+1 -1
View File
@@ -46,7 +46,7 @@ export const useGet = <T,>(
// Config
{
onError: (err) => {
console.log(err);
console.error(err);
toastError(
err?.response?.data?.message ||
err.message ||
@@ -25,6 +25,7 @@ export const useInitForm = ({
notificationChannels: initialData?.notificationChannels || [],
name: initialData?.name || "",
interval: humanInterval,
rejectUnauthorized: initialData?.rejectUnauthorized ?? true,
};
return { defaults };
}, [initialData]);
+3 -1
View File
@@ -265,8 +265,10 @@
"incidentConfigStatusWindowLabel": "How many checks should be in the sliding window?",
"incidentConfigStatusWindowThresholdLabel": "What percentage of checks in the sliding window fail/succeed before monitor status changes?",
"incidentConfigTitle": "Incidents",
"intervalTitle": "Check interval",
"intervalDescription": "How often do you want to check this service?",
"intervalTitle": "Check interval"
"rejectUnauthorizedTitle": "Reject unauthorized",
"rejectUnauthorizedDescription": "Disable to allow self-signed SSL certificates"
},
"createNew": "Create new",
"createNotifications": {
-1
View File
@@ -51,7 +51,6 @@ const ExportPage = () => {
const text = await file.text();
const json = JSON.parse(text);
const res = await post("/monitors/import", { monitors: json });
console.log(res);
} catch (error) {
console.error("Failed to parse JSON", error);
} finally {
@@ -17,7 +17,6 @@ const MaintenanceCreatePage = () => {
useGet<ApiResponse<IMonitor[]>>("/monitors");
const monitors = response?.data || [];
console.log(monitors);
const onSubmit = async (data: FormValues) => {
const res = await post("/maintenance", data);
@@ -52,8 +52,7 @@ export const MaintenanceForm = ({
}, [initialData, reset, defaults]);
const onError = (errors: any) => {
console.log(errors);
console.log(getValues());
console.error(errors);
};
return (
@@ -56,8 +56,7 @@ export const NotificationChannelsForm = ({
const type = watch("type");
const onError = (errors: any) => {
console.log(errors);
console.log(getValues());
console.error(errors);
};
const handleTest = async () => {
@@ -38,7 +38,6 @@ const PageSpeedConfigurePage = () => {
notificationChannels: data.notificationChannels,
interval,
};
console.log(submitData);
const result = await patch(`/monitors/${id}`, submitData);
if (result) {
navigate(`/pagespeed/${id}`);
@@ -55,7 +55,7 @@ export const StatusPageForm = ({
}, [initialData, reset, defaults]);
const onError = (errors: any) => {
console.log(errors);
console.error(errors);
};
const monitors = useWatch({
@@ -38,6 +38,7 @@ const UptimeConfigurePage = () => {
n: data.n,
notificationChannels: data.notificationChannels,
interval,
rejectUnauthorized: data.rejectUnauthorized,
};
const result = await patch(`/monitors/${id}`, submitData);
if (result) {
@@ -69,7 +69,6 @@ const UptimeDetailsPage = () => {
}
const stats = response?.data?.stats || null;
console.log(stats);
const avgResponseTime = stats?.avgResponseTime || 0;
const maxResponseTime = stats?.maxResponseTime || 0;
+19
View File
@@ -4,6 +4,7 @@ import {
Button,
AutoComplete,
RadioWithDescription,
Switch,
} from "@/components/inputs";
import { ConfigBox, BasePage } from "@/components/design-elements";
import RadioGroup from "@mui/material/RadioGroup";
@@ -314,6 +315,24 @@ export const UptimeForm = ({
/>
}
/>
<ConfigBox
title={t("createMonitorPage.rejectUnauthorizedTitle")}
subtitle={t("createMonitorPage.rejectUnauthorizedDescription")}
rightContent={
<Controller
name="rejectUnauthorized"
control={control}
render={({ field }) => (
<Stack direction="row" alignItems={"center"}>
<Switch {...field} checked={field.value} />
<Typography>
{field.value ? "Enabled (recommended)" : "Disabled"}
</Typography>
</Stack>
)}
/>
}
/>
<Stack direction="row" justifyContent="flex-end">
<Button
loading={loading}
+1
View File
@@ -28,6 +28,7 @@ export interface IMonitor {
createdAt: string;
createdBy: string;
interval: number;
rejectUnauthorized: boolean;
latestChecks: ICheck[];
n: number;
name: string;
+1
View File
@@ -100,6 +100,7 @@ export const monitorSchema = z
notificationChannels: z.array(z.string()).optional().default([]),
name: z.string().min(1, "Display name is required"),
interval: durationSchema,
rejectUnauthorized: z.boolean().default(true),
})
.superRefine((data, ctx) => {
if (data.type === "port") {
+2
View File
@@ -29,6 +29,7 @@ export interface IMonitor extends Document {
secret?: string;
type: MonitorType;
interval: number; // in ms
rejectUnauthorized: boolean;
status: MonitorStatus;
n: number; // Number of consecutive successes required to change status
lastCheckedAt?: Date;
@@ -58,6 +59,7 @@ const MonitorSchema = new Schema<IMonitor>(
enum: MonitorTypes,
},
interval: { type: Number, required: true, default: 60000 },
rejectUnauthorized: { type: Boolean, required: true, default: true },
status: {
type: String,
required: true,
@@ -623,6 +623,7 @@ class MonitorService implements IMonitorService {
"name",
"secret",
"interval",
"rejectUnauthorized",
"n",
"notificationChannels",
];
@@ -119,7 +119,9 @@ class NetworkService implements INetworkService {
let certificateExpiry: Date | null = null;
try {
const req: any = this.client(url);
const req: any = this.client(url, {
https: { rejectUnauthorized: monitor.rejectUnauthorized },
});
req.on("request", (nodeReq: ClientRequest) => {
nodeReq.on("socket", (socket: TLSSocket) => {
const capture = () => {
+1
View File
@@ -60,6 +60,7 @@ export const monitorSchema = z
notificationChannels: z.array(z.string()).optional().default([]),
secret: z.string().optional(),
interval: z.number({ message: "Interval required" }),
rejectUnauthorized: z.boolean().default(true),
})
.superRefine((data, ctx) => {
const minIntervals: Record<string, number> = {