5 releases (3 breaking)
0.4.0 | Sep 16, 2021 |
---|---|
0.3.0 | Jun 23, 2021 |
0.2.1 | Jun 21, 2021 |
0.2.0 | Jun 14, 2021 |
0.1.0 | Jun 9, 2021 |
#9 in #sam
36KB
694 lines
🐶 Sampicore
Take a screenshot, get a shareable URL
Installation
It should be cross-compatible, but I haven't tested it. I've only installed it on PopOS (Ubuntu/Debian based), and I needed these deps:
sudo apt update && sudo apt install libxcb-randr0-dev build-essential libssl-dev libssl-dev pkg-config libxcb1-dev libxcb-shm0-dev
Currently it's only published in the releases page and cargo:
cargo install sampicore # will download and build sampic
Configuration
It consists on a single sampic.toml
file with the following contents:
api_key = 'S3_API_KEY'
api_secret_key = 'S3_SECRET_API_KEY'
region = 'S3_REGION_'
endpoint = 'S3_ENDPOINT'
bucket = 'sampic-store'
local_path = '/tmp'
sampic_endpoint = 'https://api.sampic.xyz/upload'
Configuration will be saved locally depending on your OS in the following directories:
(According to the directories rust package)
- the XDG base directory and the XDG user directory specifications on Linux,
- the Known Folder system on Windows, and
- the Standard Directories on macOS.
Usage
sampic 0.1.0
Takes pictures and generates links
USAGE:
sampic <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
config Manage sampic configuration.
help Prints this message or the help of the given subcommand(s)
local Takes a screenshot, saves it locally and returns it's path.
s3 Takes a screenshot, saves it in s3 and returns it's link.
server Runs a sampic server.
upload Takes a screenshot, sends it to sampic and returns it's link.
upload
The easiest way to use sampic. It takes a screenshot, sends it to my own sampic server, and copies it's URL to your clipboard.
$ sampic upload -h
sampic-upload
Takes a screenshot, sends it to sampic and returns it's link.
USAGE:
sampic upload
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
local
Similar to upload, but instead saves the screenshot to a local path and copies that to your clipboard.
$ sampic local -h
sampic-local
Takes a screenshot, saves it locally and returns it's path.
USAGE:
sampic local
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
s3
If you have an s3-compatible bucket available, you can use this subcommand to send your screenshots there. You'll have to configure it in the sampic.toml file.
$ sampic s3 -h
sampic-s3
Takes a screenshot, saves it in s3 and returns it's link.
USAGE:
sampic s3
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
config (may leave a mess in your config file)
CLI interface to change configurations. Generally works ok, but it sometimes messes with my sampic.toml.
$ sampic config -h
sampic-config
Manage sampic configuration.
USAGE:
sampic config <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
list List current sampic configuration values.
set Set sampic configuration.
Server Systemd service
[Unit]
Description=Sampic server
After=network.target
[Service]
Type=simple
ExecStart=/path/sampic server
Restart=always
# Other restart options: always, on-abort, etc
[Install]
WantedBy=default.target
Future
There are some things I'd like to do in order to make sampic feature complete for my use-case:
- Make sure it's secure.
- Rate limit everything with the option to register and maybe even pay to relax rate limits.
- Separate code with feature flags.
- Tests.
- A logo.
- A homepage.
- Check cross-compatibility
I'd love to do them all, but I'm currently working full-time, so I just work sporadically on sampic when I can during my free time.
Dependencies
~26–59MB
~1M SLoC