mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-16 23:01:31 +02:00
Add an OG image and link preview tags to the web build
This commit is contained in:
@@ -29,6 +29,35 @@ const iconsDir = normalizePath(
|
|||||||
*/
|
*/
|
||||||
const yaakTarget = process.env.YAAK_TARGET === "web" ? "web" : "desktop";
|
const yaakTarget = process.env.YAAK_TARGET === "web" ? "web" : "desktop";
|
||||||
|
|
||||||
|
const webUrl = "https://web.yaak.app";
|
||||||
|
const webDir = normalizePath(path.join(import.meta.dirname, "web"));
|
||||||
|
|
||||||
|
/** Link previews for the hosted web app. Meaningless inside the desktop window. */
|
||||||
|
function webHead() {
|
||||||
|
return {
|
||||||
|
name: "web-head",
|
||||||
|
transformIndexHtml() {
|
||||||
|
const title = "Yaak in your browser";
|
||||||
|
const description = "No download, no setup. Open a tab and send your first request.";
|
||||||
|
return [
|
||||||
|
{ tag: "meta", attrs: { name: "description", content: description } },
|
||||||
|
{ tag: "meta", attrs: { property: "og:type", content: "website" } },
|
||||||
|
{ tag: "meta", attrs: { property: "og:url", content: webUrl } },
|
||||||
|
{ tag: "meta", attrs: { property: "og:title", content: title } },
|
||||||
|
{ tag: "meta", attrs: { property: "og:description", content: description } },
|
||||||
|
{ tag: "meta", attrs: { property: "og:image", content: `${webUrl}/og.png` } },
|
||||||
|
{ tag: "meta", attrs: { property: "og:image:width", content: "1200" } },
|
||||||
|
{ tag: "meta", attrs: { property: "og:image:height", content: "630" } },
|
||||||
|
{ tag: "meta", attrs: { name: "twitter:card", content: "summary_large_image" } },
|
||||||
|
{ tag: "meta", attrs: { name: "twitter:site", content: "@yaakapp" } },
|
||||||
|
{ tag: "meta", attrs: { name: "twitter:title", content: title } },
|
||||||
|
{ tag: "meta", attrs: { name: "twitter:description", content: description } },
|
||||||
|
{ tag: "meta", attrs: { name: "twitter:image", content: `${webUrl}/og.png` } },
|
||||||
|
];
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Where `yaak-web` is listening, taken from the same variables that put it there.
|
* Where `yaak-web` is listening, taken from the same variables that put it there.
|
||||||
*
|
*
|
||||||
@@ -136,9 +165,19 @@ export default defineConfig(async () => {
|
|||||||
dest: "",
|
dest: "",
|
||||||
rename: { name: "icon-128.png", stripBase: true },
|
rename: { name: "icon-128.png", stripBase: true },
|
||||||
},
|
},
|
||||||
|
...(yaakTarget === "web"
|
||||||
|
? [{ src: `${webDir}/og.png`, dest: "", rename: { stripBase: true } }]
|
||||||
|
: []),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
verifyServedAssets(["cmaps", "standard_fonts", "favicon.ico", "icon-128.png"]),
|
...(yaakTarget === "web" ? [webHead()] : []),
|
||||||
|
verifyServedAssets([
|
||||||
|
"cmaps",
|
||||||
|
"standard_fonts",
|
||||||
|
"favicon.ico",
|
||||||
|
"icon-128.png",
|
||||||
|
...(yaakTarget === "web" ? ["og.png"] : []),
|
||||||
|
]),
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
target: "esnext",
|
target: "esnext",
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<!--
|
||||||
|
Source for og.png (1200x630). Re-render after editing:
|
||||||
|
cd apps/yaak-client/web && "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --hide-scrollbars --window-size=1200,630 --force-device-scale-factor=1 --virtual-time-budget=10000 --screenshot=og.png "file://$PWD/og.html"
|
||||||
|
-->
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@500;600;800&family=JetBrains+Mono:wght@400;500&display=block"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
width: 1200px;
|
||||||
|
height: 630px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
font-family: Inter, sans-serif;
|
||||||
|
color: hsl(245, 23%, 85%);
|
||||||
|
background:
|
||||||
|
radial-gradient(900px 600px at 0% 100%, hsl(160, 40%, 16%) 0%, transparent 60%),
|
||||||
|
radial-gradient(900px 600px at 100% 0%, hsl(275, 40%, 20%) 0%, transparent 60%),
|
||||||
|
linear-gradient(135deg, hsl(244, 23%, 12%) 0%, hsl(244, 23%, 15%) 100%);
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
.dots {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image: radial-gradient(hsla(245, 23%, 85%, 0.07) 1.2px, transparent 1.2px);
|
||||||
|
background-size: 28px 28px;
|
||||||
|
mask-image: radial-gradient(ellipse at 50% 40%, black 30%, transparent 75%);
|
||||||
|
}
|
||||||
|
.page {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
padding: 56px 64px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.brand {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
.brand img {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
margin-top: 52px;
|
||||||
|
font-size: 84px;
|
||||||
|
line-height: 1.05;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
color: hsl(245, 23%, 92%);
|
||||||
|
}
|
||||||
|
h1 em {
|
||||||
|
font-style: normal;
|
||||||
|
color: hsl(48, 80%, 63%);
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin-top: 28px;
|
||||||
|
font-size: 34px;
|
||||||
|
line-height: 1.4;
|
||||||
|
font-weight: 500;
|
||||||
|
color: hsl(245, 18%, 68%);
|
||||||
|
max-width: 1040px;
|
||||||
|
}
|
||||||
|
.bar {
|
||||||
|
margin-top: auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 22px;
|
||||||
|
height: 72px;
|
||||||
|
padding: 0 28px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: hsla(244, 23%, 22%, 0.6);
|
||||||
|
border: 1px solid hsl(244, 23%, 28%);
|
||||||
|
font-family: "JetBrains Mono", monospace;
|
||||||
|
font-size: 28px;
|
||||||
|
box-shadow: 0 10px 40px hsla(244, 40%, 5%, 0.4);
|
||||||
|
}
|
||||||
|
.method {
|
||||||
|
color: hsl(245, 18%, 62%);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.url .scheme {
|
||||||
|
color: hsl(245, 18%, 55%);
|
||||||
|
}
|
||||||
|
.url .host {
|
||||||
|
color: hsl(245, 23%, 92%);
|
||||||
|
}
|
||||||
|
.status {
|
||||||
|
margin-left: auto;
|
||||||
|
color: hsl(150, 99%, 44%);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="dots"></div>
|
||||||
|
<div class="page">
|
||||||
|
<div class="brand">
|
||||||
|
<img src="../../../crates-tauri/yaak-app-client/icons/release/128x128@2x.png" alt="" />
|
||||||
|
<span>Yaak</span>
|
||||||
|
</div>
|
||||||
|
<h1>Your favorite API client<br /><em>in your browser</em></h1>
|
||||||
|
<p>No download, no setup. Open a tab and send your first request.</p>
|
||||||
|
<div class="bar">
|
||||||
|
<span class="method">GET</span>
|
||||||
|
<span class="url"><span class="scheme">https://</span><span class="host">web.yaak.app</span></span>
|
||||||
|
<span class="status">200 OK</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 295 KiB |
Reference in New Issue
Block a user