feat: add pi hole summary integration (#521)
* feat: add pi hole summary integration * feat: add pi hole summary widget * fix: type issues with integrations and integrationIds * feat: add middleware for integrations and improve cache redis channel * feat: add error boundary for widgets * fix: broken lock file * fix: format format issues * fix: typecheck issue * fix: deepsource issues * fix: widget sandbox without error boundary * chore: address pull request feedback * chore: remove todo comment and created issue * fix: format issues * fix: deepsource issue
This commit is contained in:
22
packages/integrations/src/base/integration.ts
Normal file
22
packages/integrations/src/base/integration.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { IntegrationSecretKind } from "@homarr/definitions";
|
||||
|
||||
import type { IntegrationSecret } from "./types";
|
||||
|
||||
export abstract class Integration {
|
||||
constructor(
|
||||
protected integration: {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
decryptedSecrets: IntegrationSecret[];
|
||||
},
|
||||
) {}
|
||||
|
||||
protected getSecretValue(kind: IntegrationSecretKind) {
|
||||
const secret = this.integration.decryptedSecrets.find((secret) => secret.kind === kind);
|
||||
if (!secret) {
|
||||
throw new Error(`No secret of kind ${kind} was found`);
|
||||
}
|
||||
return secret.value;
|
||||
}
|
||||
}
|
||||
6
packages/integrations/src/base/types.ts
Normal file
6
packages/integrations/src/base/types.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { IntegrationSecretKind } from "@homarr/definitions";
|
||||
|
||||
export interface IntegrationSecret {
|
||||
kind: IntegrationSecretKind;
|
||||
value: string;
|
||||
}
|
||||
Reference in New Issue
Block a user