Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/statico/ifhttp
👾 HTTP REST server for Z-Machine interactive fiction
https://github.com/statico/ifhttp
docker http http-server if inform inform7 interactive-fiction rest z-machine z8
Last synced: 2 months ago
JSON representation
👾 HTTP REST server for Z-Machine interactive fiction
- Host: GitHub
- URL: https://github.com/statico/ifhttp
- Owner: statico
- License: mit
- Created: 2016-11-12T04:13:38.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2023-02-08T06:58:29.000Z (almost 2 years ago)
- Last Synced: 2024-05-02T06:01:48.209Z (9 months ago)
- Topics: docker, http, http-server, if, inform, inform7, interactive-fiction, rest, z-machine, z8
- Language: JavaScript
- Homepage: https://langworth.com/
- Size: 133 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ifhttp
[![license](https://img.shields.io/github/license/statico/ifhttp.svg?style=flat-square)](https://github.com/statico/ifhttp/blob/master/LICENSE)
[![build status](https://img.shields.io/github/actions/workflow/status/statico/ifhttp/build.yml?branch=main&style=flat-square)](https://ghcr.io/statico/ifhttp)**ifhttp** provides an HTTP REST interface for interacting with Z-Machine interactive fiction (IF) stories (typically `.z8` files). Clients can connect to the service to start a game and then POST commands to it. Sessions are deleted after a while in a feeble attempt to save memory. This service is definitely DoS-able.
**See a live example on https://www.langworth.com/**
## Usage
$ docker pull ghcr.io/statico/ifhttp
$ docker run -p 8080:8080 -v /path/to/stories:/data ghcr.io/statico/ifhttp npm run -s start -- /data/story.z8## API
All request and response bodies should be JSON. In addition to a status code, requests may return a JSON object with an `error` property which describes the error.
### GET /new
Returns a session ID for a new game.
Response:
```json
{
"session": "",
"output": ""
}
```### POST /send
Sends a command to the game.
Request:
```json
{
"session": "",
"message": ""
}
```Response:
```json
{
"output": ""
}
```## Reference
- [Inform](http://inform7.com/) - IF creation toolsuite
- [ifvms](https://github.com/curiousdannii/ifvms.js) - JavaScript Z-Machine VM used by this script
- [ifplayer](https://github.com/jedi4ever/ifplayer.js) - Command-line client which uses ifvms