AndyRusso / 0x0

0x0.st upload bash script implementing the full 0x0 API and extra QoL.
https://0x0.st
MIT License
4 stars 0 forks source link
0x0 bash script

0x0 upload script

Unofficial 0x0 upload bash script implementing the full 0x0 API and extra QoL.
Quality of life features such as:

Installation

This is a one file bash script, installing can be done in a few ways, examples: (with either example don't forget to make the script executable with chmod +x 0x0)

Config file and token file will be generated by the script and placed according to the XDG Base Directory Specification.
So, unless specified otherwise in environment variables, config will be stored at ~/.config/0x0.sh and tokens file will be stored at ~/.local/share/0x0_tokens.

This script can be integrated with other programs. This repository contains two ready for use examples:

Usage

This is a copy of the help message from the actual script.

Usage:
  0x0 [upload] [OPTION]... FILE
  0x0 delete URL [TOKEN]
  0x0 expire URL TIME [TOKEN]

0x0 upload bash script implementing the full 0x0 API and extra QoL.

Upload a FILE (can be a URL) to https://0x0.st.
Or delete a URL, optionally using TOKEN.
Or set expiry date of a URL to TIME,
optionally using TOKEN.

Delete and expire commands try
to find the URL inside the tokens file,
so you could end up with more than one match,
in which case the script will use the latest token.
If a TOKEN is provided, it will be used instead,
but then URL must be valid.

Config stored at "$config_path".
Tokens file stored at "$tokens_path".

Commands:
  upload (default if omitted)
  delete
  expire sets expiry date

Options for upload:
  -h,   --help      show this help message.
  -e,   --embed     wrap with https://embeds.video to embed videos >50 MB on discord.
  -ne,  --no-embed  do not wrap output with https://embeds.video. (default)
  -s,   --secret    enables secret filename. (0x0.st/s/*/filename)
  -ns,  --no-secret disables secret filename. (default)
  -ex,  --expire    expire relatively in hours or absolutely by UNIX timestamp, 0 for unset.
  -nex, --no-expire do not expire, same as "--expire 0". (default)

Examples:
  0x0 upload video.mp4
  0x0 --no-expire -ne video.mp4 (results in https://0x0.st/HF9Z.mp4)
  0x0 expire HF9Z.mp4 10 (looked up URL and token in the tokens file by string)
  0x0 expire https://0x0.st/HF9Z.mp4 10 MfOaB8Yf7SADSlkR3NJKbNT99Idt9t09gyHfDsOlkrU
  0x0 delete HF9Z (looked up URL and token in the tokens file by string)
  0x0 delete MfOaB8Yf7SADSlkR3NJKbNT99Idt9t09gyHfDsOlkrU (look up by token)