New MEGA.nz backend based on official "MEGAcmd" tools (patch attached)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Duplicity |
Fix Released
|
Low
|
Unassigned |
Bug Description
Hi, first of all, a big thank you to all the developers behind this software, as it is for me the best balance between features and simplicity for taking and managing regular backups (in my case, for a few PCs acting as personal computer, home automation server, and even a RPi).
The existing MEGA backend in "duplicity" still relies on (old) "megatools" package, and I found out the hard way for accounts created since November 2018, due to authentication changes, "megatools" no longer work for any such users. See :
https:/
So without any prior Python experience, bit the bullet and created a new backend for MEGA.nz based around the current official tools "MEGAcmd" :
https:/
NOTE : the new backend works for all MEGA accounts. The difference is the existing backend only works for accounts created up to approximately November 2018.
Of course, I did so by just mimicking the code in the existing MEGA backend, and adapting it to the new commands (ie "mega-ls" instead of "megals"), but also changed the way the backend works, as with the new tools commands no longer rely on a config file with the credentials, and instead, expect a session to be established to MEGA first, and then using some persistent per-user resident daemon (mega-cmd-server) to dispatch commands to MEGA from the CLI commands (which are basically shell wrappers around a single "mega-exec" binary.
Although the new tools don't rely on a config file for authentication, to me it looked handy to keep the way credentials were kept on a per-user basis in a config file, and hence I made the new backend search for the username (email) and password in a $HOME/.megav2rc file, which follows the usual "megatools" .megarc syntax, of course, as long as you don't want your password to be shown on the "duplicity" target directory specification.
I have tested the attached code in a few (although not very diverse) installs running Python 2.7 and 3.7+, and they work (in Python 2.7 I had to remove the reference I used to "subprocess.
Note due to my lack of prior coding experience and command of version control software, I just send an attachment with the new "megav2backend.py" backend implementation, a README with a couple notes, the extended manpage (duplicity.1), and a couple other manually modified files where references to the backend seem to be made in the code (but for the backend to work, I just needed to drop the new "megav2backend.py" under /usr/lib/
If you feel this is a valuable addition to "duplicity" and if you'd like more details about the code (I highly doubt it :) )are necessary, just reply to this Bug report. I will do as possible to satisfy the request so the new backend can be added to mainline for others to benefit.
Thank you.
Changed in duplicity: | |
status: | New → In Progress |
assignee: | nobody → Kenneth Loafman (kenneth-loafman) |
importance: | Undecided → Medium |
milestone: | none → 0.8.14 |
Changed in duplicity: | |
status: | In Progress → Fix Committed |
assignee: | Kenneth Loafman (kenneth-loafman) → nobody |
milestone: | none → 0.8.14 |
Changed in duplicity: | |
status: | Fix Committed → Fix Released |
Were the changes based on the 0.7 series or the 0.8 series?
0.7 is EOL due to Python 2 going EOL. 0.8 is the current development series.