This commit is contained in:
Thomas Hobson 2021-04-23 14:30:19 +12:00
commit 890d9f024d
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
4 changed files with 51 additions and 36 deletions

View File

@ -64,7 +64,7 @@ const app = express();
if (!errors.isEmpty()) { if (!errors.isEmpty()) {
return res return res
.status(422) .status(400)
.send({ .send({
message: errors.array() message: errors.array()
}); });

View File

@ -1,9 +1,14 @@
<h1 align="center"> <h1 align="center">
<a href="https://github.com/engineer-man/piston"><img src="var/docs/images/icon_circle.svg" width="25" height="25" alt="engineer-man piston"></a> <a href="https://github.com/engineer-man/piston">
<img src="var/docs/images/piston.svg" width="32" height="32" style="vertical-align: middle;" alt="engineer-man piston" />
</a>
<span>
Piston Piston
</span>
</h1> </h1>
<h3 align="center">A high performance general purpose code execution engine.</h3> <h3 align="center">A high performance general purpose code execution engine.</h3>
<br> <br>
<p align="center"> <p align="center">
@ -37,22 +42,29 @@
# About # About
<h4> <h4>
Piston is a high performance general purpose code execution engine. It excels at running untrusted and 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. possibly malicious code without fear from any harmful effects.
</h4> </h4>
<br> <br>
It's used in numerous places including: It's used in numerous places including:
* [EMKC Challenges](https://emkc.org/challenges), * [EMKC Challenges](https://emkc.org/challenges)
* [EMKC Weekly Contests](https://emkc.org/contests), * [EMKC Weekly Contests](https://emkc.org/contests)
* [Engineer Man Discord Server](https://discord.gg/engineerman), * [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 * [I Run Code (Discord Bot)](https://github.com/engineer-man/piston-bot) bot as well as 4000+ other servers
and 100+ direct integrations. and 200+ direct integrations.
To get it in your own server, go here: https://emkc.org/run. To get it in your own server, go here: https://emkc.org/run.
<br> <br>
### 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.
<br>
# Public API # Public API
- Requires no installation and you can use it immediately. - Requires no installation and you can use it immediately.
@ -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` (**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[].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. - `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. - `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. - `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. - `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. - `run_timeout` (*optional*) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number.
```json ```json
{ {
"language": "js", "language": "js",
"version": "15.10.0", "version": "15.10.0",
"files":[ "files": [
{ {
"main": true,
"name": "my_cool_code.js", "name": "my_cool_code.js",
"content": "console.log(process.argv)" "content": "console.log(process.argv)"
} }
@ -240,6 +253,7 @@ Content-Type: application/json
} }
} }
``` ```
If a problem exists with the request, a `400` status code is returned and the reason in the `message` key. If a problem exists with the request, a `400` status code is returned and the reason in the `message` key.
```json ```json
HTTP/1.1 400 Bad Request HTTP/1.1 400 Bad Request

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 512 512"><defs><style>.cls-1{fill:#131424;}.cls-2{fill:url(#linear-gradient);}</style><linearGradient id="linear-gradient" x1="313.84" y1="162.5" x2="158.19" y2="318.15" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#53c7e5"/><stop offset="0.5" stop-color="#1ea4dd"/><stop offset="1" stop-color="#167ec1"/></linearGradient></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_4" data-name="Layer 4"><rect class="cls-1" width="512" height="512"/><path class="cls-2" d="M227.17,255.54V371.65l-44.95-29.47V281.23Zm30.38,47.15,98.23-51.21v-47l-128.19-64.1L182.22,163.2v55.13l45.37-25.54,69.09,35.38-39,17.08Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 734 B