feat: add embed snippet to profile settings

This commit is contained in:
2026-06-03 10:09:38 +02:00
parent 19642175eb
commit 3f6e01ed65
3 changed files with 12 additions and 0 deletions

View File

@@ -379,6 +379,7 @@ pub struct ProfileSettingsTemplate<'a> {
pub also_known_as: Option<&'a str>,
pub profile_fields: &'a [(String, String)],
pub saved: bool,
pub embed_url: String,
}
#[derive(Template)]

View File

@@ -56,4 +56,10 @@
<button type="submit">Save</button>
</form>
<section style="margin-top:2rem;padding-top:1rem;border-top:1px solid rgba(255,255,255,0.1)">
<h3>Embed widget</h3>
<p style="font-size:.85em;opacity:.7;margin-bottom:.5rem">Add your diary to your blog or website:</p>
<pre style="background:rgba(255,255,255,0.06);padding:12px;border-radius:8px;font-size:.8em;overflow-x:auto;white-space:pre-wrap;word-break:break-all"><code>&lt;iframe src="{{ embed_url }}" width="100%" height="600" style="border:none;border-radius:8px" loading="lazy"&gt;&lt;/iframe&gt;</code></pre>
</section>
{% endblock %}

View File

@@ -1251,6 +1251,11 @@ pub async fn get_profile_settings(
also_known_as: also_known_as.as_deref(),
profile_fields: &profile_fields,
saved,
embed_url: format!(
"{}/users/{}?embed=1",
state.app_ctx.config.base_url,
user_id.value()
),
})
.into_response()
}