Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load devtools within iframe #171

Merged
merged 1 commit into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion dashboard/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ export const plugins = [
dest: '../public/dashboard',
}, {
src: 'src/core/plugins/inspect_traffic.json',
dest: '../public/dashboard'
dest: '../public/dashboard/devtools'
}, {
src: 'src/core/plugins/inspect_traffic.js',
dest: '../public/dashboard/devtools'
}, {
src: 'src/core/plugins/inspect_traffic.html',
dest: '../public/dashboard/devtools'
}],
}),
/* obfuscatorPlugin({
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/core/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ncp = require('ncp').ncp
ncp.limit = 16

function setUpDevTools () {
const destinationFolderPath = path.join(path.dirname(path.dirname(__dirname)), 'public', 'dashboard')
const destinationFolderPath = path.join(path.dirname(path.dirname(__dirname)), 'public', 'dashboard', 'devtools')

const destinationFolderExists = fs.existsSync(destinationFolderPath)
if (!destinationFolderExists) {
Expand Down
18 changes: 18 additions & 0 deletions dashboard/src/core/plugins/inspect_traffic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Programmable, TLS interception capable
proxy server for Application debugging, testing and development.

:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script type="module" src="root.js"></script>
<script defer src="inspect_traffic.js"></script>
</head>
<body class="undocked" id="-blink-dev-tools"></body>
</html>
10 changes: 10 additions & 0 deletions dashboard/src/core/plugins/inspect_traffic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Programmable, TLS interception capable
proxy server for Application debugging, testing and development.

:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
*/
Root.Runtime.startApplication('inspect_traffic');
19 changes: 10 additions & 9 deletions dashboard/src/core/plugins/inspect_traffic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ export class InspectTrafficPlugin extends DashboardPlugin {
}

public initializeBody (): JQuery<HTMLElement> {
return $('<div></div>')
.attr('id', '-blink-dev-tools')
.addClass('undocked')
.add(
$('<script></script>')
.attr('type', 'module')
.attr('src', 'root.js')
)
return $('')
}

public activated (): void {
this.websocketApi.enableInspection(this.handleEvents.bind(this))
Root.Runtime.startApplication('inspect_traffic')
}

public deactivated (): void {
Expand All @@ -46,4 +38,13 @@ export class InspectTrafficPlugin extends DashboardPlugin {
public handleEvents (message: Record<string, any>): void {
console.log(message)
}

private getDevtoolsIFrame (): JQuery<HTMLElement> {
return $('<iframe></iframe>')
.attr('height', '80%')
.attr('width', '100%')
.attr('frameBorder', '0')
.attr('scrolling', 'no')
.attr('src', 'devtools/inspect_traffic.html')
}
}
17 changes: 9 additions & 8 deletions dashboard/src/proxy.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,27 @@
background-color: #eeeeee;
height: 100%;
}

#proxyDashboard .remove-api-spec {
top: 10px;
right: 15px;
}

.api-path-spec .list-group-item {
padding-left: 50px;
}

.app-header {
padding-top: 10px;
padding-bottom: 5px;
}

.app-body .list-group {
margin-left: 15px;
margin-right: 15px;
margin-bottom: 10px;
.app-body {
padding-left: 15px;
padding-right: 15px;
padding-bottom: 50px;
}

.proxy-data {
display: none;
}

.api-path-spec .list-group-item {
padding-left: 50px;
}