Fix lint errors

This commit is contained in:
Râu Cao 2024-10-21 00:30:34 +02:00
parent fe9db7509d
commit 0471e05ef3
Signed by: raucao
GPG Key ID: 37036C356E56CC51
6 changed files with 5 additions and 18 deletions

View File

@ -2,11 +2,8 @@ import { Context } from "@oak/oak";
import { nip19 } from "@nostr/tools"; import { nip19 } from "@nostr/tools";
import { log } from "../log.ts"; import { log } from "../log.ts";
import { lookupUsernameByPubkey } from "../ldap.ts"; import { lookupUsernameByPubkey } from "../ldap.ts";
import { fetchProfileEvent } from "../nostr.ts";
import { profilePageHtml } from "../html.ts";
const nprofileHandler = async function (ctx: Context) { const nprofileHandler = async function (ctx: Context) {
const { request } = ctx;
const nprofile = ctx.params.path; const nprofile = ctx.params.path;
try { try {

View File

@ -2,11 +2,8 @@ import { Context } from "@oak/oak";
import { nip19 } from "@nostr/tools"; import { nip19 } from "@nostr/tools";
import { log } from "../log.ts"; import { log } from "../log.ts";
import { lookupUsernameByPubkey } from "../ldap.ts"; import { lookupUsernameByPubkey } from "../ldap.ts";
import { fetchProfileEvent } from "../nostr.ts";
import { profilePageHtml } from "../html.ts";
const npubHandler = async function (ctx: Context) { const npubHandler = async function (ctx: Context) {
const { request } = ctx;
const npub = ctx.params.path; const npub = ctx.params.path;
try { try {

View File

@ -1,12 +1,10 @@
import { Context } from "@oak/oak"; import { Context } from "@oak/oak";
import { nip19 } from "@nostr/tools";
import { log } from "../log.ts"; import { log } from "../log.ts";
import { lookupPubkeyByUsername } from "../ldap.ts"; import { lookupPubkeyByUsername } from "../ldap.ts";
import { fetchArticlesByAuthor, fetchProfileEvent } from "../nostr.ts"; import { fetchArticlesByAuthor, fetchProfileEvent } from "../nostr.ts";
import { profilePageHtml } from "../html.ts"; import { profilePageHtml } from "../html.ts";
const usernameHandler = async function (ctx: Context) { const usernameHandler = async function (ctx: Context) {
const { request } = ctx;
const username = ctx.params.path.replace(/^(@|~)/, ""); const username = ctx.params.path.replace(/^(@|~)/, "");
const pubkey = await lookupPubkeyByUsername(username); const pubkey = await lookupPubkeyByUsername(username);

View File

@ -1,6 +1,5 @@
import { render as renderMarkdown } from "@deno/gfm"; import { render as renderMarkdown } from "@deno/gfm";
import { nip19 } from "@nostr/tools"; import { nip19 } from "@nostr/tools";
import { log } from "./log.ts";
export function htmlLayout(title: string, body: string) { export function htmlLayout(title: string, body: string) {
return ` return `
@ -164,7 +163,7 @@ function articleListItemHtml(articleEvent: object) {
const naddr = nip19.naddrEncode({ const naddr = nip19.naddrEncode({
identifier: identifier, identifier: identifier,
pubkey: articleEvent.pubkey, pubkey: articleEvent.pubkey,
kind: articleEvent.kind kind: articleEvent.kind,
}); });
const titleTag = articleEvent.tags.find((t) => t[0] === "title"); const titleTag = articleEvent.tags.find((t) => t[0] === "title");
const title = titleTag ? titleTag[1] : "Untitled"; const title = titleTag ? titleTag[1] : "Untitled";

View File

@ -30,8 +30,9 @@ export async function lookupPubkeyByUsername(username: string) {
log(ex, "red"); log(ex, "red");
} finally { } finally {
await client.unbind(); await client.unbind();
return pubkey;
} }
return pubkey;
} }
export async function lookupUsernameByPubkey(pubkey: string) { export async function lookupUsernameByPubkey(pubkey: string) {
@ -50,6 +51,7 @@ export async function lookupUsernameByPubkey(pubkey: string) {
log(ex, "red"); log(ex, "red");
} finally { } finally {
await client.unbind(); await client.unbind();
}
return username; return username;
} }
}

View File

@ -1,6 +0,0 @@
import { assertEquals } from "@std/assert";
// import { add } from "./main.ts";
// Deno.test(function addTest() {
// assertEquals(add(2, 3), 5);
// });