summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorJay V <[email protected]>2025-06-09 16:42:13 -0500
committerJay V <[email protected]>2025-06-09 16:42:13 -0500
commitb97b15e0fe9ef5336dcb99e95b3cd604fc98a8c7 (patch)
treed763901d676147a8e34fc65e0f4ad34623194568 /packages
parentfcb972de193f6068e512eac18ec0341b989b7da6 (diff)
downloadopencode-b97b15e0fe9ef5336dcb99e95b3cd604fc98a8c7.tar.gz
opencode-b97b15e0fe9ef5336dcb99e95b3cd604fc98a8c7.zip
share og image
Diffstat (limited to 'packages')
-rw-r--r--packages/web/package.json1
-rw-r--r--packages/web/src/pages/s/index.astro39
2 files changed, 38 insertions, 2 deletions
diff --git a/packages/web/package.json b/packages/web/package.json
index 283edb3c9..dc6654119 100644
--- a/packages/web/package.json
+++ b/packages/web/package.json
@@ -20,6 +20,7 @@
"ai": "catalog:",
"astro": "5.7.13",
"diff": "8.0.2",
+ "js-base64": "3.7.7",
"luxon": "3.6.1",
"marked": "15.0.12",
"rehype-autolink-headings": "7.1.0",
diff --git a/packages/web/src/pages/s/index.astro b/packages/web/src/pages/s/index.astro
index a9eab7046..e39b57000 100644
--- a/packages/web/src/pages/s/index.astro
+++ b/packages/web/src/pages/s/index.astro
@@ -1,4 +1,5 @@
---
+import { Base64 } from "js-base64";
import config from "virtual:starlight/user-config";
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
@@ -12,15 +13,49 @@ const data = await res.json();
console.log(data.info)
----
+const title = "Share";
+
+const encodedTitle = encodeURIComponent(
+ Base64.encode(
+ // Convert to ASCII
+ encodeURIComponent(
+ // Truncate to fit S3's max key size
+ title.substring(0, 700)
+ )
+ )
+)
+const cardService = "https://social-cards.sst.dev";
+const cost = "$0.12";
+const model = "claude-sonnet-4-20250514,claude-opus-4-20250514";
+const version = "v0.1.1";
+// ?cost=$0.12&model=claude-sonnet-4-20250514,claude-opus-4-20250514&version=v0.1.1&id=43120e6b
+const ogImageUrl = `${cardService}/opencode-share/${encodedTitle}.png?cost=${cost}&model=${model}&version=${version}&id=${id}`;
+
+---
<StarlightPage
hasSidebar={false}
frontmatter={{
- title: "Share",
+ title: title,
pagefind: false,
template: "splash",
tableOfContents: false,
+ head: [
+ {
+ tag: "meta",
+ attrs: {
+ property: "og:image",
+ content: ogImageUrl,
+ },
+ },
+ {
+ tag: "meta",
+ attrs: {
+ name: "twitter:image",
+ content: ogImageUrl,
+ },
+ },
+ ],
}}
>
<Share api={apiUrl} data={data.messages} client:only="solid" />