Copy share url to clipboard

This commit is contained in:
Gnarwhal 2024-07-31 15:41:13 +00:00
parent cbe3554252
commit ec5692e064
Signed by: Gnarwhal
GPG key ID: 0989A73D8C421174

8
sshare
View file

@ -3,6 +3,7 @@
import getpass import getpass
import importlib.util import importlib.util
import os import os
import pyclip
import time import time
import subprocess import subprocess
import sys import sys
@ -11,12 +12,15 @@ def main():
config = Config() config = Config()
id = time.time_ns() id = time.time_ns()
file_name = f"{id}.png"
pyclip.copy(f"https://{config.ssh_target}/sshare/{file_name}")
subprocess.run([ subprocess.run([
"scp", "scp",
f"-P {config.ssh_port}", f"-P {config.ssh_port}",
f"/home/gnarwhal/Pictures/Screenshots/Screenshot from 2024-07-31 06-34-57.png", f"/home/gnarwhal/Pictures/Screenshots/Screenshot from 2024-07-31 06-34-57.png",
f"{config.ssh_user}@{config.ssh_domain}:{config.ssh_dir}/{id}.png", f"{config.ssh_user}@{config.ssh_target}:{config.ssh_dir}/{file_name}",
]) ])
@ -24,7 +28,7 @@ class Config:
def __init__(self): def __init__(self):
self.ssh_port = 2222 self.ssh_port = 2222
self.ssh_user = getpass.getuser() self.ssh_user = getpass.getuser()
self.ssh_domain = "monodon.me" self.ssh_target = "monodon.me"
self.ssh_dir = "~/sshare/" self.ssh_dir = "~/sshare/"