~bitfehler/xbscli

CLI client for the xBrowserSync API
4 months ago

David Arnold via public-inbox

4 months ago

#xbscli - CLI interface for xBrowserSync

xbscli is a command line client for interacting with the xBrowserSync API.

NOTE: this project is not affiliated with the xBrowserSync project in any way

NOTE: this project is also in a very early stage of development - the interfaces (commands, output) are likely to change.

#Installation

go install git.sr.ht/~bitfehler/xbscli

Or checkout the repo and run go build.

#Usage

#Config file

Create a config file at $XDG_CONFIG_HOME/xbscli/config (usually this resolves to ~/.config/xbscli/config). The config file is in .ini format. Example config:

[xbscli]

# Change this if you are using a different server
api = https://api.xbrowsersync.org

# Your Sync ID
sync-id = ae6d5e350f27449ebfac406607da626e

# Uncomment this to store the password in the config file. But using a command
# (see below) is preferrable
#password = mySecretSyncPassword

# Use a command to get the password
pass-cmd = pass show web/api.xbrowsersync.org

#Commands

For all commands, additional help can be displayed with the -h flag.

Show current bookmarks in JSON format:

xbscli bookmarks show

Show the "last-updated" timestamp of current bookmarks:

xbscli bookmarks show -l

Update the bookmarks stored on the server:

cat bookmarks.json | xbscli bookmarks write -l 2022-03-08T18:38:36.698Z

NOTE: handling of potential synchronization conflicts is currently left to the user, be careful when using multiple clients at the same time.

Show API info:

xbscli info

#Low level commands

There are low level commands for encoding and decoding data in a way that is compatible with the official clients. They could be used as minimal building blocks for scripts if you want to tinker with the API.

Example:

curl -Ss https://api.xbrowsersync.org/bookmarks/ae6d5e350f27449ebfac406607da626e \
  | jq -r .bookmarks | ./xbscli decode

There is also the inverse encode command, but usage is left as an excercise to the reader.

The low-level commands still require a proper config file, as both the Sync ID as well as the password are required for the encryption or decryption process.

#Contact

Until something more appropriate is in place, feel free to send comments, questions, or patches to my public inbox.