ci: updating build to support ws url

This commit is contained in:
Chubby Granny Chaser
2025-05-09 20:52:03 +01:00
parent aa18b57ada
commit 6c44cc0cc4
83 changed files with 1810 additions and 3040 deletions

View File

@@ -1,4 +1,4 @@
import { Notification, app } from "electron";
import { Notification } from "electron";
import { t } from "i18next";
import trayIcon from "@resources/tray-icon.png?asset";
import fs from "node:fs";
@@ -13,13 +13,14 @@ import { WindowManager } from "../window-manager";
import type { Game, UserPreferences } from "@types";
import { db, levelKeys } from "@main/level";
import { restartAndInstallUpdate } from "@main/events/autoupdater/restart-and-install-update";
import { SystemPath } from "../system-path";
async function downloadImage(url: string | null) {
if (!url) return undefined;
if (!url.startsWith("http")) return undefined;
const fileName = url.split("/").pop()!;
const outputPath = path.join(app.getPath("temp"), fileName);
const outputPath = path.join(SystemPath.getPath("temp"), fileName);
const writer = fs.createWriteStream(outputPath);
const response = await axios.get(url, {
@@ -80,7 +81,9 @@ export const publishNotificationUpdateReadyToInstall = async (
.show();
};
export const publishNewFriendRequestNotification = async () => {
export const publishNewFriendRequestNotification = async (
senderProfileImageUrl?: string
) => {
const userPreferences = await db.get<string, UserPreferences | null>(
levelKeys.userPreferences,
{
@@ -97,7 +100,9 @@ export const publishNewFriendRequestNotification = async () => {
body: t("new_friend_request_description", {
ns: "notifications",
}),
icon: trayIcon,
icon: senderProfileImageUrl
? await downloadImage(senderProfileImageUrl)
: trayIcon,
}).show();
};