33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
---
|
|
name: file-upload
|
|
description: When a user asks to upload a file, or one is needed for PR descriptions, use this skill.
|
|
---
|
|
|
|
# File upload
|
|
|
|
Upload files to `https://files.gitcoffee.dev` and return the permanent public URL from the reponse body. Authenticate with `FILE_HOST_TOKEN`. If it is unset, tell the user instead of guessing.
|
|
|
|
## Upload
|
|
|
|
```bash
|
|
curl -sS --fail-with-body -X PUT -T <path-to-file> \
|
|
-H "X-Upload-Token: $FILE_HOST_TOKEN" \
|
|
"https://files.gitcoffee.dev"
|
|
```
|
|
|
|
- Use only the file's basename for `<filename>`, such as `login-flow.mp4`. The server slugifies it and adds a random suffix, so names do not need to be unique.
|
|
- Treat the response body as the permanent public URL and use it directly.
|
|
- On HTTP 401, report that the token is wrong or unset. Do not retry.
|
|
|
|
## Use the URL in GitHub/my selfhosted Gitea
|
|
|
|
- Embed images (`png`, `jpg`, `gif`, `webp`) as ``
|
|
- Link videos (`mp4`, `mov`, `webm`) as `[screen recording](URL)` because inline video players are not well supported.
|
|
- When an inline preview genuienly helps and the clip is shorter than about 30 seconds, also upload a GIF preview:
|
|
|
|
```bash
|
|
ffmpeg -i recording.mp4 -vf "fps=10,scale=800:-1" -loop 0 preview.gif
|
|
```
|
|
|
|
Embed the GIF and link the full-quality video below it.
|