@webqit/webflo 1.0.11 → 1.0.13

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.11",
15
+ "version": "1.0.13",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -105,13 +105,13 @@ export class WebfloRootClient1 extends WebfloClient {
105
105
  const undoControl = super.controlClassic((newHref) => {
106
106
  try {
107
107
  // Save current scroll position
108
- this.host.history.replaceState({
108
+ window.history.replaceState({
109
109
  ...(this.currentEntry()?.getState?.() || {}),
110
110
  scrollPosition: this.host === window.document ? [window.scrollX, window.scrollY] : [this.host.scrollLeft, this.host.scrollTop,],
111
111
  }, '', this.location.href);
112
112
  } catch (e) { }
113
113
  // Do actual location update
114
- try { this.host.history.pushState({}, '', newHref); } catch (e) { }
114
+ try { window.history.pushState({}, '', newHref); } catch (e) { }
115
115
  });
116
116
  // ONPOPSTATE
117
117
  const popstateHandler = (e) => {
@@ -3,8 +3,7 @@ import { WebfloRootClient2 } from './WebfloRootClient2.js';
3
3
  import { WebfloSubClient } from './WebfloSubClient.js';
4
4
 
5
5
  export function start() {
6
- const navigationAPIMeta = document.querySelector('meta[name="webflo-navigationapi"]')?.value;
7
- const WebfloRootClient = window.navigation && navigationAPIMeta ? WebfloRootClient2 : WebfloRootClient1;
6
+ const WebfloRootClient = window.navigation ? WebfloRootClient2 : WebfloRootClient1;
8
7
  const instance = WebfloRootClient.create(document, this || {});
9
8
  instance.initialize();
10
9
  WebfloSubClient.defineElement();
@@ -6,7 +6,7 @@ export class SessionStorage extends WebfloStorage {
6
6
 
7
7
  static create(request, params = {}) {
8
8
  let sessionID = request.headers.get('Cookie', true).find((c) => c.name === '__sessid')?.value;
9
- if (sessionID?.includes('.')) {
9
+ if (sessionID?.includes('.') && params.secret) {
10
10
  const [rand, signature] = sessionID.split('.');
11
11
  const expectedSignature = crypto.createHmac('sha256', params.secret)
12
12
  .update(rand)
@@ -12,6 +12,7 @@ import { _each } from '@webqit/util/obj/index.js';
12
12
  import { slice as _streamSlice } from 'stream-slice';
13
13
  import { Readable as _ReadableStream } from 'stream';
14
14
  import { WebfloRuntime } from '../WebfloRuntime.js';
15
+ import { createWindow } from '@webqit/oohtml-ssr';
15
16
  import { Context } from './Context.js';
16
17
  import { CookieStorage } from './CookieStorage.js';
17
18
  import { SessionStorage } from './SessionStorage.js';
@@ -646,12 +647,14 @@ export class WebfloServer extends WebfloRuntime {
646
647
  pathnameSplit.pop();
647
648
  }
648
649
  const dirPublic = Url.pathToFileURL(Path.resolve(Path.join(this.#cx.CWD, this.#cx.layout.PUBLIC_DIR)));
649
- const instanceParams = QueryString.stringify({
650
- file: renderFile,
650
+ const instanceParams = /*QueryString.stringify*/({
651
+ //file: renderFile,
651
652
  url: dirPublic.href,// httpEvent.url.href,
652
653
  root: this.#cx.CWD,
653
654
  });
654
- const { window, document } = await import('@webqit/oohtml-ssr/src/instance.js?' + instanceParams);
655
+ const window = createWindow(renderFile, instanceParams);
656
+ const document = window.document;
657
+ //const { window, document } = await import('@webqit/oohtml-ssr/src/instance.js?' + instanceParams);
655
658
  await new Promise(res => {
656
659
  if (document.readyState === 'complete') return res();
657
660
  document.addEventListener('load', res);
@@ -719,6 +722,7 @@ export class WebfloServer extends WebfloRuntime {
719
722
  headers: response.headers,
720
723
  status: response.status,
721
724
  });
725
+ scope.rendering.close?.();
722
726
  scope.response.headers.set('Content-Type', 'text/html');
723
727
  scope.response.headers.set('Content-Length', (new Blob([scope.rendering])).size);
724
728
  return scope.response;