keeweb/app/scripts/storage/index.js

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-09-15 14:16:32 +02:00
import { Launcher } from 'comp/launcher';
import { StorageCache } from 'storage/impl/storage-cache';
import { StorageDropbox } from 'storage/impl/storage-dropbox';
import { StorageFile } from 'storage/impl/storage-file';
import { StorageFileCache } from 'storage/impl/storage-file-cache';
import { StorageGDrive } from 'storage/impl/storage-gdrive';
import { StorageOneDrive } from 'storage/impl/storage-onedrive';
import { StorageTeams } from 'storage/impl/storage-teams';
2019-09-15 14:16:32 +02:00
import { StorageWebDav } from 'storage/impl/storage-webdav';
import { createOAuthSession } from 'storage/pkce';
2015-12-06 21:32:41 +01:00
const BuiltInStorage = {
2019-09-15 13:24:53 +02:00
file: new StorageFile(),
cache: Launcher ? new StorageFileCache() : new StorageCache()
};
const ThirdPartyStorage = {
2019-09-15 13:24:53 +02:00
dropbox: new StorageDropbox(),
gdrive: new StorageGDrive(),
onedrive: new StorageOneDrive(),
2021-07-11 16:22:38 +02:00
msteams: new StorageTeams(),
2019-09-15 13:24:53 +02:00
webdav: new StorageWebDav()
2015-12-02 21:39:40 +01:00
};
2019-09-15 14:16:32 +02:00
const Storage = BuiltInStorage;
if (!Launcher || Launcher.thirdPartyStoragesSupported) {
2019-09-17 22:17:40 +02:00
Object.assign(Storage, ThirdPartyStorage);
2017-02-22 01:35:16 +01:00
}
requestAnimationFrame(createOAuthSession);
2019-09-15 14:16:32 +02:00
export { Storage };