mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-17 10:17:32 -05:00
Merge branch 'master' of https://github.com/micahflee/onionshare
This commit is contained in:
commit
c2a898887e
@ -3,7 +3,7 @@ $(function(){
|
|||||||
|
|
||||||
function update($msg) {
|
function update($msg) {
|
||||||
var $line = $('<li>').append($msg);
|
var $line = $('<li>').append($msg);
|
||||||
$('#log').append($line);
|
$('#log').prepend($line);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_to_clipboard() {
|
function copy_to_clipboard() {
|
||||||
|
@ -65,6 +65,20 @@ def start_onionshare():
|
|||||||
|
|
||||||
@app.route("/copy_url")
|
@app.route("/copy_url")
|
||||||
def copy_url():
|
def copy_url():
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
# Qt's QClipboard isn't working in Windows
|
||||||
|
# https://github.com/micahflee/onionshare/issues/46
|
||||||
|
import ctypes
|
||||||
|
GMEM_DDESHARE = 0x2000
|
||||||
|
ctypes.windll.user32.OpenClipboard(None)
|
||||||
|
ctypes.windll.user32.EmptyClipboard()
|
||||||
|
hcd = ctypes.windll.kernel32.GlobalAlloc(GMEM_DDESHARE, len(bytes(url))+1)
|
||||||
|
pch_data = ctypes.windll.kernel32.GlobalLock(hcd)
|
||||||
|
ctypes.cdll.msvcrt.strcpy(ctypes.c_char_p(pch_data), bytes(url))
|
||||||
|
ctypes.windll.kernel32.GlobalUnlock(hcd)
|
||||||
|
ctypes.windll.user32.SetClipboardData(1, hcd)
|
||||||
|
ctypes.windll.user32.CloseClipboard()
|
||||||
|
else:
|
||||||
global clipboard
|
global clipboard
|
||||||
clipboard.setText(url)
|
clipboard.setText(url)
|
||||||
return ''
|
return ''
|
||||||
|
Loading…
Reference in New Issue
Block a user