Conversation
…ature' of github.com:ethersphere/swarm-cli into feat/implement-opt-out-action-for-the-upload-history-feature
…ature' of github.com:ethersphere/swarm-cli into feat/implement-opt-out-action-for-the-upload-history-feature
| if (existsSync(this.commandConfig.getHistoryFilePath())) { | ||
| size = statSync(this.commandConfig.getHistoryFilePath()).size | ||
| } | ||
| this.console.log(`History file size: ${size} bytes`) |
There was a problem hiding this comment.
My bad with the specs - this should display the number of items/records/entries in the upload history, not size in bytes 🙂
| if (existsSync(this.getHistoryFilePath())) { | ||
| unlinkSync(this.getHistoryFilePath()) | ||
| } |
There was a problem hiding this comment.
This shouldn't always delete the history.
As per of the original issue:
command that disables the feature and asks the end user whether they want to delete their existing history
Use case 1 -- I plan to upload some test files, and for that I pause the upload tracking with this command. The command asks me if I want to delete my history, I type n as I don't want to lose my history. I re-enable the tracking after I am done with the test files.
Use case 2 -- I upload confidential data to Swarm and I only realize halfway through the operation that my upload history is enabled and recording these actions. I run history disable and type y to erase my history as I don't want to store data on my computer that links my actions.
Cafe137
left a comment
There was a problem hiding this comment.
Code LGTM, only 2 comments left regarding the behavior of the commands.
…ature' of github.com:ethersphere/swarm-cli into feat/implement-opt-out-action-for-the-upload-history-feature
…ature' of github.com:ethersphere/swarm-cli into feat/implement-opt-out-action-for-the-upload-history-feature
| return | ||
| } | ||
| this.commandConfig.setHistoryEnabled(true) | ||
| writeFileSync(this.commandConfig.getHistoryFilePath(), JSON.stringify([])) |
There was a problem hiding this comment.
Looks like it can overwrite an existing history with an empty history when resuming after a pause
Cafe137
left a comment
There was a problem hiding this comment.
Please check the aforementioned overwrite problem, otherwise LGTM
|
Add new commands to
historygroup to be able to opt-out of history tracking.enable,disableandstatusgot added. A new config file field (historyEnabled) is stored which indicates, whether we should save history items or not.