Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Feb 24, 2018
1 parent 4929437 commit 209dfa6
Show file tree
Hide file tree
Showing 24 changed files with 708 additions and 417 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ assets
docs
public
test
coverage
coverage
.nyc_output
3 changes: 0 additions & 3 deletions .nsprc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
assets/*.js
coverage
3 changes: 0 additions & 3 deletions app/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ function download(id, keychain) {
if (authHeader) {
keychain.nonce = parseNonce(authHeader);
}
if (xhr.status === 404) {
return reject(new Error('notfound'));
}
if (xhr.status !== 200) {
return reject(new Error(xhr.status));
}
Expand Down
2 changes: 1 addition & 1 deletion app/fileManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default function(state, emitter) {
}
console.error(err);
state.transfer = null;
const location = err.message === 'notfound' ? '/404' : '/error';
const location = err.message === '404' ? '/404' : '/error';
if (location === '/error') {
state.raven.captureException(err);
metrics.stoppedDownload({ size, err });
Expand Down
14 changes: 8 additions & 6 deletions app/fileReceiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class FileReceiver extends Nanobus {
return;
}

async download() {
async download(noSave = false) {
this.state = 'downloading';
this.emit('progress', this.progress);
try {
Expand All @@ -78,11 +78,13 @@ export default class FileReceiver extends Nanobus {
if (this.cancelled) {
throw new Error(0);
}
await saveFile({
plaintext,
name: decodeURIComponent(this.fileInfo.name),
type: this.fileInfo.type
});
if (!noSave) {
await saveFile({
plaintext,
name: decodeURIComponent(this.fileInfo.name),
type: this.fileInfo.type
});
}
this.msg = 'downloadFinish';
this.state = 'complete';
return;
Expand Down
3 changes: 2 additions & 1 deletion app/ownedFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class OwnedFile {
this.ownerToken = obj.ownerToken;
this.dlimit = obj.dlimit || 1;
this.dtotal = obj.dtotal || 0;
this.keychain = new Keychain(obj.secretKey);
this.keychain = new Keychain(obj.secretKey, obj.nonce);
this._hasPassword = !!obj.hasPassword;
}

Expand Down Expand Up @@ -59,6 +59,7 @@ export default class OwnedFile {
if (e.message === '404') {
this.dtotal = this.dlimit;
}
// ignore other errors
}
}

Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ test:
override:
- npm run build
- npm run lint
- npm run test:ci
- npm test
- nsp check
Loading

0 comments on commit 209dfa6

Please sign in to comment.