feat: onedrive file picker integration

This commit is contained in:
hurxxxx
2025-02-24 23:14:10 +09:00
parent 0335d479f9
commit 4cc3102758
12 changed files with 337 additions and 295 deletions

View File

@@ -2,7 +2,7 @@
import { toast } from 'svelte-sonner';
import { v4 as uuidv4 } from 'uuid';
import { createPicker, getAuthToken } from '$lib/utils/google-drive-picker';
import { openOneDrivePicker } from '$lib/utils/onedrive-file-picker';
import { pickAndDownloadFile } from '$lib/utils/onedrive-file-picker';
import { onMount, tick, getContext, createEventDispatcher, onDestroy } from 'svelte';
const dispatch = createEventDispatcher();
@@ -1111,10 +1111,10 @@
}}
uploadOneDriveHandler={async () => {
try {
const fileData = await openOneDrivePicker();
const fileData = await pickAndDownloadFile();
if (fileData) {
const file = new File([fileData.blob], fileData.name, {
type: fileData.blob.type
type: fileData.blob.type || 'application/octet-stream'
});
await uploadFileHandler(file);
} else {
@@ -1122,11 +1122,6 @@
}
} catch (error) {
console.error('OneDrive Error:', error);
toast.error(
$i18n.t('Error accessing OneDrive: {{error}}', {
error: error.message
})
);
}
}}
onClose={async () => {