Skip to content

Commit

Permalink
allow mixed content images + fix for saving last url ubergrape/chatgr…
Browse files Browse the repository at this point in the history
…ape#3742
  • Loading branch information
Yuri Tkachenko committed May 10, 2016
1 parent 55a4f61 commit f5f59ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 12 additions & 2 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// app starts. This script is running through entire life of your application.
// It doesn't have any windows which you can see on screen, but we can open
// window from here.

import {
isNotificationSupported,
isWindows,
Expand Down Expand Up @@ -51,7 +52,16 @@ app.on('ready', function () {
// set global to be accessible from webpage
global.isNotificationSupported = isNotificationSupported()

state.mainWindow = new BrowserWindow(state.dimensions)
const prefs = Object.assign(
{},
state.dimensions,
{
webPreferences: {
allowDisplayingInsecureContent: true
}
}
)
state.mainWindow = new BrowserWindow(prefs)
state.mainWindow.on('close', close)

state.mainWindow.on('hide', function() {
Expand All @@ -72,7 +82,7 @@ app.on('ready', function () {
!error &&
data &&
data.url &&
!isExternalUrl(data.url)
!isExternalUrl(data.url, url)
) url = data.url
state.mainWindow.loadURL(url)
})
Expand Down
5 changes: 3 additions & 2 deletions app/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import minimatch from 'minimatch'

var os = require('os')

export function isWindows() {
Expand Down Expand Up @@ -32,6 +34,5 @@ export function isExternalUrl(url, current) {
const newHost = getHost(url)
const currentHost = getHost(current)
if (!newHost) return true

return newHost !== currentHost
return !minimatch(newHost, `**${currentHost}`)
}

0 comments on commit f5f59ab

Please sign in to comment.