import { AuthType , createClient as createWebDAVClient } from "webdav" ; import { createClient as createDropboxClient } from "@buttercup/dropbox-client" ; import { createClient as createGoogleDriveClient } from "@buttercup/googledrive-client" ; import { DropboxInterface , FileSystemInterface , GoogleDriveInterface , WebDAVInterface } from "@buttercup/file-interface" ; import { LocalFileSystemInterface } from "../library/datasource/LocalFileInterface" ; let __interface = null ; export function disableCurrentInterface ( ) { __interface = null ; } export function getCurrentInterface ( ) { return __interface ; } export async function prepareDropboxInterface ( token ) { const dropboxClient = createDropboxClient ( token ) ; __interface = new DropboxInterface ( { dropboxClient } ) ; } export async function prepareGoogleDriveInterface ( token ) { const googleDriveClient = createGoogleDriveClient ( token ) ; __interface = new GoogleDriveInterface ( { googleDriveClient } ) ; } export async function prepareLocalFileInterface ( ) { __interface = new LocalFileSystemInterface ( { } ) ; } export async function prepareWebDAVInterface ( url , username , password ) { const webdavClient = createWebDAVClient ( url , { authType : AuthType . Password , username , password } ) ; __interface = new WebDAVInterface ( { webdavClient } ) ; }