feat: caldav client
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {
|
||||
CalendarSearchIcon,
|
||||
CloudUploadIcon,
|
||||
HandIcon,
|
||||
MapIcon,
|
||||
@@ -24,6 +25,7 @@
|
||||
syncStores,
|
||||
updateStore,
|
||||
} from "$lib/services/stores.svelte";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
const dev = getDeveloperToggle();
|
||||
|
||||
@@ -54,6 +56,45 @@
|
||||
await downloadPMTiles(url, name);
|
||||
}}
|
||||
/>
|
||||
<SettingsButton
|
||||
icon={CalendarSearchIcon}
|
||||
text="Fetch calendars"
|
||||
onclick={async () => {
|
||||
const url = prompt("URL?");
|
||||
if (!url) return;
|
||||
const scheme = await invoke("dav_find_scheme", { url })
|
||||
.catch((err) => {
|
||||
alert("Error fetching scheme: " + err);
|
||||
});
|
||||
alert("Found scheme: " + scheme);
|
||||
const username = prompt("Username?");
|
||||
const password = prompt("Password?");
|
||||
if (!username || !password) return;
|
||||
const credentials = { scheme, username, password };
|
||||
invoke("dav_fetch_calendars", { url, credentials }).then((calendars) => {
|
||||
alert("Fetched calendars: " + JSON.stringify(calendars));
|
||||
}).catch((err) => {
|
||||
alert("Error fetching calendars: " + err);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<SettingsButton
|
||||
icon={CalendarSearchIcon}
|
||||
text="Fetch CalDAV events"
|
||||
onclick={async () => {
|
||||
const url = prompt("URL?");
|
||||
const scheme = prompt("Scheme? (basic, digest)");
|
||||
const username = prompt("Username?");
|
||||
const password = prompt("Password?");
|
||||
if (!url || !username || !password) return;
|
||||
const credentials = { scheme, username, password };
|
||||
invoke("dav_fetch_events", { calendar: { name: "Calendar", url }, credentials }).then((events) => {
|
||||
alert("Fetched events: " + JSON.stringify(events));
|
||||
}).catch((err) => {
|
||||
alert("Error fetching events: " + err);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
Reference in New Issue
Block a user