PeterPinetree commited on
Commit
d98e39c
·
1 Parent(s): 415ff38

embed: bake NEXT_PUBLIC_EMBED_MODE at build; hide load/deploy/login/gallery/help in embed; default brand logo/icon to /logo.png

Browse files
Files changed (3) hide show
  1. Dockerfile +3 -2
  2. components/editor/index.tsx +4 -4
  3. lib/branding.ts +1 -1
Dockerfile CHANGED
@@ -16,6 +16,9 @@ USER root
16
  RUN sed -i 's/\r$//' /usr/src/app/start.sh && chmod +x /usr/src/app/start.sh
17
  USER 1000
18
 
 
 
 
19
  # Build the app
20
  RUN npm run build
21
 
@@ -28,7 +31,5 @@ ENV PORT=7860
28
  # Disable telemetry and ensure production env
29
  ENV NEXT_TELEMETRY_DISABLED=1
30
  ENV NODE_ENV=production
31
- # Enable embed/lite mode UI and auth disablement in the Space
32
- ENV NEXT_PUBLIC_EMBED_MODE=true
33
  # Start via script that logs and honors $PORT
34
  ENTRYPOINT ["/usr/src/app/start.sh"]
 
16
  RUN sed -i 's/\r$//' /usr/src/app/start.sh && chmod +x /usr/src/app/start.sh
17
  USER 1000
18
 
19
+ # Make embed/lite mode available at build-time for client code
20
+ ENV NEXT_PUBLIC_EMBED_MODE=true
21
+
22
  # Build the app
23
  RUN npm run build
24
 
 
31
  # Disable telemetry and ensure production env
32
  ENV NEXT_TELEMETRY_DISABLED=1
33
  ENV NODE_ENV=production
 
 
34
  # Start via script that logs and honors $PORT
35
  ENTRYPOINT ["/usr/src/app/start.sh"]
components/editor/index.tsx CHANGED
@@ -27,7 +27,7 @@ import { SaveButton } from "./save-button";
27
  import { LoadProject } from "../my-projects/load-project";
28
  import { isTheSameHtml } from "@/lib/compare-html-diff";
29
  import { ListPages } from "./pages";
30
- import { HIDE_DEPLOY, HIDE_LOGIN } from "@/lib/flags";
31
 
32
  export const AppEditor = ({
33
  project,
@@ -196,15 +196,15 @@ export const AppEditor = ({
196
  return (
197
  <section className="h-[100dvh] bg-neutral-950 flex flex-col">
198
  <Header tab={currentTab} onNewTab={setCurrentTab}>
199
- {!HIDE_LOGIN && (
 
200
  <LoadProject
201
  onSuccess={(project: Project) => {
202
  router.push(`/projects/${project.space_id}`);
203
  }}
204
  />
205
  )}
206
- {/* for these buttons pass the whole pages */}
207
- {!HIDE_DEPLOY && (
208
  <>
209
  {project?._id ? (
210
  <SaveButton pages={pages} prompts={prompts} />
 
27
  import { LoadProject } from "../my-projects/load-project";
28
  import { isTheSameHtml } from "@/lib/compare-html-diff";
29
  import { ListPages } from "./pages";
30
+ import { EMBED_MODE, HIDE_DEPLOY, HIDE_LOGIN } from "@/lib/flags";
31
 
32
  export const AppEditor = ({
33
  project,
 
196
  return (
197
  <section className="h-[100dvh] bg-neutral-950 flex flex-col">
198
  <Header tab={currentTab} onNewTab={setCurrentTab}>
199
+ {/* Hide project loading and deploy/save controls in embed mode */}
200
+ {!HIDE_LOGIN && !EMBED_MODE && (
201
  <LoadProject
202
  onSuccess={(project: Project) => {
203
  router.push(`/projects/${project.space_id}`);
204
  }}
205
  />
206
  )}
207
+ {!EMBED_MODE && !HIDE_DEPLOY && (
 
208
  <>
209
  {project?._id ? (
210
  <SaveButton pages={pages} prompts={prompts} />
lib/branding.ts CHANGED
@@ -7,7 +7,7 @@ export const BRAND_NAME: string = process.env.NEXT_PUBLIC_BRAND_NAME ?? "inSite"
7
 
8
  // Primary logo used in headers/nav. Prefer PNG as requested; fallback to existing SVG.
9
  export const BRAND_LOGO_SRC: string =
10
- process.env.NEXT_PUBLIC_BRAND_LOGO ?? "/logo.svg";
11
 
12
  // Favicon/app icon (can be same as logo). Prefer PNG; fallback to BRAND_LOGO_SRC.
13
  export const BRAND_ICON_SRC: string =
 
7
 
8
  // Primary logo used in headers/nav. Prefer PNG as requested; fallback to existing SVG.
9
  export const BRAND_LOGO_SRC: string =
10
+ process.env.NEXT_PUBLIC_BRAND_LOGO ?? "/logo.png";
11
 
12
  // Favicon/app icon (can be same as logo). Prefer PNG; fallback to BRAND_LOGO_SRC.
13
  export const BRAND_ICON_SRC: string =