type DiscordWebhook = {
webhook_url: string;
};
type Base64 = string
export async function main(
discord_webhook: DiscordWebhook,
screenshot: Base64,
kind: 'pdf' | 'png',
app_path: string
) {
const formData = new FormData();
formData.append(
"files[0]",
new Blob([Buffer.from(screenshot, "base64")], {
type: kind === "pdf" ? "application/pdf" : "image/png",
}),
"report." + kind
);
const fullAppPath = Bun.env["WM_BASE_URL"] + '/apps/get/' + app_path + '?workspace=' + Bun.env["WM_WORKSPACE"]
formData.append(
"payload_json",
JSON.stringify({ content: "App report of [" + app_path + "](" + fullAppPath + ")" })
);
const response = await fetch(discord_webhook.webhook_url, {
method: "POST",
body: formData,
});
return response.text();
}
Submitted by hugo697 100 days ago
type DiscordWebhook = {
webhook_url: string;
};
type Base64 = string
export async function main(
discord_webhook: DiscordWebhook,
screenshot: Base64,
kind: 'pdf' | 'png',
app_path: string
) {
const formData = new FormData();
formData.append(
"files[0]",
new Blob([Buffer.from(screenshot, "base64")], {
type: kind === "pdf" ? "application/pdf" : "image/png",
}),
"report." + kind
);
const fullAppPath = Bun.env["WM_BASE_URL"] + '/apps/get/' + app_path + '?workspace=' + Bun.env["WM_WORKSPACE"]
formData.append(
"payload_json",
JSON.stringify({ content: "App report of [" + app_path + "](" + fullAppPath + ")" })
);
const response = await fetch(discord_webhook.webhook_url, {
method: "POST",
body: formData,
});
return response.text();
}
Submitted by hugo697 292 days ago
type DiscordWebhook = {
webhook_url: string;
};
export async function main(
discord_webhook: DiscordWebhook,
pdf: string,
app_path: string
) {
const formData = new FormData();
formData.append(
"files[0]",
new Blob([Buffer.from(pdf, "base64")], {
type: "application/pdf",
}),
"report.pdf"
);
formData.append(
"payload_json",
JSON.stringify({ content: "App report of " + app_path })
);
const response = await fetch(discord_webhook.webhook_url, {
method: "POST",
body: formData,
});
return response.text();
}
Submitted by hugo697 292 days ago
type DiscordWebhook = {
webhook_url: string;
};
type Base64 = string
export async function main(
discord_webhook: DiscordWebhook,
screenshot: Base64,
kind: 'pdf' | 'png',
app_path: string
) {
const formData = new FormData();
formData.append(
"files[0]",
new Blob([Buffer.from(screenshot, "base64")], {
type: kind === "pdf" ? "application/pdf" : "image/png",
}),
"report." + kind
);
const fullAppPath = Bun.env["WM_BASE_URL"] + '/apps/get/' + app_path + '?workspace=' + Bun.env["WM_WORKSPACE"]
formData.append(
"payload_json",
JSON.stringify({ content: "App report of [" + app_path + "](" + fullAppPath + ")" })
);
const response = await fetch(discord_webhook.webhook_url, {
method: "POST",
body: formData,
});
return response.text();
}
Submitted by hugo697 384 days ago
type DiscordWebhook = {
webhook_url: string;
};
export async function main(
discord_webhook: DiscordWebhook,
pdf: string,
app_path: string
) {
const formData = new FormData();
formData.append(
"files[0]",
new Blob([Buffer.from(pdf, "base64")], {
type: "application/pdf",
}),
"report.pdf"
);
formData.append(
"payload_json",
JSON.stringify({ content: "App report of " + app_path })
);
const response = await fetch(discord_webhook.webhook_url, {
method: "POST",
body: formData,
});
return response.text();
}
Submitted by hugo697 389 days ago