Skip to content

An open-source, self-hosted system for apps built with web technologies.

A Process's Service flag reads like its running state; the Desktop page is never kept stale

zohayrslileha611322bc4c6
diff --git a/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
index b87be06..a724961 100644
--- a/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
+++ b/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
@@ -90,11 +90,6 @@ export default class ProcessManager extends TheLink {
await this.$outbound.publish("/emit", source, event, payload)
}
- public async endpointIsService(source: string, target: HandleAddress, endpoint: "server" | "client") {
-
- return await this.$outbound.publishFirst("/endpoint/is-service", source, target, endpoint) as boolean
- }
-
/** Reads current availability for one exact Service address. */
public async serviceAvailable(address: ServiceAddress) {
diff --git a/source/client/view/components/desktop-host/host.ts b/source/client/view/components/desktop-host/host.ts
index 896b220..e53f5e7 100644
--- a/source/client/view/components/desktop-host/host.ts
+++ b/source/client/view/components/desktop-host/host.ts
@@ -427,7 +427,8 @@ export default function host(authManager: AuthManager, pane: string, viewport: D
throw new Error(`This Program declared no ${endpoint === "server" ? "Server" : "Client"} Endpoint`)
}
- return [await processManager.endpointIsService(pane, address(target), endpoint)]
+ // The synchronized Process holds it, as it holds whether the Endpoint runs.
+ return [endpoint === "server" ? target.server?.service === true : target.client?.service === true]
}
if (word === "host-service-list") {
diff --git a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
index 5adcf5a..d0ffa53 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
@@ -1567,22 +1567,6 @@ export default class ProcessManager extends TheLink {
])
}
- @Subscribe("/endpoint/is-service")
- protected async clientEndpointIsService(source: string, target: unknown, endpoint: unknown) {
-
- const process = this.find(source)
-
- if (!process.client) throw new Error("The current client endpoint is not running")
-
- if (endpoint !== "server" && endpoint !== "client") throw new Error("A service Endpoint must be server or client")
-
- const held = this.system.holdProcess(target)
-
- if (held.program !== process.program) throw new Error("The desktop does not know this process")
-
- return endpoint === "server" ? held.server?.service === true : held.client?.service === true
- }
-
@Subscribe("/service/available")
protected async serviceAvailable(address: unknown) {
diff --git a/source/server/view/view.ts b/source/server/view/view.ts
index d7335e5..ab43959 100644
--- a/source/server/view/view.ts
+++ b/source/server/view/view.ts
@@ -60,7 +60,12 @@ export default async function (config: Config) {
server.route(doors.program, program(application))
- if (config.assets) server.use("*", serveStatic({ root: config.assets }))
+ // The build names every file under assets by its content, so those never change; the page is
+ // asked for again each time, since a kept page would load the Desktop of an older System.
+ if (config.assets) server.use("*", serveStatic({
+ root: config.assets,
+ onFound: (path, context) => context.header("Cache-Control", /[\\/]assets[\\/]/.test(path) ? "public, max-age=31536000, immutable" : "no-cache")
+ }))
const hostname = config.hostname ?? "localhost"