@ossy/app 0.7.2 → 0.7.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/cli/client.js CHANGED
@@ -3,4 +3,6 @@ import 'react-dom'
3
3
  import { hydrateRoot } from 'react-dom/client';
4
4
  import App from '%%@ossy/app/source-file%%'
5
5
 
6
- hydrateRoot(document, createElement(App))
6
+ const initialConfig = window.__INITIAL_APP_CONFIG__ || {}
7
+
8
+ hydrateRoot(document, createElement(App, initialConfig))
package/cli/server.js CHANGED
@@ -34,7 +34,8 @@ const middleware = [
34
34
  }
35
35
 
36
36
  // Check for auth cookie
37
- req.isAuthenticated = !!req.signedCookies?.auth
37
+ const cookieHeader = req.headers.cookie
38
+ req.isAuthenticated = cookieHeader ? cookieHeader.includes('auth=') : false
38
39
 
39
40
  next()
40
41
  },
@@ -78,9 +79,10 @@ app.listen(3000, () => {
78
79
  async function renderToString(App, config) {
79
80
 
80
81
  const { prelude } = await prerenderToNodeStream(createElement(App, config), {
82
+ bootstrapScriptContent: `window.__INITIAL_APP_CONFIG__ = ${JSON.stringify(config)};`,
81
83
  bootstrapModules: ['/static/main.js']
82
84
  });
83
-
85
+
84
86
  return new Promise((resolve, reject) => {
85
87
  let data = '';
86
88
  prelude.on('data', chunk => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/app",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "",
5
5
  "source": "./src/index.js",
6
6
  "main": "./src/index.js",
@@ -58,5 +58,5 @@
58
58
  "/cli",
59
59
  "README.md"
60
60
  ],
61
- "gitHead": "542a2da440731d12392f8720bd8c09d5af651d8e"
61
+ "gitHead": "a0afe55ea0d3cc04bed77f150e83fd5346f29234"
62
62
  }