Upload files to a server via ssh
Find a file
2024-08-01 18:18:50 +00:00
src/sshare Bump version 2024-08-01 18:18:50 +00:00
.gitignore Handle versioning manually (because setuptools_scm is mean and won't work with release tarballs ;-;) 2024-08-01 07:16:54 +00:00
LICENSE Add LICENSE 2024-07-31 18:29:03 +00:00
pyproject.toml Bump version 2024-08-01 18:18:50 +00:00
README.md Added documentation 2024-08-01 06:01:23 +00:00

SSHare

Upload files to a server via ssh

Documentation

Arguments

-h --help

Show the help message and exit

-v --version

Show the program's version number and exit

-l --latest

Upload the most recently modified file in source_directory

-p --paste

Upload the contents of the clipboard as a .txt file

-f FILE --file FILE

Upload a file

-c --copy

Copy the resultant URL to the clipboard

Configuration File

The configuration file is located at $XDG_CONFIG_DIR/sshare/config.toml. If XDG_CONFIG_DIR is not set, then it will read from $HOME/.config/sshare/config.toml instead.

source_directory

The directory from which --latest reads.

  • Optional - Cannot use --latest if it is not set

host

https://example.com:4430/path/to/files/*
^---^   ^---------^ ^--^^------------^
 |       |           |   |
 |       |           |   +- `host.path`     = "/path/to/files"
 |       |           +----- `host.port`     = 4430
 |       +----------------- `host.name`     = "example.com"
 +------------------------- `host.protocol` = "https"

https://example.com/*
        ^---------^
         |         
         |                  `host.path`       Not set
         |                  `host.port`       Not set
         +----------------- `host.name`     = "example.com"
                            `host.protocol`   Not set (Defaults to `https`)

host.protocol

The protocol by which the file is served

  • Optional - Default: https

host.name

The name of the host (e.g. example.com, 1.1.1.1)

  • Not optional

host.port

The port from which the host is serving files

  • Optional - Default: None (which means the default port for the protocol)

host.path

The subpath from which the host is serving files. If set, host.path must start with and NOT end with a / (e.g. /path/to/files not path/to/files/)

  • Optional - If the host is serving from the root

ssh

ssh -p 1234 example@example.com:/srv/static
       ^--^ ^-----^ ^---------^ ^---------^
        |    |       |           |
        |    |       |           +- `ssh.path` = "/srv/static"
        |    |       +-------------              Uses `host.name`
        |    +--------------------- `ssh.user` = "example"
        +-------------------------- `ssh.port` = 1234"

ssh example@example.com:/srv/static
    ^-----^ ^---------^ ^---------^
     |       |           |
     |       |           +- `ssh.path` = "/srv/static"
     |       +-------------              Uses `host.name`
     +--------------------- `ssh.user`   Doesn't need to be set if `example` is
		                                 the name of the user running `sshare`
							`ssh.part`   Not set (Defaults to 22)

ssh.port

The port the server is listening for ssh connections on

  • Optional - Default: 22

ssh.user

The user to connect to the host with

  • Optional - Default: The user that ran sshare

ssh.path

The directory on the host from which static files are being hosted. If set, ssh.path must NOT end with a path (e.g. /srv/static not /srv/static/)

  • Not optional

Example Configuration File

# config.toml

source_directory = "/home/example/Pictures/Screenshots"

# Host is serving static files at https://example.com:443/sshare/*
# Note: both protocol and port would be optional here as https is
# the default protocol and port 443 is the default https port
[host]
protocol = "https"
name = "example.com"
port = 443
path = "/sshare"

# Host is listening for ssh connections on port 1234 and
# serving files from the `/srv/sshare` directory
[ssh]
port = 1234
user = "exampleuser2"
path = "/srv/sshare"

Hmmm

Apparently GNOME 42 screenshot utility is called via dbus

gdbus call
	--session
	--dest org.gnome.Shell
	--object-path /org/gnome/Shell
	--method org.gnome.Shell.Eval 'Main.screenshotUI.open()'

but it cannot be called unless global.context.unsafe_mode = false is set in gnome shell...which is unideal.

The ideal would be to launch a desired screenshot (or other generative) utility before running sshare, and for everything that isn't GNOME 42 screenshot, I would not expect it to be too hard. But unfortunately I want to use GNOME 42 screenshot ;-;

What to do...