[Pkg-privacy-commits] [torbrowser-launcher] 26/476: started making file downloads actually save file to disk
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:21:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository torbrowser-launcher.
commit d2795533e8843f0c7bb31406e620062b9d01a26f
Author: Micah Lee <micahflee at riseup.net>
Date: Wed Feb 13 11:22:04 2013 -0800
started making file downloads actually save file to disk
---
src/torbrowser-launcher | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/torbrowser-launcher b/src/torbrowser-launcher
index 43c7e52..7f6623b 100755
--- a/src/torbrowser-launcher
+++ b/src/torbrowser-launcher
@@ -69,7 +69,7 @@ const TorBrowserLauncher = new Lang.Class({
this._file_exists(this._paths.file.tarball_sig)) {
// verify it's signature
- this._verify_sig(null, null, function(err){
+ this._verify(function(err){
if(err) {
// signature verification failed
this._set_gui('error',
@@ -167,6 +167,8 @@ const TorBrowserLauncher = new Lang.Class({
url: {
tarball: 'https://www.torproject.org/dist/torbrowser/linux/'+tarball_filename,
tarball_sig: 'https://www.torproject.org/dist/torbrowser/linux/'+tarball_filename+'.asc'
+ //tarball: 'http://localhost/'+tarball_filename,
+ //tarball_sig: 'http://localhost/'+tarball_filename+'.asc'
},
filename: {
tarball: tarball_filename,
@@ -249,7 +251,8 @@ const TorBrowserLauncher = new Lang.Class({
switch(this._gui_tasks[i]){
case 'download_tarball':
task_functions.push(function(done){
- that._download_file('Tor Browser Bundle .tar.gz', that._paths.url.tarball, that._paths.file.tarball, function(err){
+ print('Downloading '+that._paths.filename.tarball);
+ that._download_file(that._paths.filename.tarball, that._paths.url.tarball, that._paths.file.tarball, function(err){
if(err) {
done(err);
return;
@@ -260,7 +263,8 @@ const TorBrowserLauncher = new Lang.Class({
break;
case 'download_tarball_sig':
task_functions.push(function(done){
- that._download_file('Tor Browser Bundle .asc', that._paths.url.tarball_sig, that._paths.file.tarball_sig, function(err){
+ print('Downloading '+that._paths.filename.tarball_sig);
+ that._download_file(that._paths.filename.tarball_sig, that._paths.url.tarball_sig, that._paths.file.tarball_sig, function(err){
if(err) {
done(err);
return;
@@ -271,6 +275,7 @@ const TorBrowserLauncher = new Lang.Class({
break;
case 'verify':
task_functions.push(function(done){
+ print('Verifying signature');
that._verify(function(){
done();
});
@@ -279,6 +284,7 @@ const TorBrowserLauncher = new Lang.Class({
case 'extract':
task_functions.push(function(done){
+ print('Extracting tarball');
that._extract(function(){
done();
});
@@ -286,7 +292,9 @@ const TorBrowserLauncher = new Lang.Class({
break;
case 'run':
task_functions.push(function(done){
+ print('Executing');
if(!that._exec([that._paths.file.start])) {
+ print('Failed to execute '+that._paths.file.start);
that._statusbar.label = 'Failed to execute '+that._paths.file.start;
that._button_start.set_sensitive(true);
};
@@ -302,6 +310,7 @@ const TorBrowserLauncher = new Lang.Class({
function series(done){
if(i == task_functions.length) {
done();
+ return;
}
task_functions[i](function(err){
@@ -375,6 +384,10 @@ const TorBrowserLauncher = new Lang.Class({
let total_size;
let bytes_so_far = 0;
+ // open the file
+ let file = Gio.file_new_for_path(path);
+ let fstream = file.replace(null, false, Gio.FileCreateFlags.NONE, null);
+
// create an http message
let request = Soup.Message.new('GET', url);
@@ -385,7 +398,10 @@ const TorBrowserLauncher = new Lang.Class({
// update progress bar with each chunk
request.connect('got_chunk', Lang.bind(this, function(message, chunk){
- // todo: write chunk to file
+ print(chunk[0]);
+ print('== start ==');
+ fstream.write(chunk, chunk.length, null);
+ print('== finish ==');
bytes_so_far += chunk.length;
@@ -398,6 +414,9 @@ const TorBrowserLauncher = new Lang.Class({
}));
this._httpSession.queue_message(request, function(_httpSession, message) {
+ // close the file
+ fstream.close(null);
+
if(message.status_code !== 200) {
that._statusbar.set_label('Downloading '+name+' failed: '+message.status_code);
callback(true);
@@ -420,7 +439,6 @@ const TorBrowserLauncher = new Lang.Class({
// callback is function(err)
_extract: function(callback){
let [res, out] = this._exec(['tar', '-xf', this._paths.file.tarball, '-C', this._paths.dir.tbb]);
- print(out);
callback();
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git
More information about the Pkg-privacy-commits
mailing list