oberconcejo/VS-CODE / .agents/skills/app-store-screenshots
app-store-screenshots
FlaggedUse when building App Store or Google Play screenshot pages, generating exportable marketing screenshots for iOS, macOS, and/or Android apps, or scaffolding a screenshot editor with Next.js. Triggers on app store, mac app store, play store, screenshots, marketing assets, html-to-image, phone mockup, mac mockup, android screenshots, feature graphic.
template/src/lib/request-guard.ts
View on GitHub/** Disk writes require JSON and the editor's own origin. Headerless CLI
* requests remain supported; these checks do not provide network authentication. */
export type GuardFailure = { error: string; status: number };
/**
* Returns a failure to respond with, or null when the request is allowed.
* Call at the top of every route handler that writes to disk.
*/
export function rejectCrossSiteWrite(req: Request): GuardFailure | null {
// 1. Content-Type must be application/json. Not CORS-simple, so a
// cross-origin caller is forced into a preflight that fails.
const contentType = req.headers.get("content-type") || "";
if (contentType.toLowerCase().split(";")[0].trim() !== "application/json") {
return { error: "Content-Type must be application/json", status: 415 };
}
// 2. Another local app (including a different port) is a different origin.
const origin = req.headers.get("origin");
// Next can canonicalize req.url to localhost even when the browser used
// 127.0.0.1 or a LAN address. Host is the browser's actual request authority.
const target = new URL(req.url);
target.host = req.headers.get("host") || target.host;
if (origin && origin !== target.origin) {
return { error: "Cross-origin write rejected", status: 403 };
}
// 3. Sec-Fetch-Site, when present, must not be cross-site.
const site = req.headers.get("sec-fetch-site");
if (site && site !== "same-origin" && site !== "none") {
return { error: "Cross-site write rejected", status: 403 };
}
return null;
}
/** Magic-byte sniff. Returns the real type, or null if it is neither. */
export function sniffImageType(bytes: Buffer): "image/png" | "image/jpeg" | null {
if (
bytes.length >= 8 &&
bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47 &&
bytes[4] === 0x0d && bytes[5] === 0x0a && bytes[6] === 0x1a && bytes[7] === 0x0a
) {
return "image/png";
}
if (bytes.length >= 3 && bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff) {
return "image/jpeg";
}
return null;
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |