n8n-nodes-nextcloud-calendar
Version:
n8n Node für die Integration mit Nextcloud Calendar
36 lines • 1.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.initClient = void 0;
const tsdav_1 = require("tsdav");
async function initClient(context) {
const credentials = await context.getCredentials('nextcloudCalendarApi');
let serverUrl = credentials.serverUrl;
if (!serverUrl.endsWith('/remote.php/dav')) {
serverUrl = serverUrl.replace(/\/?$/, '/remote.php/dav');
}
console.log(`Initialisiere CalDAV Client für: ${serverUrl}`);
console.log(`Benutzername: ${credentials.username}`);
console.log(`Passwort gesetzt: ${credentials.password ? 'Ja' : 'Nein'}`);
console.log(`Passwort-Länge: ${credentials.password ? credentials.password.length : 0}`);
const client = new tsdav_1.DAVClient({
serverUrl,
credentials: {
username: credentials.username,
password: credentials.password,
},
defaultAccountType: 'caldav',
authMethod: 'Basic',
});
try {
console.log('Versuche CalDAV Login...');
await client.login();
console.log('CalDAV Login erfolgreich');
return client;
}
catch (error) {
console.error('CalDAV Login fehlgeschlagen:', error);
throw new Error(`CalDAV Authentifizierung fehlgeschlagen: ${error.message}. Bitte überprüfen Sie Ihre Credentials und verwenden Sie ein App-Passwort falls erforderlich.`);
}
}
exports.initClient = initClient;
//# sourceMappingURL=client.js.map