mirror of
https://github.com/onionshare/onionshare.git
synced 2025-12-15 08:19:08 -05:00
refactored GUI to use a second flask server for communication
This commit is contained in:
parent
9daa475cc0
commit
67ea5b5c2c
12 changed files with 177 additions and 193 deletions
47
onionshare_gui/static/onionshare.js
Normal file
47
onionshare_gui/static/onionshare.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
$(function(){
|
||||
onionshare = {}
|
||||
|
||||
function update($msg) {
|
||||
var $line = $('<p></p>').append($msg);
|
||||
$('#output').append($line);
|
||||
|
||||
// scroll to bottom
|
||||
$('#output').scrollTop($('#output').height());
|
||||
}
|
||||
|
||||
function linebreak() {
|
||||
update($('<hr>'));
|
||||
}
|
||||
|
||||
function copy_to_clipboard() {
|
||||
$.ajax({
|
||||
url: '/copy_url',
|
||||
success: function(data, textStatus, jqXHR){
|
||||
update('Copied secret URL to clipboard.');
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#copy-button').click(copy_to_clipboard);
|
||||
|
||||
// start onionshare
|
||||
$.ajax({
|
||||
url: '/start_onionshare',
|
||||
success: function(data, textStatus, jqXHR){
|
||||
onionshare = JSON.parse(data);
|
||||
|
||||
$('#basename').html(onionshare.basename);
|
||||
update("Sharing file: "+onionshare.basename+" ("+onionshare.filesize+" bytes)");
|
||||
update("SHA1 checksum: "+onionshare.filehash);
|
||||
linebreak();
|
||||
update(onionshare.strings['give_this_url']);
|
||||
update($('<strong>').html(onionshare.url));
|
||||
linebreak();
|
||||
copy_to_clipboard();
|
||||
$('#copy-button').show();
|
||||
|
||||
$('#loading').hide();
|
||||
$('#content').show();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue