项目作者: tobyhs

项目描述 :
Web app to lock the screen on macOS
高级语言: Python
项目地址: git://github.com/tobyhs/remote_screen_locker.git
创建时间: 2020-02-02T19:43:46Z
项目社区:https://github.com/tobyhs/remote_screen_locker

开源协议:MIT License

下载


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:

  1. python3 -m venv venv
  2. . venv/bin/activate
  3. pip install -r requirements.txt

To start the app, run:

  1. REMOTE_SCREEN_LOCKER_TOKEN=secret gunicorn remote_screen_locker.app:app

To run tests:

  1. 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:

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

To lock the screen:

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