diff --git a/packages/web2/app/components/profile/errorScan.tsx b/packages/web2/app/components/profile/errorScan.tsx
index cffd727..64a1301 100644
--- a/packages/web2/app/components/profile/errorScan.tsx
+++ b/packages/web2/app/components/profile/errorScan.tsx
@@ -1,24 +1,195 @@
-import { FC } from "react";
+import { FC, ReactNode } from "react";
import { Scan, ScanProfile } from "../../api/types.js";
-import { DnsErrorView } from "./errorScans/dnsErrorView.js";
-import { CertificateErrorView } from "./errorScans/certificateErrorView.js";
import { DefaultErrorView } from "./errorScans/defaultErrorView.js";
+import { ErrorViewWithEditDomain } from "./errorScans/ErrorViewWithEditDomain.js";
+import { ErrorViewWithoutEditDomain } from "./errorScans/ErrorViewWithoutEditDomain.js";
-export const ErrorScan: FC<{
- profile: ScanProfile;
- lastScan: Scan;
-}> = ({ lastScan, profile }) => {
- if (lastScan.error?.startsWith("net::ERR_NAME_NOT_RESOLVED")) {
- return ;
+interface ErrorTexts {
+ headline: string;
+ description: ReactNode;
+ showEditDomain: boolean;
+}
+
+const getErrorTexts = (
+ error: string,
+): ErrorTexts | undefined => {
+ if (error.includes("ERR_NAME_NOT_RESOLVED")) {
+ return {
+ headline: "Domain nicht erreichbar",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da die Website nicht gefunden werden konnte.
+ Bitte überprüfe die eingegebene Adresse und versuche es erneut.
+ >
+ ),
+ showEditDomain: true,
+ };
+ }
+
+ if (error.includes("ERR_CERT_COMMON_NAME_INVALID")) {
+ return {
+ headline: "SSL-Zertifikat passt nicht zur URL",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da das SSL-Zertifikat nicht zur aufgerufenen Adresse passt.
+ Bitte überprüfe die Adresse sowie das Zertifikat der Website und versuche es erneut.
+ >
+ ),
+ showEditDomain: true,
+ };
+ }
+
+ if (error.includes("ERR_CONNECTION_REFUSED")) {
+ return {
+ headline: "Domain nicht erreichbar",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da die Verbindung zur Website vom Server abgelehnt wurde.
+ Bitte überprüfe die Adresse und starte den Scan erneut.
+ >
+ ),
+ showEditDomain: true,
+ };
+ }
+
+ if (error.includes("ERR_TOO_MANY_REDIRECTS")) {
+ return {
+ headline: "Domain nicht erreichbar",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da die Website zu viele Weiterleitungen enthält.
+ Bitte überprüfe die Adresse und starte den Scan erneut.
+ >
+ ),
+ showEditDomain: true,
+ };
+ }
+
+ if (error.includes("ERR_TIMED_OUT")) {
+ return {
+ headline: "Domain nicht erreichbar",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da beim Verbindungsaufbau keine Antwort von der Website eingegangen ist.
+ Bitte überprüfe die Adresse und starte den Scan erneut.
+ >
+ ),
+ showEditDomain: true,
+ };
+ }
+
+ if (error.includes("ERR_INVALID_AUTH_CREDENTIALS")) {
+ return {
+ headline: "Domain nicht erreichbar",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da die Website durch einen Passwortschutz oder eine Zugangsbeschränkung gesichert ist.
+ Bitte nutze eine öffentlich erreichbare Adresse oder entferne die Zugriffsbeschränkung und starte den Scan erneut.
+ >
+ ),
+ showEditDomain: false,
+ };
+ }
+
+ if (error.includes("ERR_CERT_AUTHORITY_INVALID")) {
+ return {
+ headline: "SSL-Zertifikat abgelaufen",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da die Zertifizierungsstelle (CA) des SSL-Zertifikates nicht vertrauenswürdig oder das Zertifikat abgelaufen ist.
+ Bitte überprüfe das Zertifikat und starte den Scan erneut.
+ >
+ ),
+ showEditDomain: false,
+ };
+ }
+
+ if (error.includes("ERR_BLOCKED_BY_CLIENT")) {
+ return {
+ headline: "Domain nicht erreichbar",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da eine Ressource der Website blockiert wurde – zum Beispiel durch einen Werbe-, Tracking- oder Script-Blocker im Browser.
+ Bitte überprüfe die Ursache und versuche es anschließend erneut.
+ >
+ ),
+ showEditDomain: false,
+ };
+ }
+
+ if (error.includes("ERR_SSL_PROTOCOL_ERROR")) {
+ return {
+ headline: "Sichere Verbindung fehlgeschlagen",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da keine sichere Verbindung zur Website hergestellt werden konnte.
+ Bitte überprüfe das SSL-Zertifikat sowie die Servereinstellungen und starte den Scan erneut.
+ >
+ ),
+ showEditDomain: false,
+ };
+ }
+
+ if (error.includes("ERR_CERT_DATE_INVALID")) {
+ return {
+ headline: "SSL-Zertifikat ungültig",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da das SSL-Zertifikat der Website abgelaufen oder ungültig ist.
+ Bitte überprüfe das Zertifikat und versuche es erneut.
+ >
+ ),
+ showEditDomain: false,
+ };
+ }
+
+ if (error.includes("ERR_SSL_UNRECOGNIZED_NAME_ALERT")) {
+ return {
+ headline: "SSL-Zertifikat ungültig",
+ description: (
+ <>
+ Der Scan wurde abgebrochen, da das SSL-Zertifikat der Website nicht erkannt oder validiert werden konnte.
+ Bitte überprüfe das Zertifikat und starte den Scan erneut.
+ >
+ ),
+ showEditDomain: false,
+ };
+ }
+
+ return undefined;
+};
+
+export const ErrorScan: FC<{ profile: ScanProfile; lastScan: Scan }> = ({
+ lastScan,
+ profile,
+}) => {
+ const errorInfos = lastScan.error ? getErrorTexts(lastScan.error) : undefined;
+
+ if (errorInfos?.showEditDomain) {
+ return (
+
+ );
}
- if (lastScan.error?.startsWith("net::ERR_CERT_")) {
- return ;
+ if (errorInfos) {
+ return (
+
+ );
}
return (
);
diff --git a/packages/web2/app/components/profile/errorScans/dnsErrorView.tsx b/packages/web2/app/components/profile/errorScans/ErrorViewWithEditDomain.tsx
similarity index 58%
rename from packages/web2/app/components/profile/errorScans/dnsErrorView.tsx
rename to packages/web2/app/components/profile/errorScans/ErrorViewWithEditDomain.tsx
index 4837c31..378ac90 100644
--- a/packages/web2/app/components/profile/errorScans/dnsErrorView.tsx
+++ b/packages/web2/app/components/profile/errorScans/ErrorViewWithEditDomain.tsx
@@ -1,5 +1,5 @@
import { FC } from "react";
-import { Props } from "./types.js";
+import { DetailedErrorProps } from "./types.js";
import {
Action,
ActionGroup,
@@ -13,24 +13,31 @@ import {
import { RestartScanButton } from "./restartScanButton.js";
import { ChangeDomainModal } from "../modals/changeDomainModal.js";
-export const DnsErrorView: FC = ({ profile, scanId }) => {
+export const ErrorViewWithEditDomain: FC = ({
+ profile,
+ scanId,
+ headline,
+ description,
+}) => {
const controller = useOverlayController("Modal");
+ const editLabel = "Domain bearbeiten";
+ const content = description;
return (
- Domain nicht erreichbar
-
- Die Domain {profile.domain} ist nicht erreichbar.{" "}
-
Bitte überprüfe die Schreibweise oder versuche es erneut.
-
+ {headline}
+ {content}
controller.open()}>
-
+
-
+
);
-};
+};
\ No newline at end of file
diff --git a/packages/web2/app/components/profile/errorScans/certificateErrorView.tsx b/packages/web2/app/components/profile/errorScans/ErrorViewWithoutEditDomain.tsx
similarity index 50%
rename from packages/web2/app/components/profile/errorScans/certificateErrorView.tsx
rename to packages/web2/app/components/profile/errorScans/ErrorViewWithoutEditDomain.tsx
index 99308b2..b224f06 100644
--- a/packages/web2/app/components/profile/errorScans/certificateErrorView.tsx
+++ b/packages/web2/app/components/profile/errorScans/ErrorViewWithoutEditDomain.tsx
@@ -1,5 +1,5 @@
import { FC } from "react";
-import { Props } from "./types.js";
+import { DetailedErrorProps } from "./types.js";
import {
Heading,
IconDanger,
@@ -8,16 +8,17 @@ import {
} from "@mittwald/flow-remote-react-components";
import { RestartScanButton } from "./restartScanButton.js";
-export const CertificateErrorView: FC = ({ profile, scanId }) => {
+export const ErrorViewWithoutEditDomain: FC = ({
+ profile,
+ headline,
+ description,
+ scanId,
+}) => {
return (
- SSL-Zertifikat ungültig
-
- Das SSL-Zertifikat der Domain {profile.domain} ist
- ungültig.
Binde ein gültiges Zertifikat ein und starte den Scan
- erneut.
-
+ {headline}
+ {description}
);
diff --git a/packages/web2/app/components/profile/errorScans/defaultErrorView.tsx b/packages/web2/app/components/profile/errorScans/defaultErrorView.tsx
index d89cb93..767dd35 100644
--- a/packages/web2/app/components/profile/errorScans/defaultErrorView.tsx
+++ b/packages/web2/app/components/profile/errorScans/defaultErrorView.tsx
@@ -1,5 +1,5 @@
import { FC } from "react";
-import { Props } from "./types.js";
+import { BaseProps } from "./types.js";
import {
Heading,
IconDanger,
@@ -8,10 +8,10 @@ import {
} from "@mittwald/flow-remote-react-components";
import { RestartScanButton } from "./restartScanButton.js";
-export const DefaultErrorView: FC = ({
+export const DefaultErrorView: FC = ({
profile,
- message,
scanId,
+ message,
}) => {
return (
@@ -25,4 +25,4 @@ export const DefaultErrorView: FC = ({
);
-};
+};
\ No newline at end of file
diff --git a/packages/web2/app/components/profile/errorScans/restartScanButton.tsx b/packages/web2/app/components/profile/errorScans/restartScanButton.tsx
index 3010df6..38dbf7e 100644
--- a/packages/web2/app/components/profile/errorScans/restartScanButton.tsx
+++ b/packages/web2/app/components/profile/errorScans/restartScanButton.tsx
@@ -1,10 +1,10 @@
import { FC } from "react";
-import { Props } from "./types.js";
+import { BaseProps } from "./types.js";
import { useRouter } from "@tanstack/react-router";
import { Action, Button } from "@mittwald/flow-remote-react-components";
import { startScan } from "../../../actions/scan.js";
-export const RestartScanButton: FC = ({ profile, scanId }) => {
+export const RestartScanButton: FC = ({ profile, scanId }) => {
const router = useRouter();
return (
{
+}
+
+export const ChangeDomainModal = ({
+ controller,
+ profile
+}: ChangeDomainModalProps) => {
const router = useRouter();
const form = useForm({
@@ -73,4 +75,4 @@ export const ChangeDomainModal = ({
);
-};
+};
\ No newline at end of file