AI-native design editor. Open-source Figma alternative.
fix(cloud): start Cloud pages in the editor's theme from one shared boot splash (#1499)
Danila Poyarkov2aea61c687f5
diff --git a/cloud.html b/cloud.htmlindex 6cc3d8a75..9b562fd91 100644--- a/cloud.html+++ b/cloud.html@@ -8,74 +8,12 @@<link rel="icon" type="image/svg+xml" href="/brand/favicon.svg" /><link rel="icon" type="image/png" sizes="96x96" href="/brand/favicon-96x96.png" /><style>- :root {- --loader-bg: #1e1e1e;- --loader-fg: 255, 255, 255;- }- @media (prefers-color-scheme: light) {- :root {- --loader-bg: #f3f4f6;- --loader-fg: 32, 33, 36;- }- }- html[data-theme='dark'] {- --loader-bg: #1e1e1e;- --loader-fg: 255, 255, 255;- }- html[data-theme='light'] {- --loader-bg: #f3f4f6;- --loader-fg: 32, 33, 36;- }- html, body, #app { height: 100%; margin: 0; }- body { background: var(--loader-bg); }- #boot-splash {- position: fixed;- inset: 0;- display: flex;- align-items: center;- justify-content: center;- z-index: 9999;- color: rgb(var(--loader-fg));- background: var(--loader-bg);- }- #boot-splash img { width: 40px; height: 40px; }- #boot-splash .bar {- position: absolute;- bottom: 50%;- left: 50%;- transform: translate(-50%, 40px);- width: 100px;- height: 2px;- background: rgba(var(--loader-fg), 0.08);- border-radius: 1px;- overflow: hidden;- }- #boot-splash .bar::after {- content: '';- display: block;- height: 100%;- width: 40%;- background: rgba(var(--loader-fg), 0.25);- border-radius: 1px;- animation: slide 1s ease-in-out infinite;- }- @keyframes slide {- 0% { transform: translateX(-100%); }- 100% { transform: translateX(350%); }- }- @media (prefers-reduced-motion: reduce) {- #boot-splash .bar::after { animation: none; }- }+ html, body, #app { height: 100%; }</style></head><body>- <div id="app">- <div id="boot-splash">- <img src="/brand/app-icon.svg" width="40" height="40" alt="OpenPencil" />- <div class="bar"></div>- </div>- </div>+ <div id="app"></div><script type="module" src="/src/cloud/main.ts"></script></body></html>diff --git a/index.html b/index.htmlindex 2ee3c4809..cbe5b1d2d 100644--- a/index.html+++ b/index.html@@ -10,63 +10,6 @@<meta name="theme-color" content="#1e1e1e" /><title>OpenPencil</title><style>- :root {- --loader-bg: #1e1e1e;- --loader-fg: 255, 255, 255;- }- @media (prefers-color-scheme: light) {- :root {- --loader-bg: #f3f4f6;- --loader-fg: 32, 33, 36;- }- }- html[data-theme='dark'] {- --loader-bg: #1e1e1e;- --loader-fg: 255, 255, 255;- }- html[data-theme='light'] {- --loader-bg: #f3f4f6;- --loader-fg: 32, 33, 36;- }- body { margin: 0; background: var(--loader-bg); }- #boot-splash {- position: fixed;- inset: 0;- display: flex;- align-items: center;- justify-content: center;- z-index: 9999;- color: rgb(var(--loader-fg));- background: var(--loader-bg);- }- #boot-splash img { width: 40px; height: 40px; }- #boot-splash .bar {- position: absolute;- bottom: 50%;- left: 50%;- transform: translate(-50%, 40px);- width: 100px;- height: 2px;- background: rgba(var(--loader-fg), 0.08);- border-radius: 1px;- overflow: hidden;- }- #boot-splash .bar::after {- content: '';- display: block;- height: 100%;- width: 40%;- background: rgba(var(--loader-fg), 0.25);- border-radius: 1px;- animation: slide 1s ease-in-out infinite;- }- @keyframes slide {- 0% { transform: translateX(-100%); }- 100% { transform: translateX(350%); }- }- @media (prefers-reduced-motion: reduce) {- #boot-splash .bar::after { animation: none; }- }/* Pre-boot support notice; the app CSS never loads when it shows. */#boot-notice {box-sizing: border-box;@@ -106,23 +49,10 @@-webkit-user-select: text;}</style>- <script>- // The splash takes the app's theme, dark unless chosen otherwise (`src/app/shell/theme.ts`),- // so the page does not change colour when the app starts.- try {- const theme = localStorage.getItem('open-pencil:theme')- if (theme !== 'auto') document.documentElement.dataset.theme = theme === 'light' ? 'light' : 'dark'- } catch {}- </script></head><body>- <div id="app">- <div id="boot-splash">- <img src="/brand/app-icon.svg" width="40" height="40" alt="OpenPencil" />- <div class="bar"></div>- </div>- </div>+ <div id="app"></div><script type="module" src="/src/main.ts"></script></body></html>diff --git a/metrics.html b/metrics.htmlindex a5e1f61f4..0a99482f8 100644--- a/metrics.html+++ b/metrics.html@@ -9,59 +9,12 @@<link rel="icon" type="image/svg+xml" href="/brand/favicon.svg" /><link rel="icon" type="image/png" sizes="96x96" href="/brand/favicon-96x96.png" /><style>- :root { --loader-bg: #1e1e1e; --loader-fg: 255, 255, 255; }- @media (prefers-color-scheme: light) {- :root { --loader-bg: #f3f4f6; --loader-fg: 32, 33, 36; }- }- html, body, #app { height: 100%; margin: 0; }- body { background: var(--loader-bg); }- /* The editor's splash, covering the first request until the page mounts with its numbers. */- #boot-splash {- position: fixed;- inset: 0;- display: flex;- align-items: center;- justify-content: center;- background: var(--loader-bg);- }- #boot-splash img { width: 40px; height: 40px; }- #boot-splash .bar {- position: absolute;- bottom: 50%;- left: 50%;- transform: translate(-50%, 40px);- width: 100px;- height: 2px;- background: rgba(var(--loader-fg), 0.08);- border-radius: 1px;- overflow: hidden;- }- #boot-splash .bar::after {- content: '';- display: block;- height: 100%;- width: 40%;- background: rgba(var(--loader-fg), 0.25);- border-radius: 1px;- animation: slide 1s ease-in-out infinite;- }- @keyframes slide {- 0% { transform: translateX(-100%); }- 100% { transform: translateX(350%); }- }- @media (prefers-reduced-motion: reduce) {- #boot-splash .bar::after { animation: none; }- }+ html, body, #app { height: 100%; }</style></head><body>- <div id="app">- <div id="boot-splash" role="status" aria-label="Loading metrics">- <img src="/brand/app-icon.svg" width="40" height="40" alt="" />- <div class="bar"></div>- </div>- </div>+ <div id="app"></div><script type="module" src="/src/metrics/main.ts"></script></body></html>diff --git a/src/AGENTS.md b/src/AGENTS.mdindex ca4776cb0..af0169fd3 100644--- a/src/AGENTS.md+++ b/src/AGENTS.md@@ -33,6 +33,7 @@ Root Tauri/Vite app. Services and state live under `src/app/**`, views under `sr- An open Cloud document is live in its relay room, and only the elected saver (`electCloudSaver` in `src/app/cloud/rooms/live.ts`) uploads its revisions; guests from a link never save (`tests/integration/collab/cloud-relay.test.ts`).- The Cloud portal is its own entry (`cloud.html`, `src/cloud/`, `src/views/cloud/`) that the Cloud server serves beside the editor (`bun run build:cloud`); it must not import editor sessions, CanvasKit, or `src/app/shell/**`, so its pages load without the editor (`open-pencil/no-editor-imports-in-cloud-portal`, `check:arch`).- The team's metrics dashboard is its own entry too (`metrics.html`, `src/metrics/`, `src/views/metrics/`), built by `bun run build:metrics` into `dist-metrics/` with base `/admin/` and served only by the feedback Worker behind Cloudflare Access; it follows the Cloud portal's isolation rule and reads its numbers through `@open-pencil/feedback/client` (`packages/feedback/tests/admin.test.ts`).+- The app's pages listed in `bootSplashPlugin`'s `pages` (`vite.config.ts`) get the one boot splash from `vite/boot-splash`, after their `#app`, with its stylesheet and theme script built from `src/splash/`; never copy splash markup, styles, or theme logic into a page. The theme is the stored setting in `src/app/settings/theme.ts`, which the editor and the portal both resolve (`tests/app/settings/theme.test.ts`).- Which portal pages a visitor may open, by sign-in and account standing, is decided in `portalDestination` alone, and whether an editor page opens the editor or the welcome page in `siteDestination` (`tests/app/cloud-portal/navigation.test.ts`, `site.test.ts`).- On a Cloud server's own build (`__OPENPENCIL_CLOUD_SITE__`), `src/main.ts` runs the welcome check (`enterCloudSite` in `src/app/cloud-portal/site.ts`) after the support check and before `boot()`, so signed-out visitors never load the editor (`tests/app/cloud-portal/site.test.ts`).- A room is a document: every room tab owns its session (`src/app/collab/rooms.ts`, `session.ts`), joining always opens a new tab, and only Share binds an existing document; the collaboration UI reads the active tab's room through `useCollab()` and publishes cursors through the canvas's own tab (`tests/app/collab/session.test.ts`, `tests/e2e/collab/rooms.spec.ts`).diff --git a/src/app/cloud-portal/theme.ts b/src/app/cloud-portal/theme.tsindex ce1fec372..136cbb5e8 100644--- a/src/app/cloud-portal/theme.ts+++ b/src/app/cloud-portal/theme.ts@@ -1,14 +1,26 @@-import { usePreferredDark } from '@vueuse/core'+import { useLocalStorage, usePreferredDark } from '@vueuse/core'import { watchEffect } from 'vue'+import {+ DEFAULT_THEME,+ resolveAppTheme,+ THEME_STORAGE_KEY,+ type AppTheme+} from '@/app/settings/theme'+/**- * Follows the system color scheme. The portal is served from the Cloud server's origin, so the- * editor's stored theme and accent are not visible here; the stylesheet's default accent applies.+ * Takes the editor's theme, which a Cloud server's pages share with the editor it serves from the+ * same address, so the boot splash and the page keep the editor's colours. Elsewhere, as for the+ * metrics dashboard, no theme is stored and the editor's default applies. The editor's accent+ * stays the editor's; the stylesheet's default accent applies.*/export function usePortalTheme(): void {+ const setting = useLocalStorage<AppTheme>(THEME_STORAGE_KEY, DEFAULT_THEME, {+ writeDefaults: false+ })const prefersDark = usePreferredDark()watchEffect(() => {- const value = prefersDark.value ? 'dark' : 'light'+ const value = resolveAppTheme(setting.value, prefersDark.value)document.documentElement.dataset.theme = valuedocument.documentElement.style.colorScheme = value})diff --git a/src/app/settings/automation.ts b/src/app/settings/automation.tsindex aa0b60ac6..81a2b8717 100644--- a/src/app/settings/automation.ts+++ b/src/app/settings/automation.ts@@ -16,8 +16,9 @@ import {updateDesignCheckPreferences,type AppPreferences} from '@/app/settings/preferences/store'+import { APP_THEMES, type AppTheme } from '@/app/settings/theme'import { accentPreferenceSchema } from '@/app/shell/accent/schema'-import { APP_THEMES, getAppTheme, setAppTheme, type AppTheme } from '@/app/shell/theme'+import { getAppTheme, setAppTheme } from '@/app/shell/theme'/*** The editor preferences that automation clients (CLI, MCP) may read and change.diff --git a/src/app/settings/theme.ts b/src/app/settings/theme.tsnew file mode 100644index 000000000..cd3e9643a--- /dev/null+++ b/src/app/settings/theme.ts@@ -0,0 +1,25 @@+/**+ * The stored theme setting, shared by the editor, the Cloud server's pages, and the boot splash+ * every page draws before its script loads (`src/splash/theme.ts`), so they all start in one+ * theme. It depends on nothing, so the splash's inlined script stays small.+ */+export const APP_THEMES = ['dark', 'light', 'auto'] as const+export type AppTheme = (typeof APP_THEMES)[number]++export const THEME_STORAGE_KEY = 'open-pencil:theme'+export const DEFAULT_THEME: AppTheme = 'dark'++/** The theme in effect; a stored value that is not a theme reads as the default dark. */+export function resolveAppTheme(setting: unknown, prefersDark: boolean): 'dark' | 'light' {+ if (setting === 'auto') return prefersDark ? 'dark' : 'light'+ return setting === 'light' ? 'light' : 'dark'+}++/** The stored setting as the page starts, or null where storage cannot be read. */+export function readStoredTheme(): string | null {+ try {+ return localStorage.getItem(THEME_STORAGE_KEY)+ } catch {+ return null+ }+}diff --git a/src/app/shell/support/render.ts b/src/app/shell/support/render.tsindex 3e5449ef7..9219bcbc1 100644--- a/src/app/shell/support/render.ts+++ b/src/app/shell/support/render.ts@@ -4,7 +4,7 @@ import type { SupportNotice } from './guidance'/*** Root element the notice replaces. It is the app mount point, so the notice- * takes over whatever the splash or a half-mounted app left behind.+ * takes over whatever a half-mounted app left behind, and the splash beside it hides.*/const APP_ROOT_SELECTOR = '#app'export const BOOT_NOTICE_ID = 'boot-notice'diff --git a/src/app/shell/theme.ts b/src/app/shell/theme.tsindex 8536a7968..54f838965 100644--- a/src/app/shell/theme.ts+++ b/src/app/shell/theme.ts@@ -6,23 +6,19 @@ import { IS_BROWSER } from '@open-pencil/core/constants'import { parseColor } from '@open-pencil/scene-graph/color'import { getActiveEditorStoreOrNull, useActiveEditorStoreRef } from '@/app/editor/active-store'+import {+ DEFAULT_THEME,+ resolveAppTheme,+ THEME_STORAGE_KEY,+ type AppTheme+} from '@/app/settings/theme'import { useAccentPalette } from '@/app/shell/accent'import { ACCENT_TOKENS, type AccentPalette } from '@/app/shell/accent/palette'-export const APP_THEMES = ['dark', 'light', 'auto'] as const-export type AppTheme = (typeof APP_THEMES)[number]--// `index.html` reads the same key, so its boot splash starts in this theme.-const THEME_STORAGE_KEY = 'open-pencil:theme'-const DEFAULT_THEME: AppTheme = 'dark'-const theme = useLocalStorage<AppTheme>(THEME_STORAGE_KEY, DEFAULT_THEME)const prefersDark = usePreferredDark()-/** The theme in effect; a stored value that is not a theme reads as the default dark. */-export const resolvedAppTheme = computed<'dark' | 'light'>(() => {- if (theme.value === 'auto') return prefersDark.value ? 'dark' : 'light'- return theme.value === 'light' ? 'light' : 'dark'-})+/** The theme in effect. */+export const resolvedAppTheme = computed(() => resolveAppTheme(theme.value, prefersDark.value))const accentPalette = useAccentPalette(() => resolvedAppTheme.value)function readRulerTheme(): RulerTheme | null {diff --git a/src/splash/style.css b/src/splash/style.cssnew file mode 100644index 000000000..b1c93a065--- /dev/null+++ b/src/splash/style.css@@ -0,0 +1,75 @@+:root {+ --loader-bg: #1e1e1e;+ --loader-fg: 255, 255, 255;+}+@media (prefers-color-scheme: light) {+ :root {+ --loader-bg: #f3f4f6;+ --loader-fg: 32, 33, 36;+ }+}+html[data-theme='dark'] {+ --loader-bg: #1e1e1e;+ --loader-fg: 255, 255, 255;+}+html[data-theme='light'] {+ --loader-bg: #f3f4f6;+ --loader-fg: 32, 33, 36;+}+body {+ margin: 0;+ background: var(--loader-bg);+}+#boot-splash {+ position: fixed;+ inset: 0;+ display: flex;+ align-items: center;+ justify-content: center;+ z-index: 9999;+ color: rgb(var(--loader-fg));+ background: var(--loader-bg);+}+/* The splash follows the page's mount element and covers it until the app draws something there. */+#app:not(:empty) ~ #boot-splash {+ display: none;+}+#boot-splash::before {+ content: '';+ width: 40px;+ height: 40px;+ background: url('/brand/app-icon.svg') center / contain no-repeat;+}+#boot-splash .bar {+ position: absolute;+ bottom: 50%;+ left: 50%;+ transform: translate(-50%, 40px);+ width: 100px;+ height: 2px;+ background: rgba(var(--loader-fg), 0.08);+ border-radius: 1px;+ overflow: hidden;+}+#boot-splash .bar::after {+ content: '';+ display: block;+ height: 100%;+ width: 40%;+ background: rgba(var(--loader-fg), 0.25);+ border-radius: 1px;+ animation: slide 1s ease-in-out infinite;+}+@keyframes slide {+ 0% {+ transform: translateX(-100%);+ }+ 100% {+ transform: translateX(350%);+ }+}+@media (prefers-reduced-motion: reduce) {+ #boot-splash .bar::after {+ animation: none;+ }+}diff --git a/src/splash/theme.ts b/src/splash/theme.tsnew file mode 100644index 000000000..7a777eb84--- /dev/null+++ b/src/splash/theme.ts@@ -0,0 +1,11 @@+import { readStoredTheme, resolveAppTheme } from '@/app/settings/theme'++// The splash's stylesheet builds with this script, and each page inlines both.+import './style.css'++// Runs inline in each page's head, before anything paints (`vite/boot-splash`), so the splash and+// the page start in the theme the page will take.+document.documentElement.dataset.theme = resolveAppTheme(+ readStoredTheme(),+ matchMedia('(prefers-color-scheme: dark)').matches+)diff --git a/tests/app/settings/theme.test.ts b/tests/app/settings/theme.test.tsnew file mode 100644index 000000000..0cf88abdf--- /dev/null+++ b/tests/app/settings/theme.test.ts@@ -0,0 +1,17 @@+import { describe, expect, test } from 'bun:test'++import { resolveAppTheme } from '@/app/settings/theme'++describe('stored theme', () => {+ test('start dark unless light was chosen, whatever the system prefers', () => {+ expect(resolveAppTheme(null, false)).toBe('dark')+ expect(resolveAppTheme('dark', false)).toBe('dark')+ expect(resolveAppTheme('light', true)).toBe('light')+ expect(resolveAppTheme('sepia', false)).toBe('dark')+ })++ test('follow the system when set to auto', () => {+ expect(resolveAppTheme('auto', true)).toBe('dark')+ expect(resolveAppTheme('auto', false)).toBe('light')+ })+})diff --git a/tools/checks/lint/src/rules/runtime.ts b/tools/checks/lint/src/rules/runtime.tsindex 180b00288..8f4a869cc 100644--- a/tools/checks/lint/src/rules/runtime.ts+++ b/tools/checks/lint/src/rules/runtime.ts@@ -24,6 +24,7 @@ const noDirectStorageAccess = {'/src/app/ai/chat/storage.ts','/src/app/cache/index.ts','/src/app/settings/credentials/storage.ts',+ '/src/app/settings/theme.ts','/src/app/shell/layout-storage.ts','/packages/vue/src/i18n/locale.ts']diff --git a/vite.config.ts b/vite.config.tsindex 8158488e5..ada163ba1 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -19,6 +19,7 @@ import {localAutomationToken,openPencilAutomationPlugin} from './vite/automation'+import { bootSplashPlugin } from './vite/boot-splash'import { cloudSitePlugin } from './vite/cloud-site'import { aiIconCollection } from './vite/icons'import { metricsBrandPlugin } from './vite/metrics'@@ -60,6 +61,10 @@ export default defineConfig(async ({ command, mode }) => {optimizeDeps: { include: ['ai/test'] },plugins: [rawMarkdownPlugin(),+ bootSplashPlugin({+ entry: resolve(__dirname, 'src/splash/theme.ts'),+ pages: ['index.html', 'cloud.html', 'metrics.html']+ }),tailwindcss(),Icons({ compiler: 'vue3', customCollections: { ai: aiIconCollection() } }),Components({ resolvers: [IconsResolver({ prefix: 'icon', customCollections: ['ai'] })] }),diff --git a/vite/boot-splash/index.ts b/vite/boot-splash/index.tsnew file mode 100644index 000000000..67c9ccf11--- /dev/null+++ b/vite/boot-splash/index.ts@@ -0,0 +1,131 @@+import { readdirSync } from 'node:fs'+import { basename, dirname, join } from 'node:path'++import { build, type Plugin, type ResolvedConfig } from 'vite'++type Compiled = {+ script: string+ style: string+ /** Every source the script and stylesheet were built from, to rebuild when one changes. */+ sources: string[]+}++export type BootSplashOptions = {+ /** The script that starts the page in its theme; it imports the splash's stylesheet. */+ entry: string+ /**+ * The app's pages, by file name, that draw the splash. Other pages Vite builds with this+ * config, such as Storybook's, are left as they are.+ */+ pages: readonly string[]+}++/** Builds the script and its stylesheet with the app's own aliases and browser targets. */+async function compile(config: ResolvedConfig, entry: string): Promise<Compiled> {+ const result = await build({+ configFile: false,+ logLevel: 'silent',+ root: config.root,+ publicDir: false,+ resolve: { alias: config.resolve.alias },+ build: {+ write: false,+ target: config.build.target,+ cssTarget: config.build.cssTarget,+ minify: true,+ cssCodeSplit: false,+ modulePreload: false,+ rolldownOptions: { input: entry, output: { format: 'iife' } }+ }+ })+ const outputs = (Array.isArray(result) ? result : [result]).flatMap((output) =>+ 'output' in output ? output.output : []+ )+ const chunk = outputs.find((file) => file.type === 'chunk')+ const style = outputs.find((file) => file.type === 'asset' && file.fileName.endsWith('.css'))+ if (chunk?.type !== 'chunk' || style?.type !== 'asset') {+ throw new Error(`The boot splash (${entry}) must build to one script and one stylesheet`)+ }+ const script = chunk.code.trim()+ // Inlined as is, the script must not close its own tag.+ if (script.includes('</script')) throw new Error('The boot splash script cannot be inlined')+ return { script, style: String(style.source).trim(), sources: chunk.moduleIds }+}++/**+ * Draws one boot splash on each of the app's pages, with its stylesheet and the script that starts+ * the page in its theme, all inlined so they show before anything loads. The stylesheet and script+ * are built by Vite from `entry`, minified and lowered to the app's browser targets.+ */+export function bootSplashPlugin({ entry, pages }: BootSplashOptions): Plugin {+ let config: ResolvedConfig | undefined+ let compiled: Promise<Compiled> | null = null+ // The sources of the last build that worked, kept through one that failed, so fixing the+ // failing edit rebuilds; before any build has worked, the splash's own folder.+ let sources: readonly string[] = []+ const current = () => {+ if (!config) throw new Error('The boot splash plugin ran before Vite resolved its config')+ compiled ??= compile(config, entry).then(+ (result) => {+ sources = result.sources+ return result+ },+ (error: unknown) => {+ compiled = null+ throw error+ }+ )+ return compiled+ }+ // What to watch now: the last working build's sources, or every file in the splash's folder.+ const watched = () =>+ sources.length > 0+ ? sources+ : readdirSync(dirname(entry)).map((name) => join(dirname(entry), name))+ const changed = (file: string) => {+ const source = sources.length > 0 ? sources.includes(file) : file.startsWith(dirname(entry))+ if (source) compiled = null+ return source+ }+ return {+ name: 'open-pencil-boot-splash',+ configResolved(resolved) {+ config = resolved+ },+ // `vite build --watch` rebuilds the pages when a source of the splash changes.+ async buildStart() {+ for (const source of watched()) this.addWatchFile(source)+ for (const source of (await current()).sources) this.addWatchFile(source)+ },+ watchChange(id) {+ changed(id)+ },+ // The dev server reloads the page instead, since the splash only draws on a fresh load.+ configureServer(server) {+ server.watcher.add(watched())+ current()+ .then((result) => server.watcher.add(result.sources))+ .catch((error: unknown) => server.config.logger.error(`Boot splash: ${String(error)}`))+ server.watcher.on('change', (file) => {+ if (changed(file)) server.ws.send({ type: 'full-reload' })+ })+ },+ transformIndexHtml: {+ async handler(html, { filename }) {+ if (!pages.includes(basename(filename))) return html+ const { script, style } = await current()+ return [+ { tag: 'style', children: style, injectTo: 'head' },+ { tag: 'script', children: script, injectTo: 'head' },+ // After the page's mount element, so the stylesheet hides it once the app draws there.+ {+ tag: 'div',+ attrs: { id: 'boot-splash', role: 'status', 'aria-label': 'Loading' },+ children: [{ tag: 'div', attrs: { class: 'bar' } }],+ injectTo: 'body'+ }+ ]+ }+ }+ }+}