import { resolveControlUiAuthHeader } from "./control-ui-auth.ts"; import {
loadChannels,
logoutWhatsApp,
startWhatsAppLogin,
waitWhatsAppLogin,
type ChannelsState,
} from "./controllers/channels.ts"; import { loadConfig, saveConfig, type ConfigState } from "./controllers/config.ts"; import type { NostrProfile } from "./types.ts"; import { createNostrProfileFormState } from "./views/channels.nostr-profile-form.ts";
type NostrProfileFormState = ReturnType<typeof createNostrProfileFormState> | null;
export async function handleWhatsAppStart(host: ChannelsActionHost, force: boolean) {
await startWhatsAppLogin(host as ChannelsState, force);
await loadChannels(host as ChannelsState, true);
}
export async function handleWhatsAppWait(host: ChannelsActionHost) {
await waitWhatsAppLogin(host as ChannelsState);
await loadChannels(host as ChannelsState, true);
}
export async function handleWhatsAppLogout(host: ChannelsActionHost) {
await logoutWhatsApp(host as ChannelsState);
await loadChannels(host as ChannelsState, true);
}
export async function handleChannelConfigSave(host: ChannelsActionHost) {
await saveConfig(host as ConfigState);
await loadConfig(host as ConfigState);
await loadChannels(host as ChannelsState, true);
}
export async function handleChannelConfigReload(host: ChannelsActionHost) {
await loadConfig(host as ConfigState);
await loadChannels(host as ChannelsState, true);
}
function parseValidationErrors(details: unknown): Record<string, string> { if (!Array.isArray(details)) { return {};
} const errors: Record<string, string> = {}; for (const entry of details) { if (typeof entry !== "string") { continue;
} const [rawField, ...rest] = entry.split(":"); if (!rawField || rest.length === 0) { continue;
} const field = rawField.trim(); const message = rest.join(":").trim(); if (field && message) {
errors[field] = message;
}
} return errors;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.