notecrumbs

a nostr opengraph server build on nostrdb and egui
git clone git://jb55.com/notecrumbs
Log | Files | Refs | README | LICENSE

commit 5904d4dc539b5d3d3ae94531e372a3868de3716b
parent 328c7467e73013e7dc0e21fd1b4a5f4581033213
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 20 Dec 2023 18:42:08 -0800

get it working on twitter

Diffstat:
Msrc/main.rs | 24++++++++++--------------
Msrc/render.rs | 6+++---
2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -166,25 +166,21 @@ fn serve_note_html( <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="UTF-8"> - <meta property="og:title" content="{0}"/> - <meta property="og:description" content="{1}"/> + <meta property="og:description" content="{1}" /> <meta property="og:image" content="{2}/{3}.png"/> + <meta property="og:image:alt" content="{0}: {1}" /> + <meta property="og:image:height" content="600" /> + <meta property="og:image:width" content="1200" /> + <meta property="og:image:type" content="image/png" /> + <meta property="og:site_name" content="Damus" /> + <meta property="og:title" content="{0}: {1}" /> <meta property="og:url" content="{2}/{3}"/> <meta name="og:type" content="website"/> - <meta name="twitter:card" content="summary"/> <meta name="twitter:image:src" content="{2}/{3}.png" /> <meta name="twitter:site" content="@damusapp" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:title" content="{0}: {1}" /> - <meta name="twitter:description" content="{4}" /> - <meta property="og:image:alt" content="{0}: {1}" /> - <meta property="og:image:width" content="1200" /> - <meta property="og:image:height" content="630" /> - <meta property="og:site_name" content="Damus" /> - <meta property="og:type" content="object" /> - <meta property="og:title" content="{0}: {1}" /> - <meta property="og:url" content="{2}/{3}" /> - <meta property="og:description" content="{4}" /> + <meta name="twitter:description" content="{1}" /> </head> <body> @@ -292,11 +288,11 @@ fn get_default_pfp() -> egui::ColorImage { async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> { env_logger::init(); - let addr = SocketAddr::from(([127, 0, 0, 1], 3000)); + let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); // We create a TcpListener and bind it to 127.0.0.1:3000 let listener = TcpListener::bind(addr).await?; - info!("Listening on 127.0.0.1:3000"); + info!("Listening on 0.0.0.0:3000"); // Since ndk-sdk will verify for us, we don't need to do it on the db side let mut cfg = Config::new(); diff --git a/src/render.rs b/src/render.rs @@ -341,7 +341,7 @@ fn note_ui(app: &Notecrumbs, ctx: &egui::Context, note: &NoteRenderData) { let outer_margin = 40.0; let inner_margin = 60.0; let canvas_width = 1200.0; - let canvas_height = 630.0; + let canvas_height = 600.0; //let canvas_size = Vec2::new(canvas_width, canvas_height); let total_margin = outer_margin + inner_margin; @@ -436,13 +436,13 @@ pub fn render_note(app: &Notecrumbs, render_data: &RenderData) -> Vec<u8> { let mut surface = match render_data { RenderData::Note(note_render_data) => rasterize( - (1200, 630), + (1200, 600), |ctx| note_ui(app, ctx, note_render_data), Some(options), ), RenderData::Profile(profile_render_data) => rasterize( - (1200, 630), + (1200, 600), |ctx| profile_ui(app, ctx, profile_render_data), Some(options), ),