Files
Chubby Granny Chaser 0458a93b60 feat: add friends window and review replies (#2301)
* fix: make onInAppAchievementUnlocked optional in renderer declaration and add runtime check for safe handling

* feat: add friends window and review replies

* style: format friends window styles

* feat: refine friends window and review UI

* feat: add friends window review replies

* style: format friend request event files

* chore: sync proto submodule

---------

Co-authored-by: Hachi-R <drive8hachi@gmail.com>
Co-authored-by: Chubby Granny Chaser <hydralauncher@proton.me>
Co-authored-by: Helio Kroger <me@heliokroger.com>
2026-06-12 18:04:13 +01:00

84 lines
2.4 KiB
JavaScript

const fs = require("node:fs");
const { S3Client, PutObjectCommand } = require("@aws-sdk/client-s3");
const path = require("node:path");
const packageJson = require("../package.json");
if (!process.env.BUILD_WEBHOOK_URL) {
console.log("No BUILD_WEBHOOK_URL provided, skipping upload");
process.exit(0);
}
const flavor = process.env.BUILD_FLAVOR || "staging";
const isProduction = flavor === "production";
const s3 = new S3Client({
region: "auto",
endpoint: process.env.S3_ENDPOINT,
forcePathStyle: true,
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
},
});
const dist = path.resolve(__dirname, "..", "dist");
const extensionsToUpload = [".deb", ".exe", ".AppImage"];
fs.readdir(dist, async (err, files) => {
if (err) throw err;
const uploads = await Promise.all(
files
.filter((file) => extensionsToUpload.includes(path.extname(file)))
.map(async (file) => {
console.log(`⌛️ Uploading ${file}...`);
const fileName = `${flavor}-${new Date().getTime()}-${file}`;
const command = new PutObjectCommand({
Bucket: process.env.S3_BUILDS_BUCKET_NAME,
Key: fileName,
Body: fs.createReadStream(path.resolve(dist, file)),
// 3 days
Expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 3),
});
await s3.send(command);
return {
url: `${process.env.BUILDS_URL}/${fileName}`,
name: fileName,
};
})
);
for (const upload of uploads) {
await fetch(process.env.BUILD_WEBHOOK_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
username: "Hydra Builds",
embeds: [
{
description: process.env.BRANCH_NAME,
color: isProduction ? 5763719 : 5814783,
title: `🔥 Nova build do Hydra [${flavor.toUpperCase()}] (versão ${packageJson.version})`,
fields: [
{
name: "",
value: `⬇️ Baixar\n[${upload.name}](${upload.url})`,
},
],
footer: {
text: process.env.GITHUB_ACTOR,
icon_url: `https://avatars.githubusercontent.com/u/${process.env.GITHUB_ACTOR_ID}`,
},
},
],
}),
});
}
});