Skip to content

Commit

Permalink
feat(generic): implement of rclone basical auth
Browse files Browse the repository at this point in the history
  • Loading branch information
ElonH committed May 13, 2020
1 parent 46fdc7e commit cf914c9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/app/@dataflow/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,19 @@ export abstract class Generic {
);
}
}

export abstract class RcloneAuth extends Generic {
protected request(x: DataFlowNode): AjaxRequest {
let headers = {
'Content-Type': 'application/json',
};
if (x[0]['user'] && x[0]['user'] !== '' && x[0]['password'] && x[0]['password'] !== '')
headers['Authorization'] = 'Basic ' + btoa(`${x[0]['user']}:${x[0]['password']}`);
return {
url: x[0]['url'] + '/' + this.cmd,
method: 'POST',
headers: headers,
body: this.params,
};
}
}

0 comments on commit cf914c9

Please sign in to comment.