Embed Image test?
This commit is contained in:
parent
146d534d37
commit
87f4baf491
8 changed files with 2787 additions and 6 deletions
BIN
assets/Images/fallbackPFP.png
Normal file
BIN
assets/Images/fallbackPFP.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 601 KiB |
BIN
assets/fonts/Rubik-Regular.ttf
Normal file
BIN
assets/fonts/Rubik-Regular.ttf
Normal file
Binary file not shown.
35
imageEmbedder.js
Normal file
35
imageEmbedder.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const nodeHtmlToImage = require('node-html-to-image'),
|
||||
api = require("./api.js"),
|
||||
pageUpdater = require("./pageUpdater.js")
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
app = require("./expressHandler.js").app
|
||||
|
||||
const constants = JSON.parse(fs.readFileSync(path.join(__dirname, "constants.json")))
|
||||
|
||||
app.get("/embedImage.png", async (req, res) => {
|
||||
var discColors = constants.discStatuses[api.lanyard.discord_status]
|
||||
|
||||
var pregen = pageUpdater.pregen
|
||||
|
||||
var html = "<h2>Not initialized!...</h2>"
|
||||
|
||||
for (var i in pregen) {
|
||||
var item = pregen[i]
|
||||
if (item.absolutePath.includes("/card/index.html")) {
|
||||
html = item.html
|
||||
}
|
||||
}
|
||||
|
||||
var img = await nodeHtmlToImage({
|
||||
html: html,
|
||||
transparent: true
|
||||
|
||||
})
|
||||
|
||||
res.send(img)
|
||||
})
|
||||
|
||||
app.get("/embedImage", (req, res) => {
|
||||
res.send("<img src='/embedImage.png'> <style>body { background-color:black; } </style>")
|
||||
})
|
2
index.js
2
index.js
|
@ -2,7 +2,7 @@ const fs = require("fs")
|
|||
|
||||
require("./fileHandler.js")
|
||||
require('./expressHandler.js')
|
||||
// require("./imageEmbedder.js")
|
||||
require("./imageEmbedder.js")
|
||||
|
||||
process.on('uncaughtException', (err, origin) => {
|
||||
fs.writeSync(
|
||||
|
|
2579
package-lock.json
generated
2579
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,7 @@
|
|||
"glob": "^10.4.2",
|
||||
"himalaya": "^1.1.0",
|
||||
"minify-html": "^0.0.2",
|
||||
"node-html-to-image": "^4.0.0",
|
||||
"ws": "^8.16.0",
|
||||
"youtubei.js": "^9.0.2"
|
||||
}
|
||||
|
|
|
@ -388,11 +388,12 @@ module.exports = {
|
|||
|
||||
res.send(data)
|
||||
} else {
|
||||
res.status(404).send(`
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<h1>404</h1>
|
||||
<p>Uh oh... I think your lost? There's nothing here :P</p>
|
||||
`)
|
||||
// res.status(404).send(`
|
||||
// <link rel="stylesheet" href="/style.css">
|
||||
// <h1>404</h1>
|
||||
// <p>Uh oh... I think your lost? There's nothing here :P</p>
|
||||
// `)
|
||||
next()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -430,6 +431,8 @@ function pregenerate() {
|
|||
for (var i = 0; i < pregenFiles.length; i++) {
|
||||
pregenFiles[i].html = pregenFiles[i].html.replaceAll("{PREGEN_TOTAL}", Date.now() - lastPregen)
|
||||
}
|
||||
|
||||
module.exports.pregen = pregenFiles
|
||||
}
|
||||
|
||||
pregenerate()
|
||||
|
|
163
static/card/index.html
Normal file
163
static/card/index.html
Normal file
|
@ -0,0 +1,163 @@
|
|||
<style>
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-display: swap;
|
||||
font-family: 'Rubik';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url('/fonts/rubik-v28-latin-regular.woff2') format('woff2');
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: 'Rubik', Verdana, Geneva, Tahoma, sans-serif;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#topbar>* {
|
||||
display: inline-block;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
main:nth-of-type(1), .mainDiv {
|
||||
width: 95%;
|
||||
max-width: 1000px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
transition: 1.5s all cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
}
|
||||
|
||||
a[href] {
|
||||
color: rgb(175, 225, 255);
|
||||
}
|
||||
|
||||
.chip {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
font-size: 1.3rem;
|
||||
border: 2px gray solid;
|
||||
border-radius: 6px;
|
||||
background-color: black;
|
||||
padding: 8px;
|
||||
margin: 3px;
|
||||
display: inline-block;
|
||||
transform: scale(0.95);
|
||||
transition: transform 1.25s cubic-bezier(0.075, 0.82, 0.165, 1), background-color 2s cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
}
|
||||
|
||||
a.chip {
|
||||
text-decoration: none;
|
||||
/* background-image: linear-gradient(rgb(175, 225, 255), rgb(175, 225, 255));
|
||||
background-size: calc(100% - 15px) 2px;
|
||||
background-position: 50% 87.5%;
|
||||
background-repeat: no-repeat; */
|
||||
}
|
||||
|
||||
.chip:hover {
|
||||
background-color: rgb(10, 0, 25);
|
||||
transform: scale(1);
|
||||
/* font-size: 1.35rem; */
|
||||
border-color: white;
|
||||
transition: transform 0.75s cubic-bezier(0.075, 0.82, 0.165, 1), background-color 3s cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
}
|
||||
|
||||
.chip:hover>.smallimg {
|
||||
background-color: rgb(10, 0, 25);
|
||||
}
|
||||
|
||||
hr {
|
||||
color: white;
|
||||
border: white solid;
|
||||
opacity: 0.25;
|
||||
border-width: 2px;
|
||||
margin: 15px 10%;
|
||||
/* background-color: none; */
|
||||
}
|
||||
|
||||
body {
|
||||
width: 800;
|
||||
height: 500;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1.25rem;
|
||||
margin: 5px;
|
||||
line-height: 2rem;
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
#card {
|
||||
background-color: rgba(20, 5, 90);
|
||||
padding: 15px;
|
||||
border: 2px white solid;
|
||||
margin: 20px auto;
|
||||
width: 90%;
|
||||
max-width: 800px;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
border-radius: 12px;
|
||||
|
||||
box-shadow: 0px 5px 50px 0px rgba(0, 0, 0, .25);
|
||||
}
|
||||
|
||||
.pfp {
|
||||
border-radius: 15px;
|
||||
border: darkgray 4px solid;
|
||||
float: right;
|
||||
width: 60%;
|
||||
aspect-ratio: 1/1;
|
||||
transform: scale(0.9);
|
||||
border-radius: 50%;
|
||||
rotate: 0deg;
|
||||
user-select: none;
|
||||
max-width: 168px;
|
||||
|
||||
animation-duration: 3s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div style="height: 100%; width: 100%; display: flex; justify-content: center; align-items: center;">
|
||||
<div id="card">
|
||||
<h2>{Violet}</h2>
|
||||
<div style="display: flex; justify-content: center; align-items: center;">
|
||||
<div style="width: 50%;">
|
||||
<img draggable="false" src="https://api.violets-purgatory.dev/v1/pfp" class="pfp">
|
||||
</div>
|
||||
<div style="width: 50%;">
|
||||
<div style="float: left;">
|
||||
<p>They/Them</p>
|
||||
<p>Developer</p>
|
||||
<!-- <p>{DISCORD_STATUS}</p> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div>
|
||||
<p style="padding: 10px;">Hi! I'm Violet, a 15 year old web and game developer. I make server-sided dynamic websites, with majority of rendering being done on the server, no Javascript needed! I'm currently making games in the Godot Engine, and my dynamic sites in NodeJS.</p>
|
||||
<div class="customStatus">
|
||||
{CUSTOM_STATUS}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in a new issue