Skip to content

Commit

Permalink
Fix size
Browse files Browse the repository at this point in the history
  • Loading branch information
pahlevikun committed Dec 13, 2020
1 parent cd6d452 commit af8517c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,19 @@ app.get("/latest", async (request, response) => {
}

const username = request.query.username;
console.log(request.query);
const offset = request.query.offset || 0;
const width = request.query.width || config.card.width;
const height = request.query.height || config.card.height;
const limit = request.query.limit == null ? 1 :
request.query.limit <= 10
? request.query.limit
: false || config.default.limit;

request.query.width = width;
request.query.height = height;

var resultData = await getUserData(username);
const limit = request.query.limit == null ? config.default.limit
: request.query.limit > resultData.length ? resultData.length
: request.query.limit;
let result = `<svg>`;

if (resultData.length < limit) limit = resultData.length;

result = `<svg xmlns="http:https://www.w3.org/2000/svg" xmlns:xlink="http:https://www.w3.org/1999/xlink"
width="${
(limit == 1 ? width : 2 * width) +
Expand Down
2 changes: 1 addition & 1 deletion src/common/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
global.config = {
default: {
limit: 10,
limit: 1,
margin_left: 10,
margin_top: 10,
cache_seconds: {
Expand Down

1 comment on commit af8517c

@vercel
Copy link

@vercel vercel bot commented on af8517c Dec 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.