fix(core): update

This commit is contained in:
2024-04-24 18:02:21 +02:00
parent a301d67bda
commit b538f72004
10 changed files with 219 additions and 44 deletions

View File

@@ -5,6 +5,7 @@ import * as plugins from './plugins.js';
export interface ISmartExposeOptions {
deleteAfterMillis?: number,
privateUrl?: boolean,
exposedBaseUrl: string,
}
export class SmartExpose {
@@ -12,7 +13,6 @@ export class SmartExpose {
public static createWithWebdav(optionsArg: {
webdavCredentials: plugins.smartwebdav.IWebdavClientOptions,
webdavSubPath: string,
exposedBaseUrl: string,
exposeOptions: ISmartExposeOptions,
}) {
const provider = new WebDavExposeProvider({
@@ -20,14 +20,32 @@ export class SmartExpose {
webdavSubPath: optionsArg.webdavSubPath,
});
const smartexposeInstance = new SmartExpose(provider, optionsArg.exposeOptions);
provider.smartExposeRef = smartexposeInstance;
return smartexposeInstance;
}
// INSTANCE
public taskmanager: plugins.taskbuffer.TaskManager;
public provider: ExposeProvider;
public options: ISmartExposeOptions;
constructor(provider: ExposeProvider, optionsArg: ISmartExposeOptions) {
this.provider = provider;
this.options = optionsArg;
}
public async start() {
this.taskmanager = new plugins.taskbuffer.TaskManager();
await this.provider.start();
this.taskmanager.start();
}
public async stop() {
await this.provider.stop();
this.taskmanager.stop();
}
public async exposeFile(optionsArg: Parameters<ExposeProvider['exposeFile']>[0]) {
return this.provider.exposeFile(optionsArg);
}
}