fix(cli): handle better public apps

This commit is contained in:
Ruben Fiszel
2025-11-25 12:12:49 +00:00
parent 897faf085b
commit de7739a3ee
2 changed files with 11 additions and 3 deletions
+8 -3
View File
@@ -18,6 +18,7 @@ import { readInlinePathSync } from "../../utils/utils.ts";
export interface AppFile {
value: any;
public?: boolean;
summary: string;
policy: Policy;
}
@@ -45,6 +46,10 @@ export async function pushApp(
} catch {
//ignore
}
if (app?.["policy"]?.["execution_mode"] == "anonymous") {
app.public = true;
}
// console.log(app);
if (app) {
app.policy = undefined;
}
@@ -80,7 +85,7 @@ export async function pushApp(
}
replaceInlineScripts(localApp.value);
await generatingPolicy(localApp, remotePath);
await generatingPolicy(localApp, remotePath, localApp?.["public"] ?? false);
if (app) {
if (isSuperset(localApp, app)) {
log.info(colors.green(`App ${remotePath} is up to date`));
@@ -109,11 +114,11 @@ export async function pushApp(
}
}
async function generatingPolicy(app: any, path: string) {
async function generatingPolicy(app: any, path: string, publicApp: boolean) {
log.info(colors.gray(`Generating fresh policy for app ${path}...`));
try {
app.policy = await windmillUtils.updatePolicy(app.value, undefined);
app.policy.execution_mode = "publisher";
app.policy.execution_mode = publicApp ? "anonymous" : "publisher";
} catch (e) {
log.error(colors.red(`Error generating policy for app ${path}: ${e}`));
throw e;
+3
View File
@@ -415,6 +415,9 @@ function ZipFSElement(
};
}
if (app?.["policy"]?.["execution_mode"] == "anonymous") {
app.public = true;
}
app.policy = undefined;
yield {
isDirectory: false,