mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
remove debug messages
This commit is contained in:
parent
910389238a
commit
841663ed80
1 changed files with 2 additions and 5 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
// import { Context } from "netlify:edge";
|
// import { Context } from "netlify:edge";
|
||||||
|
|
||||||
|
|
||||||
export default async (request, context) => {
|
export default async (request, context) => {
|
||||||
const agent = request.headers.get("user-agent");
|
const agent = request.headers.get("user-agent");
|
||||||
let url = new URL(request.url);
|
let url = new URL(request.url);
|
||||||
|
|
@ -13,18 +12,17 @@ export default async (request, context) => {
|
||||||
let title = decodeURIComponent(components.shift()).replace("_", " ");
|
let title = decodeURIComponent(components.shift()).replace("_", " ");
|
||||||
let desc = decodeURIComponent(components.shift()).replace("_", " ");
|
let desc = decodeURIComponent(components.shift()).replace("_", " ");
|
||||||
let image = decodeURIComponent(components.join("/"));
|
let image = decodeURIComponent(components.join("/"));
|
||||||
console.log("components", title, desc, image)
|
|
||||||
|
|
||||||
let content = "";
|
let content = "";
|
||||||
if (title) content += `<title>${title}</title><meta property="og:title" content="${title}"/>`;
|
if (title) content += `<title>${title}</title><meta property="og:title" content="${title}"/>`;
|
||||||
if (desc && desc.length > 1) content += `<meta name="description" content="${desc}"/><meta property="og:description" content="${desc}"/>`;
|
if (desc && desc.length > 1) content += `<meta name="description" content="${desc}"/><meta property="og:description" content="${desc}"/>`;
|
||||||
if (image) {
|
if (image) {
|
||||||
if (image.startsWith("http")) {
|
if (image.startsWith("http")) {
|
||||||
console.debug("URL Image", image)
|
//console.debug("URL Image", image)
|
||||||
content += `<meta property="og:image" content="${image}"/>`;
|
content += `<meta property="og:image" content="${image}"/>`;
|
||||||
} else {
|
} else {
|
||||||
image = decodeURIComponent(image)
|
image = decodeURIComponent(image)
|
||||||
console.log("Emoji Image", image);
|
//console.log("Emoji Image", image);
|
||||||
let codepoints = [];
|
let codepoints = [];
|
||||||
for (const char of image) {
|
for (const char of image) {
|
||||||
codepoints.push(char.codePointAt(0).toString(16));
|
codepoints.push(char.codePointAt(0).toString(16));
|
||||||
|
|
@ -32,7 +30,6 @@ export default async (request, context) => {
|
||||||
content += `<link rel="icon" type="image/png" href="https://fonts.gstatic.com/s/e/notoemoji/14.0/${codepoints.join("_")}/128.png">`
|
content += `<link rel="icon" type="image/png" href="https://fonts.gstatic.com/s/e/notoemoji/14.0/${codepoints.join("_")}/128.png">`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("content", content)
|
|
||||||
return new Response(content, {
|
return new Response(content, {
|
||||||
headers: { "content-type": "text/html" },
|
headers: { "content-type": "text/html" },
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue