mirror of
https://github.com/stronk-dev/RandomChad.git
synced 2025-07-05 10:35:08 +02:00
Chadified Assets
This commit is contained in:
parent
502aa93f23
commit
b2f153f897
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 14 MiB After Width: | Height: | Size: 14 MiB |
@ -13,7 +13,6 @@ const svgFromAttributes = require("./svg-generator");
|
|||||||
// Rocketeer generator
|
// Rocketeer generator
|
||||||
// ///////////////////////////////
|
// ///////////////////////////////
|
||||||
async function generateRocketeer(id) {
|
async function generateRocketeer(id) {
|
||||||
|
|
||||||
// The base object of a new Rocketeer
|
// The base object of a new Rocketeer
|
||||||
const rocketeer = {
|
const rocketeer = {
|
||||||
name: `${name.first()} ${name.middle()} ${name.last()} of ${
|
name: `${name.first()} ${name.middle()} ${name.last()} of ${
|
||||||
@ -80,14 +79,12 @@ async function generateRocketeer(id) {
|
|||||||
// Generate, compile and upload image
|
// Generate, compile and upload image
|
||||||
const { NODE_ENV: mode } = process.env;
|
const { NODE_ENV: mode } = process.env;
|
||||||
let path;
|
let path;
|
||||||
if (mode == "production"){
|
if (mode == "production") {
|
||||||
path = '/var/www/avatars/' + id
|
path = "/var/www/avatars/" + id;
|
||||||
}else{
|
} else {
|
||||||
path = './output/' + id
|
path = "./output/" + id;
|
||||||
}
|
}
|
||||||
rocketeer.image = await svgFromAttributes(
|
rocketeer.image = await svgFromAttributes(rocketeer.attributes, path);
|
||||||
rocketeer.attributes, path
|
|
||||||
);
|
|
||||||
|
|
||||||
// Namify the attributes
|
// Namify the attributes
|
||||||
rocketeer.attributes = rocketeer.attributes.map((attribute) => {
|
rocketeer.attributes = rocketeer.attributes.map((attribute) => {
|
||||||
|
@ -75,9 +75,16 @@ module.exports = async function svgFromAttributes(attributes = [], path = "") {
|
|||||||
(p) => p !== helmet
|
(p) => p !== helmet
|
||||||
);
|
);
|
||||||
for (let i = obsoleteHelmets.length - 1; i >= 0; i--) {
|
for (let i = obsoleteHelmets.length - 1; i >= 0; i--) {
|
||||||
const element = document.querySelector(`#${obsoleteHelmets[i]}`);
|
{
|
||||||
|
let element = document.querySelector(`#${obsoleteHelmets[i]}` + "_front");
|
||||||
if (element) element.remove();
|
if (element) element.remove();
|
||||||
else console.log(`Could not find #${obsoleteHelmets[i]}`);
|
else console.log(`#${obsoleteHelmets[i]}` + "_front");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let element = document.querySelector(`#${obsoleteHelmets[i]}` + "_back");
|
||||||
|
if (element) element.remove();
|
||||||
|
else console.log(`#${obsoleteHelmets[i]}` + "_back");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove panel if need be
|
// Remove panel if need be
|
||||||
@ -161,7 +168,6 @@ module.exports = async function svgFromAttributes(attributes = [], path = "") {
|
|||||||
console.log("Writing to `" + path + ".svg`...");
|
console.log("Writing to `" + path + ".svg`...");
|
||||||
await fs.writeFile(`${path}.svg`, bakedSvg);
|
await fs.writeFile(`${path}.svg`, bakedSvg);
|
||||||
|
|
||||||
|
|
||||||
// Return public url
|
// Return public url
|
||||||
return "Paths: '" + `${path}.svg` + "'";
|
return "Paths: '" + `${path}.svg` + "'";
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user