Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 951 Bytes

README.md

File metadata and controls

43 lines (34 loc) · 951 Bytes

Remote Screen Locker

This is a web app for macOS that serves an HTTP API to:

  • check whether the screen is locked
  • lock the screen

Setup

Install Python 3 (I used brew install python) and run the following from the project root:

virtualenv -p /usr/local/bin/python3 venv
. venv/bin/activate
pip install -r requirements.txt

To start the app, run:

REMOTE_SCREEN_LOCKER_TOKEN=secret gunicorn remote_screen_locker.app:app

To run tests:

python -m unittest

API

For authentication, set the REMOTE_SCREEN_LOCKER_TOKEN environment variable to the desired token when running the app. Provide an X-Token header with the token for requests.

To get the screen status:

$ curl -H 'X-Token: secret' localhost:8000/screen
{"locked": false}

To lock the screen:

$ curl -H 'X-Token: secret' -H 'Content-Type: application/json' -X PATCH -d '{"locked": true}' localhost:8000/screen
{"locked": true}