mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
remove unnecessary logs and use nip05s if avl
This commit is contained in:
parent
baa6e318f3
commit
8c9facdad7
1 changed files with 3 additions and 5 deletions
|
|
@ -123,7 +123,7 @@ const normalizeHandle = async (handle: string) => {
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const getKind0 = async (handle: string | undefined): Promise<Required<Pick<NostrMetadata, 'name' | 'about'>>> => {
|
const getKind0 = async (handle: string | undefined): Promise<Pick<NostrMetadata, 'name' | 'about' | 'nip05'>> => {
|
||||||
const id = await normalizeHandle(handle || '');
|
const id = await normalizeHandle(handle || '');
|
||||||
const kind0 = await getAuthor(id);
|
const kind0 = await getAuthor(id);
|
||||||
|
|
||||||
|
|
@ -197,9 +197,9 @@ const buildMetaTags = async (params: PathParams, url: string): Promise<string> =
|
||||||
});
|
});
|
||||||
} else if (params.acct) {
|
} else if (params.acct) {
|
||||||
return tpl({
|
return tpl({
|
||||||
title: `View @${kind0.name}'s profile on Ditto`,
|
title: `View @${kind0.nip05 || kind0.name || 'npub1xxx'}'s profile on Ditto`,
|
||||||
type: 'profile',
|
type: 'profile',
|
||||||
description: kind0.about,
|
description: kind0.about || '',
|
||||||
url,
|
url,
|
||||||
});
|
});
|
||||||
} else if (params.statusId) {
|
} else if (params.statusId) {
|
||||||
|
|
@ -222,13 +222,11 @@ export const serveStaticWithOG = <E extends Env>(
|
||||||
return async function serveStatic(c: Context, next: Next) {
|
return async function serveStatic(c: Context, next: Next) {
|
||||||
let file = '';
|
let file = '';
|
||||||
const getContent = async (path: string) => {
|
const getContent = async (path: string) => {
|
||||||
console.log('here');
|
|
||||||
try {
|
try {
|
||||||
if (!file) file = await Deno.readTextFile(path);
|
if (!file) file = await Deno.readTextFile(path);
|
||||||
if (!file) throw new Error(`File at ${path} was empty!`);
|
if (!file) throw new Error(`File at ${path} was empty!`);
|
||||||
if (file.includes(OG_META_PLACEHOLDER)) {
|
if (file.includes(OG_META_PLACEHOLDER)) {
|
||||||
const params = getPathParams(c.req.path);
|
const params = getPathParams(c.req.path);
|
||||||
console.log(params);
|
|
||||||
if (params) {
|
if (params) {
|
||||||
const meta = await buildMetaTags(params, Conf.local(c.req.path));
|
const meta = await buildMetaTags(params, Conf.local(c.req.path));
|
||||||
return file.replace(OG_META_PLACEHOLDER, meta);
|
return file.replace(OG_META_PLACEHOLDER, meta);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue