Skip to content

aardvark-community/screenshotr

Repository files navigation

Publish Windows Linux MacOS

Quickstart

Use the appropriate version of run and screenshotr for your OS.

  • e.g. ./run.sh and ./screenshotr.sh for Linux
  • or run.cmd and screenshotr.cmd for Windows
git clone https://github.com/stefanmaierhofer/screenshotr.git
cd screenshotr
run

Open http://localhost:5020/ in a your browser.

screenshotr import -e http://localhost:5020 --addRandomLabels ./directory/with/images

Server

Client

nuget Screenshotr.Client

using Screenshotr;

var filename = "example.jpg";
var endpoint = "http://localhost:5020";

var client = await ScreenshotrHttpClient.Connect(endpoint);

await client.ImportScreenshot(
    buffer: File.ReadAllBytes(filename),
    tags: new[] { "foo", "bar" },
    timestamp: new FileInfo(filename).LastWriteTime
    );

Command Line Tool

Usage

Usage:

  screenshotr <command> <args*> [-e <endpoint> -k <apikey>]
    You can either specify endpoint (-e) and apikey (-k) each
    time you run the screenshotr command, or you can use the
    connect command, which will remember the values for all subsequent
    runs (until you disconnect).

  screenshotr --version
    Print version.

  screenshotr --help
    Print usage message.

  Commands:
    import [-t <tags>] <file|folder>* [-x <exclude>] [--addRandomLabels]
    list [--skip <int>] [--take <int>]
    tags
    tail [-v|--verbose]
    apikeys
      create -d <description> [-r <role>]+ [--days <float>]
             Available roles are: admin, importer
      delete <apikey>
      list
    connect -e <endpoint> -k <apikey>
    disconnect

  Examples:
    screenshotr connect -e "https://localhost" -k "7d10785f41e8..."
    screenshotr disconnect
    screenshotr import -t "mytag some-other-tag" img.jpg /data/pictures/
    screenshotr list --skip 10 --take 5
    screenshotr tags
    screenshotr tail -v
    screenshotr apikeys create -d "alice's import key" -r "importer"
    screenshotr apikeys delete "2442d075d2f3888..."
    screenshotr apikeys list

Config

Data directory

By default, the screenshotr server will store all data in ./data. You can set a custom directory by setting the Screenshotr:Data environment variable, e.g.

set Screenshotr:Data=/my/screenshots/data/dir

User Name (from reverse proxy)

Specify the env variable Screenshotr:HttpHeaderDisplayName=<HTTP-HEADER-NAME> to extract and display the current user's name from an HTTP header.

This can be used, if you run a reverse proxy sending the current user's display name along with the requests.

E.g. if your reverse proxy adds an HTTP header named X-Display-Name, then you would specify

set Screenshotr:HttpHeaderDisplayName=X-Display-Name

Docker

Build

A ready-to-run docker image can be built by running

docker build -t screenshotr .

in the project's root directory.

Run

docker run -p 5020:5020 screenshotr

By default, all data is stored inside the container and will disappear each time the container is restarted. In order to permanently store your data, you have to bind a directory on your host machine to /data inside the container, e.g.

docker run screenshotr -p 5020:5020 -v /my/permanent/storage:/data

Docker Compose

Configuration

Edit docker-compose.yml to configure a permanent data directory on the host machine:

...
volumes:
  - /my/permanent/storage:/data
...

There is also an example traefik configuration in docker-compose.traefik-example.yml.

Run server

docker compose up -d