Refactor image job object, fixed image commands that don't require an existing image
This commit is contained in:
parent
30bcb7a969
commit
39ebae8cd7
5 changed files with 28 additions and 12 deletions
|
@ -31,3 +31,18 @@ A client sends *requests* (T-messages) to a server, which subsequently *replies*
|
|||
- Twait tag[2] jid[4]
|
||||
- Rwait tag[2]
|
||||
- Rinit tag[2] max_jobs[2] formats[j]
|
||||
|
||||
### Job Object
|
||||
The job object is formatted like this:
|
||||
```json
|
||||
{
|
||||
"cmd": string, // name of internal image command, e.g. caption
|
||||
"path": string, // canonical image URL, used for getting the actual image
|
||||
"url": string, // original image URL, used for message filtering
|
||||
"params": { // content varies depending on the command, some common parameters are listed here
|
||||
"type": string, // mime type of output, should usually be the same as input
|
||||
"delay": integer, // for manually specifying GIF frame delay, set to 0 to use the default delay
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
|
@ -241,7 +241,7 @@ const runJob = (job, ws) => {
|
|||
|
||||
const object = JSON.parse(job.msg);
|
||||
// If the image has a path, it must also have a type
|
||||
if (object.path && !object.type) {
|
||||
if (object.path && !object.params.type) {
|
||||
reject(new TypeError("Unknown image type"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue