-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1500 from GNS3/release/v2.2.47
Release v2.2.47
- Loading branch information
Showing
11 changed files
with
109 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "gns3-web-ui", | ||
"version": "2.2.46", | ||
"version": "2.2.47", | ||
"author": { | ||
"name": "GNS3 Technology Inc.", | ||
"email": "[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { DeviceDetectorService } from 'ngx-device-detector'; | ||
import { ToasterService } from './toaster.service'; | ||
|
||
@Injectable() | ||
export class ProtocolHandlerService { | ||
|
||
constructor(private toasterService: ToasterService, private deviceService: DeviceDetectorService) {} | ||
|
||
createHiddenIframe(target: Element, uri: string) { | ||
const iframe = document.createElement("iframe"); | ||
iframe.src = uri; | ||
iframe.id = "hiddenIframe"; | ||
iframe.style.display = "none"; | ||
target.appendChild(iframe); | ||
return iframe; | ||
} | ||
|
||
openUriUsingFirefox(uri: string) { | ||
var iframe = (document.querySelector("#hiddenIframe") as HTMLIFrameElement); | ||
|
||
if (!iframe) { | ||
iframe = this.createHiddenIframe(document.body, "about:blank"); | ||
} | ||
|
||
try { | ||
iframe.contentWindow.location.href = uri; | ||
} catch (e) { | ||
if (e.name === "NS_ERROR_UNKNOWN_PROTOCOL") { | ||
this.toasterService.error('Protocol handler does not exist'); | ||
} | ||
} | ||
} | ||
|
||
open(uri: string) { | ||
|
||
const device = this.deviceService.getDeviceInfo(); | ||
|
||
console.log("Launching external protocol handler with " + device.browser + ": " + uri) | ||
if (device.browser === "Firefox") { | ||
// Use a hidden iframe otherwise Firefox will disconnect | ||
// from the GNS3 controller websocket if we use location.assign() | ||
this.openUriUsingFirefox(uri); | ||
} else { | ||
location.assign(uri); | ||
} | ||
} | ||
} |