mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 16:47:14 -04:00
sshyp server no longer makes copies of libraries in ~/
This commit is contained in:
+3
-2
@@ -27,8 +27,9 @@ def get_titles_mods(_directory, _destination, _user_data):
|
|||||||
open(expanduser('~/.config/sshync/database'), 'a').write(str(_mod) + '\n')
|
open(expanduser('~/.config/sshync/database'), 'a').write(str(_mod) + '\n')
|
||||||
# remote fetching
|
# remote fetching
|
||||||
if _destination == 'r':
|
if _destination == 'r':
|
||||||
system(f"ssh -i '{_user_data[5]}' -p {_user_data[2]} {_user_data[0]}@{_user_data[1]} \"python -c 'import sshync"
|
system(f"ssh -i '{_user_data[5]}' -p {_user_data[2]} {_user_data[0]}@{_user_data[1]} \"cd /usr/bin; python -c "
|
||||||
f"; sshync.get_titles_mods(\"'\"{_user_data[4]}\"'\", \"'\"l\"'\", \"'\"{_user_data}\"'\")'\"")
|
f"'import sshync; sshync.get_titles_mods(\"'\"{_user_data[4]}\"'\", \"'\"l\"'\", "
|
||||||
|
f"\"'\"{_user_data}\"'\")'\"")
|
||||||
system(f"scp -pqs -P {_user_data[2]} -i '{_user_data[5]}' {_user_data[0]}@{_user_data[1]}:"
|
system(f"scp -pqs -P {_user_data[2]} -i '{_user_data[5]}' {_user_data[0]}@{_user_data[1]}:"
|
||||||
f"'/home/{_user_data[0]}/.config/sshync/database' '{expanduser('~/.config/sshync/')}'")
|
f"'/home/{_user_data[0]}/.config/sshync/database' '{expanduser('~/.config/sshync/')}'")
|
||||||
_titles, _sep, _mods = '*&^'.join(open(expanduser('~/.config/sshync/database')).readlines()).replace('\n', '')\
|
_titles, _sep, _mods = '*&^'.join(open(expanduser('~/.config/sshync/database')).readlines()).replace('\n', '')\
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
from os import environ, listdir, path, remove, system, uname, walk
|
from os import environ, listdir, path, remove, system, uname, walk
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import random
|
import random
|
||||||
from shutil import copy, get_terminal_size, move, rmtree
|
from shutil import get_terminal_size, move, rmtree
|
||||||
import sshync
|
import sshync
|
||||||
import string
|
import string
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
@@ -157,8 +157,6 @@ def tweak(): # runs configuration wizard
|
|||||||
if _device_type.lower() == 's':
|
if _device_type.lower() == 's':
|
||||||
open(path.expanduser('~/.config/sshyp/sshyp-device'), 'w').write(_device_type)
|
open(path.expanduser('~/.config/sshyp/sshyp-device'), 'w').write(_device_type)
|
||||||
Path(path.expanduser('~/.config/sshyp/deleted')).mkdir(0o700, parents=True, exist_ok=True)
|
Path(path.expanduser('~/.config/sshyp/deleted')).mkdir(0o700, parents=True, exist_ok=True)
|
||||||
copy('/usr/bin/sshync.py', path.expanduser('~/'))
|
|
||||||
copy('/usr/bin/sshypRemote.py', path.expanduser('~/sshypRemote.py'))
|
|
||||||
print('\nMake sure the ssh service is running and properly configured.\n\nConfiguration complete!\n')
|
print('\nMake sure the ssh service is running and properly configured.\n\nConfiguration complete!\n')
|
||||||
s_exit(0)
|
s_exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -319,8 +317,8 @@ def read_shortcut(): # shortcut to quickly read an entry
|
|||||||
def sync(): # calls sshync to sync changes to the user's server
|
def sync(): # calls sshync to sync changes to the user's server
|
||||||
print('\nSyncing entries with the server device...\n')
|
print('\nSyncing entries with the server device...\n')
|
||||||
# check for deletions
|
# check for deletions
|
||||||
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"python -c 'import sshypRemote"
|
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"cd /usr/bin; python -c "
|
||||||
f"; sshypRemote.deletion_check(\"'\"{client_device_name}\"'\")'\"")
|
f"'import sshypRemote; sshypRemote.deletion_check(\"'\"{client_device_name}\"'\")'\"")
|
||||||
system(f"sftp -p -q -i '{path.expanduser('~/.ssh/sshyp')}' -P {port} {username_ssh}@{ip}:"
|
system(f"sftp -p -q -i '{path.expanduser('~/.ssh/sshyp')}' -P {port} {username_ssh}@{ip}:"
|
||||||
f"'/home/{username_ssh}/.config/sshyp/deletion_database' {path.expanduser('~/.config/sshyp/')}")
|
f"'/home/{username_ssh}/.config/sshyp/deletion_database' {path.expanduser('~/.config/sshyp/')}")
|
||||||
try:
|
try:
|
||||||
@@ -347,8 +345,8 @@ def sync(): # calls sshync to sync changes to the user's server
|
|||||||
if silent_sync != 1:
|
if silent_sync != 1:
|
||||||
print('File does not exist locally.')
|
print('File does not exist locally.')
|
||||||
# check for new folders
|
# check for new folders
|
||||||
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"python -c 'import sshypRemote"
|
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"cd /usr/bin; python -c "
|
||||||
f"; sshypRemote.folder_check()'\"")
|
f"'import sshypRemote; sshypRemote.folder_check()'\"")
|
||||||
system(f"sftp -p -q -i '{path.expanduser('~/.ssh/sshyp')}' -P {port} {username_ssh}@{ip}:"
|
system(f"sftp -p -q -i '{path.expanduser('~/.ssh/sshyp')}' -P {port} {username_ssh}@{ip}:"
|
||||||
f"'/home/{username_ssh}/.config/sshyp/folder_database' {path.expanduser('~/.config/sshyp/')}")
|
f"'/home/{username_ssh}/.config/sshyp/folder_database' {path.expanduser('~/.config/sshyp/')}")
|
||||||
try:
|
try:
|
||||||
@@ -434,8 +432,8 @@ 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} \"python -c 'import sshypRemote; "
|
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"cd /usr/bin; python -c "
|
||||||
f"sshypRemote.delete(\"'\"{_entry_name}\"'\")'\"")
|
f"'import sshypRemote; sshypRemote.delete(\"'\"{_entry_name}\"'\")'\"")
|
||||||
|
|
||||||
|
|
||||||
def edit(): # edits the contents of an entry
|
def edit(): # edits the contents of an entry
|
||||||
@@ -604,8 +602,8 @@ def remove_data(): # deletes an entry from the server and flags it for local de
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print('\nAccess denied.\n')
|
print('\nAccess denied.\n')
|
||||||
s_exit(1)
|
s_exit(1)
|
||||||
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"python -c 'import sshypRemote"
|
system(f"ssh -i '{path.expanduser('~/.ssh/sshyp')}' -p {port} {username_ssh}@{ip} \"cd /usr/bin; python -c "
|
||||||
f"; sshypRemote.delete(\"'\"{_entry_name}\"'\")'\"")
|
f"'import sshypRemote; sshypRemote.delete(\"'\"{_entry_name}\"'\")'\"")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user