-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #1190
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/python3 | ||
|
||
import json | ||
import os | ||
import random | ||
import re | ||
import subprocess | ||
|
||
password = random.getrandbits(64) | ||
|
||
# Start firenvim script, send password, get port | ||
firenvim = subprocess.Popen(["/home/me/.local/share/firenvim/firenvim"], stdout = subprocess.PIPE, stdin = subprocess.PIPE, stderr = subprocess.PIPE) | ||
request = 'abcde{"newInstance":true,"password":"' + str(password) + '"}' | ||
firenvim.stdin.write(bytes(request, 'utf-8')) | ||
outs, errs = firenvim.communicate() | ||
result = json.loads(outs[4:]) | ||
|
||
# Write port and password to HTML file | ||
with open("/home/me/.local/share/qutebrowser/userscripts/firenvim.js", "r") as f: | ||
html = f.read() | ||
with open("/home/me/.local/share/qutebrowser/userscripts/firenvim.js", "w") as f: | ||
f.write(re.sub(r"^const port = .*; const password= .*;$", | ||
"const port = " + str(result["port"]) + "; const password = " + str(password) + ";", | ||
html)) | ||
|
||
|
||
with open(os.environ["QUTE_FIFO"], "w") as f: | ||
f.write("jseval --file /home/me/.local/share/qutebrowser/userscripts/firenvim.js") |
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,39 @@ | ||
const port = 12345; const password = 12345; | ||
const content = new Blob([` | ||
<html oncontextmenu="return false;"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<style> | ||
html, body { | ||
width: 100%; | ||
height: 100%; | ||
margin: 0px; | ||
padding: 0px; | ||
overflow: hidden; | ||
} | ||
#keyhandler { | ||
height: 1px; | ||
opacity: 0.01; | ||
overflow: hidden; | ||
outline: none; | ||
border: none; | ||
position: absolute; | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
#canvas { | ||
position: absolute; | ||
top: 0px; | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
</style> | ||
<style id="mouse_cursor"></style> | ||
<script>alert("hello")</script> | ||
</head> | ||
<body oncontextmenu="return false;"><textarea id="keyhandler"></textarea><canvas id="canvas" oncontextmenu="return false;"></canvas></body> | ||
</html> | ||
`], {type: "text/html; charset=utf-8"}); | ||
const iframe = document.createElement("iframe"); | ||
iframe.src = URL.createObjectURL(content); | ||
document.body.appendChild(iframe); |