Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Ship the processor in server builds by default and hide its links when absent (#8280)

Anthony Stirling3b5001c4081b
diff --git a/app/core/build.gradle b/app/core/build.gradle
index ddc5d68a79..d523439a33 100644
--- a/app/core/build.gradle
+++ b/app/core/build.gradle
@@ -157,12 +157,10 @@ springBoot {
// Frontend build tasks - only enabled with -PbuildWithFrontend=true
def buildWithFrontend = project.hasProperty('buildWithFrontend') && project.property('buildWithFrontend') == 'true'
def buildPrototypes = project.hasProperty('prototypesMode') && project.property('prototypesMode') == 'true'
-// The admin portal ships as a lazy route inside the editor bundle (see
-// proprietary/routes/adminRouteExtensions). -PbuildWithPortal=true includes that
-// chunk via VITE_INCLUDE_PORTAL on the editor build; the deploy GHA sets it when
-// the portal or AI layers change. Building the portal implies building the editor.
-def buildWithPortal = project.hasProperty('buildWithPortal') && project.property('buildWithPortal') == 'true'
-if (buildWithPortal) {
+// The processor ships in every editor build by default; -PbuildWithPortal=false leaves it out.
+// An explicit -PbuildWithPortal=true also forces the editor build.
+def buildWithPortal = project.findProperty('buildWithPortal')?.toString() != 'false'
+if (project.findProperty('buildWithPortal')?.toString() == 'true') {
buildWithFrontend = true
}
// Workspace root holds package.json and node_modules (shared across editor /
@@ -274,6 +272,8 @@ tasks.register('npmBuild', Exec) {
inputs.dir(new File(frontendEditorDir, 'src'))
inputs.dir(new File(frontendEditorDir, 'public'))
inputs.file(new File(frontendDir, 'package.json'))
+ // Toggling the processor must rebuild the bundle, not reuse the cached dist.
+ inputs.property('includePortal', buildWithPortal)
outputs.dir(frontendEditorDistDir)
// Show live output
diff --git a/docker/embedded/Dockerfile b/docker/embedded/Dockerfile
index 2f8fad6fb4..65115676e1 100644
--- a/docker/embedded/Dockerfile
+++ b/docker/embedded/Dockerfile
@@ -58,9 +58,8 @@ COPY . .
ARG PROTOTYPES_BUILD=false
ARG STIRLING_FLAVOR=proprietary
ENV STIRLING_FLAVOR=${STIRLING_FLAVOR}
-# Embed the admin portal app at /portal. Set true by the deploy workflow when the
-# portal or AI layers change; defaults false so normal builds skip the extra app.
-ARG BUILD_PORTAL=false
+# Include the processor (admin portal) in the bundled editor; false leaves it out.
+ARG BUILD_PORTAL=true
# Which Stirling account the portal connects to. Build-time because Vite inlines VITE_* into the
# bundle; there is no runtime override. Empty leaves the committed .env.proprietary defaults, which
diff --git a/docker/embedded/Dockerfile.fat b/docker/embedded/Dockerfile.fat
index 93350ec990..8689bfff3b 100644
--- a/docker/embedded/Dockerfile.fat
+++ b/docker/embedded/Dockerfile.fat
@@ -59,8 +59,8 @@ RUN --mount=type=cache,id=stirling-pdf-gradle-cache,target=/home/gradle/.gradle,
COPY . .
-# Embed the admin portal app at /portal when the deploy workflow flags it.
-ARG BUILD_PORTAL=false
+# Include the processor (admin portal) in the bundled editor; false leaves it out.
+ARG BUILD_PORTAL=true
# Bundle only the JPDFium native for this image's target arch.
ARG TARGETARCH
RUN --mount=type=cache,id=stirling-pdf-npm-cache,target=/root/.npm,sharing=locked \
diff --git a/docker/embedded/Dockerfile.ultra-lite b/docker/embedded/Dockerfile.ultra-lite
index c62dee8a98..f5ed143a33 100644
--- a/docker/embedded/Dockerfile.ultra-lite
+++ b/docker/embedded/Dockerfile.ultra-lite
@@ -46,8 +46,8 @@ RUN --mount=type=cache,id=stirling-pdf-gradle-cache,target=/home/gradle/.gradle,
COPY . .
# Build ultra-lite JAR with embedded frontend (minimal features).
-# Embed the admin portal app at /portal when the deploy workflow flags it.
-ARG BUILD_PORTAL=false
+# Include the processor (admin portal) in the bundled editor; false leaves it out.
+ARG BUILD_PORTAL=true
# Bundle only the JPDFium native for this image's target arch.
ARG TARGETARCH
RUN --mount=type=cache,id=stirling-pdf-npm-cache,target=/root/.npm,sharing=locked \
diff --git a/docker/frontend/Dockerfile b/docker/frontend/Dockerfile
index c6a6891f06..61c9b797cd 100644
--- a/docker/frontend/Dockerfile
+++ b/docker/frontend/Dockerfile
@@ -17,10 +17,9 @@ RUN node editor/scripts/generate-icons.js
# Defaults match prior behaviour. Supabase values are client-publishable build args.
ARG STIRLING_FLAVOR=proprietary
ARG VITE_BUILD_MODE=production
-# Include the processor (admin portal) route/chunk. SaaS ships it, so its
-# deploy sets this true; without it /processor and the processor's settings
-# sections are absent from the built app.
-ARG VITE_INCLUDE_PORTAL=false
+# Include the processor (admin portal) route/chunk; false drops /processor and
+# the processor's settings sections from the built app.
+ARG VITE_INCLUDE_PORTAL=true
ARG VITE_SUPABASE_URL=""
# pragma: allowlist secret
ARG VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY=""
diff --git a/frontend/editor/.env b/frontend/editor/.env
index 264a01e952..0239a6b882 100644
--- a/frontend/editor/.env
+++ b/frontend/editor/.env
@@ -7,8 +7,8 @@
# API base URL — use / for same-origin (default for web builds)
VITE_API_BASE_URL=/
-# Include the admin portal's lazy route/chunk in the build (set true by
-# -PbuildWithPortal in the JAR). Off by default; always on in dev.
+# Include the processor's lazy route/chunk. Gradle and Docker server builds turn
+# it on; off for plain vite builds, always on in dev.
VITE_INCLUDE_PORTAL=false
# Google Drive integration
diff --git a/frontend/editor/src/proprietary/components/policies/EditorPipelinesPanel.tsx b/frontend/editor/src/proprietary/components/policies/EditorPipelinesPanel.tsx
index a03f904a73..49c625b3f1 100644
--- a/frontend/editor/src/proprietary/components/policies/EditorPipelinesPanel.tsx
+++ b/frontend/editor/src/proprietary/components/policies/EditorPipelinesPanel.tsx
@@ -8,6 +8,7 @@ import OutputOutlinedIcon from "@mui/icons-material/OutputOutlined";
import { usePortalAccess } from "@app/hooks/usePortalAccess";
import { useNavigationActions } from "@app/contexts/NavigationContext";
import { PORTAL_BASENAME } from "@app/routes/portalBasename";
+import { HAS_PORTAL } from "@app/routes/hasPortal";
import { saveEditorReturnPath } from "@app/services/workbenchSession";
import { policyCategoryIcon } from "@app/components/policies/policyCategoryIcon";
import {
@@ -187,13 +188,15 @@ export function EditorPipelinesPanel() {
const navigate = useNavigate();
const { actions } = useNavigationActions();
- const openProcessor = portalAccess
- ? () =>
- actions.requestNavigation(() => {
- saveEditorReturnPath();
- navigate(PIPELINES_PATH);
- })
- : null;
+ // Builds without the processor have no /processor route to land on.
+ const openProcessor =
+ HAS_PORTAL && portalAccess
+ ? () =>
+ actions.requestNavigation(() => {
+ saveEditorReturnPath();
+ navigate(PIPELINES_PATH);
+ })
+ : null;
return (
<EditorPipelinesPanelView {...pipelines} onOpenProcessor={openProcessor} />
diff --git a/frontend/editor/src/proprietary/components/policies/ProcessingFolderSetupFlow.tsx b/frontend/editor/src/proprietary/components/policies/ProcessingFolderSetupFlow.tsx
index f12926191f..f0dc640783 100644
--- a/frontend/editor/src/proprietary/components/policies/ProcessingFolderSetupFlow.tsx
+++ b/frontend/editor/src/proprietary/components/policies/ProcessingFolderSetupFlow.tsx
@@ -27,6 +27,7 @@ import {
} from "@app/components/policies/processingFolderSetup";
import { ProcessingFolderWizard } from "@app/components/policies/ProcessingFolderWizard";
import { PORTAL_BASENAME } from "@app/routes/portalBasename";
+import { HAS_PORTAL } from "@app/routes/hasPortal";
import apiClient from "@app/services/apiClient";
import { assemblePolicies } from "@app/policies/overview";
import type { WirePolicy } from "@app/policies/types";
@@ -173,10 +174,14 @@ export function ProcessingFolderSetupFlow({
)}
destinationsLoading={sources.loading}
destinationsError={sources.error}
- onCreateDestination={() => {
- onClose();
- navigate(`${PORTAL_BASENAME}/sources/new`);
- }}
+ onCreateDestination={
+ HAS_PORTAL
+ ? () => {
+ onClose();
+ navigate(`${PORTAL_BASENAME}/sources/new`);
+ }
+ : undefined
+ }
folders={folders.folders}
loading={folders.loading || processing.loading || presets.loading}
loadError={processing.loadError ?? presets.error}
diff --git a/frontend/editor/src/proprietary/hooks/useOtherAppSwitch.ts b/frontend/editor/src/proprietary/hooks/useOtherAppSwitch.ts
index 69b55aff35..ef95525079 100644
--- a/frontend/editor/src/proprietary/hooks/useOtherAppSwitch.ts
+++ b/frontend/editor/src/proprietary/hooks/useOtherAppSwitch.ts
@@ -2,6 +2,7 @@ import { useNavigate } from "react-router-dom";
import { useAuth } from "@app/auth/context";
import { useNavigationActions } from "@app/contexts/NavigationContext";
import { PORTAL_BASENAME } from "@app/routes/portalBasename";
+import { HAS_PORTAL } from "@app/routes/hasPortal";
import { saveEditorReturnPath } from "@app/services/workbenchSession";
import { type NavFooterAppLink } from "@app/components/shared/navFooter/NavFooter";
@@ -13,7 +14,7 @@ export function useOtherAppSwitch(): NavFooterAppLink | null {
const { portalAccess } = useAuth();
const navigate = useNavigate();
const { actions } = useNavigationActions();
- if (!portalAccess) return null;
+ if (!HAS_PORTAL || !portalAccess) return null;
return {
app: "processor",
onOpen: () =>
diff --git a/frontend/editor/src/saas/hooks/useOtherAppSwitch.ts b/frontend/editor/src/saas/hooks/useOtherAppSwitch.ts
index 2b43c0cf2a..3a5a73d275 100644
--- a/frontend/editor/src/saas/hooks/useOtherAppSwitch.ts
+++ b/frontend/editor/src/saas/hooks/useOtherAppSwitch.ts
@@ -2,6 +2,7 @@ import { useNavigate } from "react-router-dom";
import { usePortalAccess } from "@app/hooks/usePortalAccess";
import { useNavigationActions } from "@app/contexts/NavigationContext";
import { PORTAL_BASENAME } from "@app/routes/portalBasename";
+import { HAS_PORTAL } from "@app/routes/hasPortal";
import { saveEditorReturnPath } from "@app/services/workbenchSession";
import { type NavFooterAppLink } from "@app/components/shared/navFooter/NavFooter";
import { useAuth } from "@app/auth/UseSession";
@@ -17,6 +18,7 @@ export function useOtherAppSwitch(): NavFooterAppLink | null {
const { isAnonymous } = useAuth();
const navigate = useNavigate();
const { actions } = useNavigationActions();
+ if (!HAS_PORTAL) return null;
if (isAnonymous) return { app: "processor", onOpen: requestProcessorSignup };
if (!portalAccess) return null;
return {