Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an API to Pixlet #6

Merged
merged 1 commit into from
Feb 17, 2025
Merged

Add an API to Pixlet #6

merged 1 commit into from
Feb 17, 2025

Conversation

IngmarStein
Copy link
Member

Currently, only one endpoint is implemented: /api/render renders an applet accessible to the pixlet process and returns the webp or gif image data.

Example request:

POST /api/render
{
    "path": "/workspaces/pixlet/examples/clock",
    "config": {
        "timezone": "America/New_York"
    }
}

The HTTP cache is bound to the process lifetime. That means, multiple render requests use the same HTTP cache.

@IngmarStein IngmarStein requested a review from tavdog February 16, 2025 21:48
buf, err := renderApplet(r.Path, r.Config, r.Width, r.Height, r.Magnify)

if err != nil {
http.Error(w, fmt.Sprintf("error rendering: %v", err), http.StatusInternalServerError)

Check warning

Code scanning / CodeQL

Information exposure through a stack trace Medium

HTTP response depends on
stack trace information
and may be exposed to an external user.
HTTP response depends on
stack trace information
and may be exposed to an external user.
@IngmarStein IngmarStein force-pushed the main branch 3 times, most recently from ec89b65 to 2fd17aa Compare February 16, 2025 22:42
Currently, only one endpoint is implemented: `/api/render` renders an
applet accessible to the pixlet process and returns the webp or gif
image data.

Example request:

```
POST /api/render
{
    "path": "/workspaces/pixlet/examples/clock",
    "config": {
        "timezone": "America/New_York"
    }
}
```

The HTTP cache is bound to the process lifetime. That means, multiple
render requests use the same HTTP cache.
IngmarStein added a commit to IngmarStein/tronbyt-server that referenced this pull request Feb 16, 2025
The API method is faster than running the CLI because it doesn't
require launching additional processes and has a functional HTTP
cache.

Requires tronbyt/pixlet#6
IngmarStein added a commit to IngmarStein/tronbyt-server that referenced this pull request Feb 16, 2025
The API method is faster than running the CLI because it doesn't
require launching additional processes and has a functional HTTP
cache.

Requires tronbyt/pixlet#6
@IngmarStein IngmarStein merged commit 2990e40 into tronbyt:main Feb 17, 2025
7 checks passed
IngmarStein added a commit to IngmarStein/tronbyt-server that referenced this pull request Feb 17, 2025
The API method is faster than running the CLI because it doesn't
require launching additional processes and has a functional HTTP
cache.

Requires tronbyt/pixlet#6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant