mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 16:47:14 -04:00
General cleanup and port-job updates
Former-commit-id: 343ec2505e3ee3858089ee0a4b5175c6029ad23f Former-commit-id: 7cd32bc931d57e39166c62174561b6c7fdacb9cf
This commit is contained in:
+12
-8
@@ -378,6 +378,15 @@ this program comes with absolutely no warranty; type 'sshyp license' for details
|
|||||||
# PORT END HELP-SERVER
|
# PORT END HELP-SERVER
|
||||||
|
|
||||||
|
|
||||||
|
# shortcut to quickly read an entry
|
||||||
|
def read_shortcut():
|
||||||
|
target_type_check(entry_name, True, True)
|
||||||
|
_shm_folder, _shm_entry = shm_gen()
|
||||||
|
determine_decrypt(directory + entry_name, _shm_folder, _shm_entry)
|
||||||
|
entry_reader(f"{tmp_dir}{_shm_folder}/{_shm_entry}")
|
||||||
|
rmtree(f"{tmp_dir}{_shm_folder}")
|
||||||
|
|
||||||
|
|
||||||
# calls sshync to sync changes to the user's server
|
# calls sshync to sync changes to the user's server
|
||||||
def sync():
|
def sync():
|
||||||
print('\nsyncing entries with the server device...\n')
|
print('\nsyncing entries with the server device...\n')
|
||||||
@@ -665,8 +674,8 @@ def copy_data():
|
|||||||
Popen('sleep 30; clipboard -r', shell=True)
|
Popen('sleep 30; clipboard -r', shell=True)
|
||||||
# MacOS clipboard detection
|
# MacOS clipboard detection
|
||||||
elif uname()[0] == 'Darwin':
|
elif uname()[0] == 'Darwin':
|
||||||
run(('pbcopy'), stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\').replace('%', '%%')),
|
run('pbcopy', stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\').replace('%', '%%')), stdout=PIPE)
|
||||||
stdout=PIPE).stdout)
|
.stdout)
|
||||||
Popen("sleep 30; printf '' | pbcopy", shell=True)
|
Popen("sleep 30; printf '' | pbcopy", shell=True)
|
||||||
# Termux (Android) clipboard detection
|
# Termux (Android) clipboard detection
|
||||||
elif isdir("/data/data/com.termux"):
|
elif isdir("/data/data/com.termux"):
|
||||||
@@ -816,13 +825,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
elif arg_count == 1:
|
elif arg_count == 1:
|
||||||
if arg_start == 1:
|
if arg_start == 1:
|
||||||
# read shortcut
|
|
||||||
success_flag = True
|
success_flag = True
|
||||||
target_type_check(entry_name, True, True)
|
read_shortcut()
|
||||||
_shm_folder, _shm_entry = shm_gen()
|
|
||||||
determine_decrypt(directory + entry_name, _shm_folder, _shm_entry)
|
|
||||||
entry_reader(f"{tmp_dir}{_shm_folder}/{_shm_entry}")
|
|
||||||
rmtree(f"{tmp_dir}{_shm_folder}")
|
|
||||||
elif arguments[0] == 'tweak':
|
elif arguments[0] == 'tweak':
|
||||||
success_flag = True
|
success_flag = True
|
||||||
from stweak import menu_repeat
|
from stweak import menu_repeat
|
||||||
|
|||||||
+2
-2
@@ -352,9 +352,9 @@ def initial_setup():
|
|||||||
|
|
||||||
# PORT START CLIPTOOL
|
# PORT START CLIPTOOL
|
||||||
# check for clipboard tool and display warning if missing
|
# check for clipboard tool and display warning if missing
|
||||||
if uname()[0] in ('Linux', 'FreeBSD') and not 'WSL_DISTRO_NAME' in environ \
|
if uname()[0] in ('Linux', 'FreeBSD') and 'WSL_DISTRO_NAME' not in environ \
|
||||||
and not exists("/data/data/com.termux"):
|
and not exists("/data/data/com.termux"):
|
||||||
_display_server = None
|
_display_server, _clipboard_tool, _clipboard_package = None, None, None
|
||||||
if 'WAYLAND_DISPLAY' in environ:
|
if 'WAYLAND_DISPLAY' in environ:
|
||||||
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
|
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
|
||||||
elif 'DISPLAY' in environ:
|
elif 'DISPLAY' in environ:
|
||||||
|
|||||||
@@ -8,26 +8,25 @@ arguments = argv[1:]
|
|||||||
# define replacement text depending on arguments
|
# define replacement text depending on arguments
|
||||||
if len(arguments) > 0:
|
if len(arguments) > 0:
|
||||||
if arguments[0] == 'WSL':
|
if arguments[0] == 'WSL':
|
||||||
replacement = """run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_subject.rstrip()\
|
replacement = """run(('powershell.exe', '-c', "Set-Clipboard '" + _copy_subject.replace("'", "''") + "'"))
|
||||||
.replace("'", "''") + "'"])
|
|
||||||
Popen("sleep 30; powershell.exe -c Set-Clipboard ''", shell=True, stdout=DEVNULL, stderr=DEVNULL)"""
|
Popen("sleep 30; powershell.exe -c Set-Clipboard ''", shell=True, stdout=DEVNULL, stderr=DEVNULL)"""
|
||||||
elif arguments[0] == 'MAC':
|
elif arguments[0] == 'MAC':
|
||||||
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_subject.rstrip()\
|
replacement = """run('pbcopy', stdin=Popen(('printf', _copy_subject.replace('\\\\\\', '\\\\\\\\\\\\\\')
|
||||||
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],stdout=PIPE).stdout)
|
.replace('%', '%%')), stdout=PIPE).stdout)
|
||||||
Popen("sleep 30; printf '' | pbcopy", shell=True)"""
|
Popen("sleep 30; printf '' | pbcopy", shell=True)"""
|
||||||
elif arguments[0] == 'HAIKU':
|
elif arguments[0] == 'HAIKU':
|
||||||
replacement = """run(['clipboard', '-c', _copy_subject.rstrip()])
|
replacement = """run(('clipboard', '-c', _copy_subject))
|
||||||
Popen('sleep 30; clipboard -r', shell=True)"""
|
Popen('sleep 30; clipboard -r', shell=True)"""
|
||||||
elif arguments[0] == 'TERMUX':
|
elif arguments[0] == 'TERMUX':
|
||||||
replacement = """run(['termux-clipboard-set', _copy_subject.rstrip()])
|
replacement = """run(('termux-clipboard-set', _copy_subject))
|
||||||
Popen("sleep 30; termux-clipboard-set ''", shell=True)"""
|
Popen("sleep 30; termux-clipboard-set ''", shell=True)"""
|
||||||
elif arguments[0] == 'LINUX':
|
elif arguments[0] == 'LINUX':
|
||||||
replacement = """if 'WAYLAND_DISPLAY' in environ:
|
replacement = """if 'WAYLAND_DISPLAY' in environ:
|
||||||
run(['wl-copy', _copy_subject.rstrip()])
|
run(('wl-copy', _copy_subject))
|
||||||
Popen('sleep 30; wl-copy -c', shell=True)
|
Popen('sleep 30; wl-copy -c', shell=True)
|
||||||
else:
|
else:
|
||||||
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_subject.rstrip()\
|
run(('xclip', '-sel', 'c'), stdin=Popen(('printf', _copy_subject
|
||||||
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')], stdout=PIPE).stdout)
|
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')), stdout=PIPE).stdout)
|
||||||
Popen("sleep 30; printf '' | xclip -sel c", shell=True)"""
|
Popen("sleep 30; printf '' | xclip -sel c", shell=True)"""
|
||||||
else:
|
else:
|
||||||
s_exit()
|
s_exit()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ string2 = '# PORT END CLIPTOOL'
|
|||||||
if len(arguments) > 0:
|
if len(arguments) > 0:
|
||||||
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
||||||
replacement = """# check for clipboard tool and display warning if missing
|
replacement = """# check for clipboard tool and display warning if missing
|
||||||
_display_server = None
|
_display_server, _clipboard_tool, _clipboard_package = None, None, None
|
||||||
if 'WAYLAND_DISPLAY' in environ:
|
if 'WAYLAND_DISPLAY' in environ:
|
||||||
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
|
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
|
||||||
elif 'DISPLAY' in environ:
|
elif 'DISPLAY' in environ:
|
||||||
|
|||||||
Reference in New Issue
Block a user