feat(pihole): add support for v6 (#2448)

* feat(pihole): add support for v6

* fix: add session-store to keep using same session for pi-hole requests

* chore: address pull request feedback

* fix: import issue

* fix: other import errors
This commit is contained in:
Meier Lukas
2025-03-04 21:17:35 +01:00
committed by GitHub
parent e88b29dc9d
commit 3804d530ec
33 changed files with 624 additions and 98 deletions

View File

@@ -9,6 +9,7 @@ export {
createChannelWithLatestAndEvents,
handshakeAsync,
createSubPubChannel,
createGetSetChannel,
} from "./lib/channel";
export const exampleChannel = createSubPubChannel<{ message: string }>("example");

View File

@@ -94,6 +94,36 @@ export const createListChannel = <TItem>(name: string) => {
};
};
/**
* Creates a new redis channel for getting and setting data
* @param name name of channel
*/
export const createGetSetChannel = <TData>(name: string) => {
return {
/**
* Get data from the channel
* @returns data or null if not found
*/
getAsync: async () => {
const data = await getSetClient.get(name);
return data ? superjson.parse<TData>(data) : null;
},
/**
* Set data in the channel
* @param data data to be stored in the channel
*/
setAsync: async (data: TData) => {
await getSetClient.set(name, superjson.stringify(data));
},
/**
* Remove data from the channel
*/
removeAsync: async () => {
await getSetClient.del(name);
},
};
};
/**
* Creates a new cache channel.
* @param name name of the channel