mirror of
https://github.com/HeyPuter/puter.git
synced 2026-01-05 12:40:26 -06:00
dev: make it possible to handle requests from extension
This commit is contained in:
@@ -78,11 +78,16 @@ class WebServerService extends BaseService {
|
||||
install_post_middlewares_ ({ app }) {
|
||||
app.use(async (req, res, next) => {
|
||||
const svc_event = this.services.get('event');
|
||||
|
||||
const event = {
|
||||
req, res,
|
||||
end: false,
|
||||
end () {
|
||||
this.end_ = true;
|
||||
}
|
||||
};
|
||||
await svc_event.emit('request.will-be-handled', event);
|
||||
next();
|
||||
if ( ! event.end_ ) next();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user