@webqit/webflo 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "1.0.2",
15
+ "version": "1.0.4",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -141,7 +141,7 @@ export class WebfloWorker extends WebfloRuntime {
141
141
  // Create and route request
142
142
  scope.request = this.createRequest(scope.url, scope.init);
143
143
  scope.cookies = this.constructor.CookieStorage.create(scope.request);
144
- scope.session = this.constructor.SessionStorage.create(scope.request, { secret: this.cx.env.entries.SESSION_KEY });
144
+ scope.session = this.constructor.SessionStorage.create(scope.request);
145
145
  const portID = crypto.randomUUID();
146
146
  scope.clientMessaging = new ClientMessaging(this, portID, { isPrimary: true });
147
147
  scope.user = this.constructor.HttpUser.create(
@@ -120,7 +120,6 @@ export class WebfloServer extends WebfloRuntime {
120
120
 
121
121
  control() {
122
122
  // ---------------
123
- console.log('________port 1:', this.#cx.server.port);
124
123
  if (!this.#cx.flags['test-only'] && !this.#cx.flags['https-only'] && this.#cx.server.port) {
125
124
  const httpServer = Http.createServer((request, response) => this.handleNodeHttpRequest(request, response));
126
125
  httpServer.listen(this.#cx.server.port);
@@ -138,7 +137,6 @@ export class WebfloServer extends WebfloRuntime {
138
137
  });
139
138
  }
140
139
  // ---------------
141
- console.log('________port 1:', this.#cx.server.https.port);
142
140
  if (!this.#cx.flags['test-only'] && !this.#cx.flags['http-only'] && this.#cx.server.https.port) {
143
141
  const httpsServer = Https.createServer((request, response) => this.handleNodeHttpRequest(request, response));
144
142
  httpsServer.listen(this.#cx.server.https.port);
@@ -174,14 +172,12 @@ export class WebfloServer extends WebfloRuntime {
174
172
  }
175
173
 
176
174
  getRequestProto(nodeRequest) {
177
- console.log({ encrypted: nodeRequest.connection.encrypted, headers: nodeRequest });
178
175
  return nodeRequest.connection.encrypted ? 'https' : (nodeRequest.headers['x-forwarded-proto'] || 'http');
179
176
  }
180
177
 
181
178
  #globalMessagingRegistry = new Map;
182
179
  async handleNodeWsRequest(wss, nodeRequest, socket, head) {
183
- const proto = this.getRequestProto(nodeRequest);
184
- console.log('__________ws:', proto);
180
+ const proto = this.getRequestProto(nodeRequest).replace('http', 'ws');
185
181
  const [fullUrl, requestInit] = this.parseNodeRequest(proto, nodeRequest, false);
186
182
  const scope = {};
187
183
  scope.url = new URL(fullUrl);
@@ -580,7 +576,6 @@ export class WebfloServer extends WebfloRuntime {
580
576
  const is404 = response.status === 404;
581
577
  if (is404) return response;
582
578
  const acceptedOrUnchanged = [202/*Accepted*/, 304/*Not Modified*/].includes(response.status);
583
- const t = response.status === 404;
584
579
  if (httpEvent.request.headers.get('Accept')) {
585
580
  const requestAccept = httpEvent.request.headers.get('Accept', true);
586
581
  if (requestAccept.match('text/html') && !response.meta.static) {
@@ -595,9 +590,6 @@ export class WebfloServer extends WebfloRuntime {
595
590
  // Satisfy "Range" header
596
591
  if (httpEvent.request.headers.get('Range') && !response.headers.get('Content-Range')
597
592
  && (response.body instanceof ReadableStream || ArrayBuffer.isView(response.body))) {
598
- if (t) {
599
- console.log(httpEvent.request.url, response.body);
600
- }
601
593
  const rangeRequest = httpEvent.request.headers.get('Range', true);
602
594
  const body = _ReadableStream.from(response.body);
603
595
  // ...in partials