Merge pull request #1639 from dpalou/MOBILE-2771

MOBILE-2771 desktop: Add MoodleMobile to user agent
main
Juan Leyva 2018-12-03 16:09:00 +01:00 committed by GitHub
commit cd2714c10c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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.