diff --git a/app/components/monitorForms/http.tsx b/app/components/monitorForms/http.tsx index 7e96fc2..977921f 100644 --- a/app/components/monitorForms/http.tsx +++ b/app/components/monitorForms/http.tsx @@ -37,7 +37,7 @@ export default function HttpForm({ setData({ ...data, httpUrl: e.target.value })} diff --git a/app/monitors/http.server.ts b/app/monitors/http.server.ts index f544bd0..5915403 100644 --- a/app/monitors/http.server.ts +++ b/app/monitors/http.server.ts @@ -93,7 +93,8 @@ export async function HttpCheck({ if (httpAuthentication === 'basic') { basicAuthHeader = { - Authorization: 'Basic ' + encodeBase64(httpUsername, httpPassword), + Authorization: + 'Basic ' + encodeBase64(httpUsername, decrypt(httpPassword)), }; } @@ -151,12 +152,16 @@ export async function HttpCheck({ try { if (httpAuthentication === 'ntlm') { options.httpsAgent.keepAlive = true; - let client = NtlmClient({ + + let credentials: NtlmCredentials = { username: httpUsername || '', - password: httpPassword || '', + password: httpPassword ? decrypt(httpPassword) : '', domain: httpDomain || '', workstation: httpWorkstation ? httpWorkstation : undefined, - }); + }; + + let client = NtlmClient(credentials); + res = await client(options); } else { res = await axios.request(options); diff --git a/app/notifications/notifier.tsx b/app/notifications/notifier.tsx index cced0c6..6fb1dbc 100644 --- a/app/notifications/notifier.tsx +++ b/app/notifications/notifier.tsx @@ -1,4 +1,4 @@ -import { getMonitor } from '~/models/monitor.server'; +import { Monitor, getMonitor } from '~/models/monitor.server'; import type { Drive, DriveUsage } from '~/models/monitor.server'; import SMTP from './smtp'; import Telegram from './telegram'; @@ -29,7 +29,7 @@ export default async function Notifier({ if (monitor.type === 'windows' || monitor.type === 'ubuntu') { // reboot notifier - await rebootNotifier({ monitor, oldMonitor }); + if (oldMonitor) await rebootNotifier({ monitor, oldMonitor }); // drive notifications monitor?.drives?.map(async (drive: Drive & { usage: DriveUsage[] }) => { diff --git a/app/routes/_auth.monitor.new/route.tsx b/app/routes/_auth.monitor.new/route.tsx index ea67d45..37e9eca 100644 --- a/app/routes/_auth.monitor.new/route.tsx +++ b/app/routes/_auth.monitor.new/route.tsx @@ -270,7 +270,7 @@ export async function action({ request }: ActionArgs) { httpBody: values.httpBody?.toString(), httpAuthentication: values.httpAuthentication?.toString(), httpUsername: values.httpUsername?.toString(), - httpPassword: values.httpPassword?.toString(), + httpPassword: encrypt(values.httpPassword?.toString()), httpIgnoreSsl: !!values.httpIgnoreSsl, httpBodyEncoding: values.httpBodyEncoding?.toString(), httpUrl: values.httpUrl?.toString(),