Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
},
"devDependencies": {
"@types/express": "^4.17.23",
"@types/node": "^20.11.30",
"ts-node": "^10.9.2",

"ts-node-dev": "^2.0.0",
"typescript": "^5.9.2"
}
Expand Down
Binary file added public/frames/base/frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/frames/base/mmetadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Base Frame",
"description": "This is a placeholder base frame. Replace as needed.",
"preview": "/frames/base/frame.png"
}
13 changes: 10 additions & 3 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ import fs from "fs";
const app = express();
const PORT = 3000;

// Health check route (optional)
app.get("/", (req, res) => {
res.send("Server is running");
});

/**
* GET /api/framed-avatar/:username
* Example: /api/framed-avatar/octocat?theme=classic&size=256
* Example: /api/framed-avatar/octocat?theme=base&size=256
*/
app.get("/api/framed-avatar/:username", async (req: Request, res: Response) => {
try {
const username = req.params.username;
const theme = (req.query.theme as string) || "classic";
const size = Number(req.query.size ?? 256);
const theme = (req.query.theme as string) || "base"; // Default to base theme for testing
const size = Math.max(64, Math.min(Number(req.query.size ?? 256), 1024)); // Limit size between 64 and 1024

console.log(`Fetching avatar for username=${username}, theme=${theme}, size=${size}`);

if (isNaN(size) || size <= 0 || size > 1024) {
return res.status(400).json({ error: "Invalid size parameter" });
Expand Down