fix(core): update
This commit is contained in:
31
ts/classes.scriptserver.ts
Normal file
31
ts/classes.scriptserver.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { DenoExecution } from './classes.denoexecution.js';
|
||||
import * as plugins from './plugins.js';
|
||||
|
||||
export class ScriptServer {
|
||||
private server: plugins.typedserver.servertools.Server;
|
||||
public smartshellInstance = new plugins.smarthshell.Smartshell({
|
||||
executor: 'bash'
|
||||
});
|
||||
|
||||
public executionMap = new plugins.lik.ObjectMap<DenoExecution>();
|
||||
|
||||
public async start() {
|
||||
this.server = new plugins.typedserver.servertools.Server({
|
||||
port: 3210,
|
||||
cors: true,
|
||||
});
|
||||
this.server.addRoute(
|
||||
'/getscript/:executionId',
|
||||
new plugins.typedserver.servertools.Handler('GET', async (req, res) => {
|
||||
const executionId = req.params.executionId;
|
||||
const denoExecution = await this.executionMap.find(async denoExecutionArg => {
|
||||
return denoExecutionArg.id === executionId;
|
||||
})
|
||||
res.write(denoExecution.script);
|
||||
res.end();
|
||||
})
|
||||
);
|
||||
await this.server.start();
|
||||
}
|
||||
public async stop() {}
|
||||
}
|
||||
Reference in New Issue
Block a user