Mac API is a simple server allowing you to remotely command certain things on your Mac. This is mostly useful for a desktop computer that is always on.
- Wake your display.
- Sleep your display.
- Set your display's brightness.
- Set your volume.
- Toggle Do Not Disturb mode on or off.
- Set the audio device used for input or output.
- Control netflix playback
script/bootstrap
Get up and running immediately with script/server.
Mac API will run on port 8686 by default. Use the PORT environment
variable to use your own port.
Mac API has support for Forever. It uses
launchd on macOS to kick it off so that it starts on boot.
You can simply run it by calling script/server. This will run it in development
mode with logging to standard out.
script/install
Mac API logs all of its requests. In production, it logs to a file at log/logs.log.
In development mode, it just logs to stdout.
Launch the app via script/server to run it in the development environment.
This is a quick overview of the HTTP service. Read app.js if you need more info. It doesn't do a lot yet.
These are the endpoints you can hit to do things.
POST /sleep_display
POST /wake
POST /brightness/:level - Level: 0-32
POST /volume/:level - Level: 0-100
POST /dnd/:state - State: on or off
POST /audiodevice/:port/:device - Port: input or output, Device: name of device
POST /netflix/:command - Send command to netflix player on Google Chrome or Safari - Command can be playpause, play or pause. Safari also support commands forward and backward.</p>
To use netflix commands in Safari, you must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu.
- fork
- create a feature branch
- open a Pull Request