Skip to content

tobyhs/remote_screen_locker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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}

About

Web app to lock the screen on macOS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published