From aced5ba8c8d21b780a0c220a24a01b77949519ef Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 30 Nov 2018 09:05:27 +0100 Subject: [PATCH] MOBILE-2771 desktop: Add MoodleMobile to user agent --- desktop/electron.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop/electron.js b/desktop/electron.js index 51087a40d..d4a7bdbfa 100644 --- a/desktop/electron.js +++ b/desktop/electron.js @@ -5,6 +5,7 @@ const path = require('path'); const url = require('url'); const fs = require('fs'); const os = require('os'); +const userAgent = 'MoodleMobile'; // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. @@ -64,6 +65,9 @@ function createWindow() { mainWindow.on('focus', () => { mainWindow.webContents.send('coreAppFocused'); // Send an event to the main window. }); + + // Append some text to the user agent. + mainWindow.webContents.setUserAgent(mainWindow.webContents.getUserAgent() + ' ' + userAgent); } // This method will be called when Electron has finished initialization and is ready to create browser windows.