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