mirror of
https://github.com/WowUp/WowUp.git
synced 2026-04-23 07:17:00 -04:00
Send User Agent when downloading files.
This commit is contained in:
@@ -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"];
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user