Skip to content

Commit

Permalink
Release 1.1.18 (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasmus Krämer authored Dec 13, 2020
2 parents 7de1cf2 + 9031607 commit fccd696
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const options = {
webPreferences: {
// eslint-disable-line
preload: path.join(__dirname, "preload.js"),
webSecurity: false,
},

width: 1000,
Expand Down Expand Up @@ -48,7 +49,7 @@ const navigate = (event, url) => {
const createWindow = () => {
win = new BrowserWindow(options)
win.setMenu(null)
win.loadURL(startUrl)
win.loadURL(startUrl, { userAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" })

// Make sidebar draggable (on MacOS)
win.webContents.on("did-finish-load", () => {
Expand Down
12 changes: 9 additions & 3 deletions src/preload.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { getDisplayMedia } = require("./util/screenPicker")

document.addEventListener('websocketMessage|type:fcm-message', (event) => {
if(Notification.permission == "granted") {
const { notification, data } = event.message.payload
Expand All @@ -14,9 +16,13 @@ document.addEventListener('websocketMessage|type:fcm-message', (event) => {
})

/* eslint-disable no-console */
window.addEventListener("load", () => window ? window.desktop = { call: true } : console.error("window is missing"))
/* eslint-disable no-undef */
window.navigator.mediaDevices.getDisplayMedia = getDisplayMedia
window.addEventListener("load", () => {
window.desktop = { call: true }
window.navigator.mediaDevices.getDisplayMedia = getDisplayMedia

// The dom-observer didn't work
setInterval(() => document.querySelectorAll("iframe").forEach(iframe => iframe.contentWindow.navigator.mediaDevices.getDisplayMedia = getDisplayMedia), 500)
})

/* eslint-disable no-console */
console.log("Registered preload script")

0 comments on commit fccd696

Please sign in to comment.