-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
63 lines (58 loc) · 2.7 KB
/
index.js
File metadata and controls
63 lines (58 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const express = require("express");
const lightColors = {
f: "#000",
b: "#FFF",
af: "#212121",
ab: "#DEDEDE",
g: "#878787",
};
const darkColors = {
f: "#FFF",
b: "#000",
af: "#DEDEDE",
ab: "#212121",
g: "#878787",
};
const app = express();
app.listen(process.env.PORT || 3000, () => {
console.log("listening");
});
app.get("/", async (req, res) => {
const { mode, type, size = 360 } = req.query;
console.log(mode);
res.setHeader("content-type", "image/svg+xml");
res.status(200).send(
`<svg width="${size}" height="${size}" viewBox="0 0 1080 1080" fill="none" xmlns="http://www.w3.org/2000/svg">
${
mode == "dark" &&
`<rect width="1080" height="1080" fill="${darkColors.b}"/>`
}
${
mode == "light" &&
`<rect width="1080" height="1080" fill="${lightColors.b}"/>`
}
${
type == "ccxli" &&
mode == undefined &&
`<path d="M237.115 749H187.533L300.442 356.273H349.533L462.442 749H412.86L324.988 442.673L237.115 749ZM899.591 703.836V749H862.773C840.518 749 821.864 740.327 806.809 722.982C791.755 705.636 779.482 684.2 769.991 658.673C760.827 633.145 751.173 600.582 741.027 560.982L661.009 749H609.955L721.391 487.836C712.555 460.018 703.064 438.745 692.918 424.018C683.1 408.964 670.991 401.436 656.591 401.436H629.591V356.273H666.409C688.664 356.273 707.318 365.436 722.373 383.764C737.755 401.764 750.027 423.855 759.191 450.036C768.355 475.891 778.336 509.764 789.136 551.655C798.3 586.345 806.155 613.673 812.7 633.636C819.245 653.6 827.427 670.291 837.245 683.709C847.064 697.127 858.845 703.836 872.591 703.836H899.591Z" fill="${lightColors.f}"/>`
}
${
type == "ccxli" &&
mode == "dark" &&
`<path d="M237.115 749H187.533L300.442 356.273H349.533L462.442 749H412.86L324.988 442.673L237.115 749ZM899.591 703.836V749H862.773C840.518 749 821.864 740.327 806.809 722.982C791.755 705.636 779.482 684.2 769.991 658.673C760.827 633.145 751.173 600.582 741.027 560.982L661.009 749H609.955L721.391 487.836C712.555 460.018 703.064 438.745 692.918 424.018C683.1 408.964 670.991 401.436 656.591 401.436H629.591V356.273H666.409C688.664 356.273 707.318 365.436 722.373 383.764C737.755 401.764 750.027 423.855 759.191 450.036C768.355 475.891 778.336 509.764 789.136 551.655C798.3 586.345 806.155 613.673 812.7 633.636C819.245 653.6 827.427 670.291 837.245 683.709C847.064 697.127 858.845 703.836 872.591 703.836H899.591Z" fill="${darkColors.f}"/>`
}
${
type == "profile" &&
mode == undefined &&
`<circle cx="540" cy="540" r="270" fill="#878787"/>`
}
${
type == "profile" &&
mode == "dark" &&
`<circle cx="540" cy="540" r="270" fill="#878787"/>`
}
</svg>
`
);
});
module.exports = app;