mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-02 23:27:17 -04:00
Fixed deleting and renaming entries in offline mode
This commit is contained in:
+12
-4
@@ -608,8 +608,12 @@ def rename(): # renames an entry or folder
|
|||||||
f"{_new_name}'\"")
|
f"{_new_name}'\"")
|
||||||
else:
|
else:
|
||||||
move(f"{directory}{_entry_name}.gpg", f"{directory}{_new_name}.gpg")
|
move(f"{directory}{_entry_name}.gpg", f"{directory}{_new_name}.gpg")
|
||||||
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"cd /bin; python -c "
|
if ssh_error != 1:
|
||||||
f"'import sshypRemote; sshypRemote.delete(\"'\"{_entry_name}\"'\")'\"")
|
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"cd /bin; python -c "
|
||||||
|
f"'import sshypRemote; sshypRemote.delete(\"'\"{_entry_name}\"'\", 'remotely')'\"")
|
||||||
|
else:
|
||||||
|
from sshypRemote import delete as offline_delete
|
||||||
|
offline_delete(_entry_name, '')
|
||||||
|
|
||||||
|
|
||||||
def edit(): # edits the contents of an entry
|
def edit(): # edits the contents of an entry
|
||||||
@@ -740,8 +744,12 @@ def remove_data(): # deletes an entry from the server and flags it for local de
|
|||||||
else:
|
else:
|
||||||
_entry_name = entry_name_fetch(1)
|
_entry_name = entry_name_fetch(1)
|
||||||
decrypt(path.expanduser('~/.config/sshyp/lock.gpg'), 0, 0, gpg)
|
decrypt(path.expanduser('~/.config/sshyp/lock.gpg'), 0, 0, gpg)
|
||||||
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"cd /bin; python -c "
|
if ssh_error != 1:
|
||||||
f"'import sshypRemote; sshypRemote.delete(\"'\"{_entry_name}\"'\")'\"")
|
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"cd /bin; python -c "
|
||||||
|
f"'import sshypRemote; sshypRemote.delete(\"'\"{_entry_name}\"'\", 'remotely')'\"")
|
||||||
|
else:
|
||||||
|
from sshypRemote import delete as offline_delete
|
||||||
|
offline_delete(_entry_name, '')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
+2
-2
@@ -9,14 +9,14 @@ from shutil import rmtree
|
|||||||
|
|
||||||
# utility functions
|
# utility functions
|
||||||
|
|
||||||
def delete(_file_path): # deletes an entry or folder, should be run remotely via ssh
|
def delete(_file_path, _target_database): # deletes an entry or folder, should be run remotely via ssh
|
||||||
try:
|
try:
|
||||||
if _file_path.endswith('/'):
|
if _file_path.endswith('/'):
|
||||||
rmtree(f"{expanduser('~/.local/share/sshyp/')}{_file_path}")
|
rmtree(f"{expanduser('~/.local/share/sshyp/')}{_file_path}")
|
||||||
else:
|
else:
|
||||||
remove(f"{expanduser('~/.local/share/sshyp/')}{_file_path}.gpg")
|
remove(f"{expanduser('~/.local/share/sshyp/')}{_file_path}.gpg")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print('location does not exist remotely')
|
print(f"location does not exist {_target_database}")
|
||||||
for _device_name in listdir(expanduser('~/.config/sshyp/devices')):
|
for _device_name in listdir(expanduser('~/.config/sshyp/devices')):
|
||||||
open(f"{expanduser('~/.config/sshyp/deleted/')}{_file_path.replace('/', '@')}^&*{_device_name}", 'w')
|
open(f"{expanduser('~/.config/sshyp/deleted/')}{_file_path.replace('/', '@')}^&*{_device_name}", 'w')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user