fix(core): update
This commit is contained in:
54
ts/classes.exposeprovider.webdav.ts
Normal file
54
ts/classes.exposeprovider.webdav.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { ExposeProvider } from './classes.exposeprovider.js';
|
||||
import * as plugins from './plugins.js';
|
||||
|
||||
export interface IWebdavExposeProviderOptions {
|
||||
webdavCredentials: plugins.smartwebdav.IWebdavClientOptions,
|
||||
webdavSubPath: string,
|
||||
}
|
||||
|
||||
export class WebDavExposeProvider extends ExposeProvider {
|
||||
public webdavClient: plugins.smartwebdav.WebdavClient;
|
||||
public options: IWebdavExposeProviderOptions;
|
||||
|
||||
constructor(optionsArg: IWebdavExposeProviderOptions) {
|
||||
super();
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
public async houseKeeping (): Promise<void> {
|
||||
const directoryContents = await this.webdavClient.listDirectory(this.options.webdavSubPath);
|
||||
for (const fileStat of directoryContents) {
|
||||
// lets read the meta.json file
|
||||
if (fileStat.filename.endsWith('.json')) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async ensureBaseDir (): Promise<void> {
|
||||
await this.webdavClient.ensureDirectory(this.options.webdavSubPath);
|
||||
}
|
||||
|
||||
public async start (): Promise<void> {
|
||||
this.webdavClient = new plugins.smartwebdav.WebdavClient(this.options.webdavCredentials);
|
||||
await this.ensureBaseDir();
|
||||
await this.houseKeeping();
|
||||
}
|
||||
|
||||
public async stop (): Promise<void> {
|
||||
// Nothing to do here
|
||||
}
|
||||
|
||||
public async exposeFile (optionsArg: { smartFile: plugins.smartfile.SmartFile; deleteAfterMillis?: number; privateUrl?: boolean; }): Promise<{ url: string; id: string; status: 'created' | 'updated'; }> {
|
||||
await this.ensureBaseDir();
|
||||
|
||||
}
|
||||
|
||||
public async wipeAll (): Promise<{ id: string; status: 'deleted' | 'failed' | 'notfound'; }[]> {
|
||||
|
||||
}
|
||||
|
||||
public async wipeFileById (idArg: string): Promise<{ id: string; status: 'deleted' | 'failed' | 'notfound'; }> {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user