{"id":24496919,"url":"https://github.com/canta-slaus/rusty-place","last_synced_at":"2025-07-30T06:10:29.947Z","repository":{"id":54136215,"uuid":"522034166","full_name":"canta-slaus/rusty-place","owner":"canta-slaus","description":"A very basic \"clone\" of Reddit's r/place written in Rust using warp","archived":false,"fork":false,"pushed_at":"2022-08-18T19:25:09.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T06:16:47.247Z","etag":null,"topics":["http","rust","warp"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/canta-slaus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-06T19:17:40.000Z","updated_at":"2022-12-27T14:46:31.000Z","dependencies_parsed_at":"2022-08-13T07:20:24.885Z","dependency_job_id":null,"html_url":"https://github.com/canta-slaus/rusty-place","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/canta-slaus/rusty-place","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canta-slaus%2Frusty-place","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canta-slaus%2Frusty-place/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canta-slaus%2Frusty-place/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canta-slaus%2Frusty-place/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canta-slaus","download_url":"https://codeload.github.com/canta-slaus/rusty-place/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canta-slaus%2Frusty-place/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267820873,"owners_count":24149293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","rust","warp"],"created_at":"2025-01-21T21:19:27.646Z","updated_at":"2025-07-30T06:10:29.864Z","avatar_url":"https://github.com/canta-slaus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# r(usty)/place\nA very basic \"clone\" of [r/place](https://www.reddit.com/r/place/) written in Rust using [warp](https://github.com/seanmonstar/warp).\n\nInstead of rendering the image on the client side, the image is encoded as PNG and sent to the user. This doesn't scale well as that image is constructed every time someone sends a GET requests to `/image`. Ideally, you would render the image client-side and e.g. using WebSockets, send them notifications when a pixel was edited.\n\n# Features\nThere aren't that many:\n- When the server shuts down, the image data is stored in a file `image` and loaded back up when the server starts again.\n\n# API\n\u003cdetails\u003e\n \u003csummary\u003e\u003ccode\u003eGET\u003c/code\u003e \u003ccode\u003e/\u003c/code\u003e \u003ccode\u003ebasic welcoming message\u003c/code\u003e\u003c/summary\u003e\n\n#### Responses\n| HTTP code | content-type       | response                                                   |\n|-----------|--------------------|------------------------------------------------------------|\n| `200`     | `application/json` | `{\"code\":200,\"message\":\"Welcome to r/place but in Rust!\"}` |\n\n#### Example\n```\n$ curl -X GET http://localhost:3030/\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n \u003csummary\u003e\u003ccode\u003eGET\u003c/code\u003e \u003ccode\u003e/image\u003c/code\u003e \u003ccode\u003esends the current canvas\u003c/code\u003e\u003c/summary\u003e\n\n#### Responses\n| HTTP code | content-type | response |\n|-----------|--------------|----------|\n| `200`     | `image/png`  |          |\n\n#### Example\n```\n$ curl -X GET http://localhost:3030/image \u003e image.png\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n \u003csummary\u003e\u003ccode\u003ePUT\u003c/code\u003e \u003ccode\u003e/set-pixel/:x/:y\u003c/code\u003e \u003ccode\u003eset the color of a pixel\u003c/code\u003e\u003c/summary\u003e\n\n#### Parameters\n| name |  type    | data type | description                   |\n|------|----------|-----------|-------------------------------|\n| `x`  | required | `usize`   | The `x` position of the pixel |\n| `y`  | required | `usize`   | The `y` position of the pixel |\n\n#### Body\n- max. `Content-Length` is 32 bytes\n- `hex_color` has to be string of length 6\n\n```json\n{\n    \"color\": hex_color\n}\n```\n\nExample:\n```json\n{\"color\":\"FFFFFF\"}\n```\n\n### Header\n| name      |  type    | data type | description                               |\n|-----------|----------|-----------|-------------------------------------------|\n| `X-Token` | required | `String`  | The \"auth\" token (has to be set to `abc`) |\n\n#### Responses\n| HTTP code | content-type       | response                                             | description                     |\n|-----------|--------------------|------------------------------------------------------|---------------------------------|\n| `200`     | `application/json` | `{\"code\":200,\"message\":\"Successfully edited pixel\"}` |                                 |\n| `400`     | `application/json` | `{\"code\":400,\"message\":\"MISSING_HEADER: X-Token\"}`   |                                 |\n| `401`     | `application/json` | `{\"code\":401,\"message\":\"BAD_AUTH\"}`                  | `X-Token` wasn't `abc`          |\n| `411`     | `application/json` | `{\"code\":411,\"message\":\"MISSING_CONTENT_LENGTH\"}`    | Missing body                    |\n| `413`     | `application/json` | `{\"code\":413,\"message\":\"PAYLOAD_TOO_LARGE\"}`         | Body too big (max. 32 bytes)    |\n| `422`     | `application/json` | `{\"code\":422,\"message\":\"MALFORMED_BODY\"}`            | Body couldn't be parsed to JSON |\n| `422`     | `application/json` | `{\"code\":422,\"message\":\"OUT_OF_BOUNDS\"}`             | Pixel out of bounds             |\n| `422`     | `application/json` | `{\"code\":422,\"message\":\"INVALID_COLOR\"}`             | Invalid hex color               |\n\n#### Example\n```\n$ curl -X PUT -H \"X-Token: abc\" -H \"Content-Type: application/json\" -d \"{\\\"color\\\":\\\"ffffff\\\"}\" http://localhost:3030/set-pixel/10/10\n```\n\u003c/details\u003e\n\n# Future ideas\n- \"proper\" authentication i.e. creating accounts with unique auth tokens\n- rate limits to prevent spamming\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanta-slaus%2Frusty-place","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanta-slaus%2Frusty-place","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanta-slaus%2Frusty-place/lists"}