Even store integration

This commit is contained in:
James Babcock committed 2026-08-16 21:01:20 -07:00
1 parent 5cd61da362
commit add8763028
16 files changed
+737 -56

No files matched your search

+9
View File
@@ -27,6 +27,8 @@ export type FilesAppOptions = InProcessAppOptions & {
openImageWindow: (title: string, path: string) => void;
/** Launch an EvenHub app package (.ehpk) through the EvenHub host. */
openEhpkApp: (path: string) => void;
/** Copy an EHPK into the installed-app store, register it, and launch it. */
installEhpkApp: (path: string) => Promise<void> | void;
/** Open a font file's previewer as its own shell window. */
openFontWindow: (title: string, path: string) => void;
};
@@ -170,6 +172,13 @@ function fileOpenActions(entry: DirectoryEntry, options: FilesAppOptions): FileI
options.openEhpkApp(entry.path);
},
},
{
label: "Install",
onSelect: async (ctx) => {
ctx.stack.pop();
await options.installEhpkApp(entry.path);
},
},
];
}
if (isDecodableImageFile(entry.name)) {
+15
View File
@@ -1,5 +1,10 @@
import { type AppContext, type AppDefinition } from "../app-definition";
import { openEvenHubPackage } from "../evenhub";
import {
installEvenHubPackageFile,
installedEvenHubAppId,
} from "../evenhub/installed-apps";
import { closeRunningPackage } from "../evenhub/manager";
import {
createFilesAppWindow,
createFontDocumentWindow,
@@ -61,6 +66,16 @@ const filesApp: AppDefinition = {
ctx.appendLog(`evenhub launch failed: ${error}`);
});
},
installEhpkApp: async (path) => {
try {
const installed = installEvenHubPackageFile(path);
ctx.appendLog(`evenhub: installed ${installed.packageId} ${installed.version}`);
closeRunningPackage(installed.packageId);
await ctx.launchApp(installedEvenHubAppId(installed.packageId));
} catch (error) {
ctx.appendLog(`evenhub install failed: ${error}`);
}
},
openFontWindow: (title, path) => openFontDocumentWindow(ctx, title, path),
}),
),