Skip to content

Commit

Permalink
Provide a way to customize app name & desc (#854)
Browse files Browse the repository at this point in the history
* Provide a way to customize app name & desc
* Add description to SB_NAME, SB_DESCRIPTION env vars

---------

Co-authored-by: s1gnate.sync <[email protected]>
  • Loading branch information
s1gnate-sync and s1gnate.sync authored Apr 21, 2024
1 parent 632243c commit 3786524
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cmd/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,25 @@ export async function serveCommand(
new PrefixedKvPrimitives(baseKvPrimitives, ["*"]),
);
}

const clientAssets = new AssetBundle(clientAssetBundle as AssetJson);
const manifestName = Deno.env.get("SB_NAME");
const manifestDescription = Deno.env.get("SB_DESCRIPTION");

if (manifestName || manifestDescription) {
const manifestData = JSON.parse(clientAssets.readTextFileSync('.client/manifest.json'));
if (manifestName) {
manifestData.name = manifestData.short_name = manifestName;
}
if (manifestDescription) {
manifestData.description = manifestDescription;
}
clientAssets.writeTextFileSync('.client/manifest.json', 'application/json', JSON.stringify(manifestData));
}
const httpServer = new HttpServer({
hostname,
port,
clientAssetBundle: new AssetBundle(clientAssetBundle as AssetJson),
clientAssetBundle: clientAssets,
plugAssetBundle: plugAssets,
baseKvPrimitives,
keyFile: options.key,
Expand Down
7 changes: 7 additions & 0 deletions website/Install/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,10 @@ Configuration only relevant to docker deployments:

* `PUID`: Runs the server process with the specified UID (default: whatever user owns the `/space` mapped folder)
* `GUID`: Runs the server process with the specified GID (default: whatever group owns the `/space` mapped folder)

# Web app manifest
Configure aspects of web app appearance:

* `SB_NAME`: Sets `name` and `short_name` members of web app manifest to whatever specified in `SB_NAME`
* `SB_DESCRIPTION`: Sets `description` member of web app manifest to whatever specified in `SB_DESCRIPTION`

0 comments on commit 3786524

Please sign in to comment.