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 64 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 255 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 255 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 347 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 353 days ago