Send User Agent when downloading files.

This commit is contained in:
jliddev
2021-04-09 14:29:13 -05:00
parent c99d7f902b
commit 4d35bb4bdc
4 changed files with 14 additions and 3 deletions

View File

@@ -64,6 +64,8 @@ import { createTray } from "./system-tray";
import { createAppMenu } from "./app-menu";
import { RendererChannels } from "./src/common/wowup";
let USER_AGENT = "";
function handle(
channel: RendererChannels,
listener: (event: IpcMainInvokeEvent, ...args: any[]) => Promise<void> | any
@@ -71,7 +73,9 @@ function handle(
ipcMain.handle(channel, listener);
}
export function initializeIpcHandlers(window: BrowserWindow): void {
export function initializeIpcHandlers(window: BrowserWindow, userAgent: string): void {
USER_AGENT = userAgent;
handle(
IPC_SHOW_DIRECTORY,
async (evt, filePath: string): Promise<string> => {
@@ -353,6 +357,9 @@ export function initializeIpcHandlers(window: BrowserWindow): void {
url: arg.url,
method: "GET",
responseType: "stream",
headers: {
"User-Agent": USER_AGENT,
},
});
// const totalLength = headers["content-length"];

View File

@@ -217,7 +217,7 @@ function createWindow(): BrowserWindow {
// Create the browser window.
win = new BrowserWindow(windowOptions);
initializeIpcHandlers(win);
initializeIpcHandlers(win, USER_AGENT);
initializeAppUpdater(win);
initializeAppUpdateIpcHandlers(win);

View File

@@ -1,7 +1,7 @@
{
"name": "wowup",
"productName": "WowUp",
"version": "2.1.2",
"version": "2.1.3",
"description": "World of Warcraft addon updater",
"homepage": "https://wowup.io",
"author": {

View File

@@ -1,5 +1,9 @@
{
"ChangeLogs": [
{
"Version": "2.1.3",
"changes": ["Handle a change Townlong Yak made"]
},
{
"Version": "2.1.2",
"changes": ["Always backfill install folder list"]