From 04990566a12e9d7ebc0034abcc51ed73e938493a Mon Sep 17 00:00:00 2001 From: Brian Seymour Date: Thu, 22 Apr 2021 21:30:01 -0500 Subject: [PATCH] updated readme --- api/src/index.js | 2 +- readme.md | 84 ++++++++++++--------- var/docs/images/{icon_circle.svg => em.svg} | 0 var/docs/images/piston.svg | 1 + 4 files changed, 51 insertions(+), 36 deletions(-) rename var/docs/images/{icon_circle.svg => em.svg} (100%) create mode 100644 var/docs/images/piston.svg diff --git a/api/src/index.js b/api/src/index.js index ce4a1ae..21579b0 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -64,7 +64,7 @@ const app = express(); if (!errors.isEmpty()) { return res - .status(422) + .status(400) .send({ message: errors.array() }); diff --git a/readme.md b/readme.md index 52dd05b..b2a422c 100644 --- a/readme.md +++ b/readme.md @@ -1,9 +1,14 @@

- engineer-man piston - Piston + + engineer-man piston + + + Piston +

A high performance general purpose code execution engine.

+

@@ -37,22 +42,29 @@ # About

-Piston is a high performance general purpose code execution engine. It excels at running untrusted and -possibly malicious code without fear from any harmful effects. + Piston is a high performance general purpose code execution engine. It excels at running untrusted and + possibly malicious code without fear from any harmful effects.

+
It's used in numerous places including: -* [EMKC Challenges](https://emkc.org/challenges), -* [EMKC Weekly Contests](https://emkc.org/contests), -* [Engineer Man Discord Server](https://discord.gg/engineerman), -* [I Run Code (Discord Bot)](https://github.com/engineer-man/piston-bot) bot as well as 1300+ other servers -and 100+ direct integrations. +* [EMKC Challenges](https://emkc.org/challenges) +* [EMKC Weekly Contests](https://emkc.org/contests) +* [Engineer Man Discord Server](https://discord.gg/engineerman) +* [I Run Code (Discord Bot)](https://github.com/engineer-man/piston-bot) bot as well as 4000+ other servers +and 200+ direct integrations. To get it in your own server, go here: https://emkc.org/run.
+### Official Extensions +The following are approved and endorsed extensions/utilities to the core Piston offering. +- [Piston CLI](https://github.com/Shivansh-007/piston-cli), a universal shell supporting code highlighting, files, and interpretation without the need to download a language. + +
+ # Public API - Requires no installation and you can use it immediately. @@ -171,21 +183,21 @@ HTTP/1.1 200 OK Content-Type: application/json [ - { - "language": "bash", - "version": "5.1.0", - "aliases": [ - "sh" - ] - }, - { - "language": "brainfuck", - "version": "2.7.3", - "aliases": [ - "bf" - ] - }, - ... + { + "language": "bash", + "version": "5.1.0", + "aliases": [ + "sh" + ] + }, + { + "language": "brainfuck", + "version": "2.7.3", + "aliases": [ + "bf" + ] + }, + ... ] ``` @@ -197,17 +209,18 @@ This endpoint requests execution of some arbitrary code. - `files` (**required**) An array of files containing code or other data that should be used for execution. The first file in this array is considered the main file. - `files[].name` (**optinal**) The name of the file to upload, must be a string containing no path. - `files[].content` (**required**) The content of the files to upload, must be a string containing text to write. -- `stdin` (**optional**) The text to pass as stdin to the program. Must be a string, can be left blank. -- `args` (**optional**) The arguments to pass to the program. Must be an array. -- `compile_timeout` (**optional**) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number. -- `run_timeout` (**optional**) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number. +- `stdin` (*optional*) The text to pass as stdin to the program. Must be a string, can be left blank. +- `args` (*optional*) The arguments to pass to the program. Must be an array. +- `compile_timeout` (*optional*) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number. +- `run_timeout` (*optional*) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number. ```json { "language": "js", "version": "15.10.0", - "files":[ + "files": [ { + "main": true, "name": "my_cool_code.js", "content": "console.log(process.argv)" } @@ -232,14 +245,15 @@ HTTP/1.1 200 OK Content-Type: application/json { - "run": { - "stdout": "[\n '/piston/packages/node/15.10.0/bin/node',\n '/piston/jobs/9501b09d-0105-496b-b61a-e5148cf66384/my_cool_code.js',\n '1',\n '2',\n '3'\n]\n", - "stderr": "", - "code": 0, - "signal": null - } + "run": { + "stdout": "[\n '/piston/packages/node/15.10.0/bin/node',\n '/piston/jobs/9501b09d-0105-496b-b61a-e5148cf66384/my_cool_code.js',\n '1',\n '2',\n '3'\n]\n", + "stderr": "", + "code": 0, + "signal": null + } } ``` + If a problem exists with the request, a `400` status code is returned and the reason in the `message` key. ```json HTTP/1.1 400 Bad Request diff --git a/var/docs/images/icon_circle.svg b/var/docs/images/em.svg similarity index 100% rename from var/docs/images/icon_circle.svg rename to var/docs/images/em.svg diff --git a/var/docs/images/piston.svg b/var/docs/images/piston.svg new file mode 100644 index 0000000..cae0941 --- /dev/null +++ b/var/docs/images/piston.svg @@ -0,0 +1 @@ + \ No newline at end of file