update to v0.9.1.

add npm package link
prep for jsr support (I hope)
add favicon
update installation instructions
This commit is contained in:
2026-02-23 00:27:59 -05:00
parent 9dbf7ae796
commit 475fcf6331
36 changed files with 208 additions and 162 deletions

View File

@@ -1,8 +1,9 @@
import dayjs from "dayjs";
import parseTwtxt from "./parseTwtxt.js";
import type { Twtxt } from "./types.ts";
export default async function loadAndParseTwtxtFile(url = "") {
export default async function loadAndParseTwtxtFile(url = ""): Promise<Twtxt> {
if (!url) throw new Error("URL is required");
try {

View File

@@ -1,7 +1,7 @@
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc.js";
import type { Metadata, Twttr } from "./types.ts";
import type { Metadata, Twttr, Twtxt } from "./types.ts";
import hashTwt from "./hashTwt.js";
import { getValueOrFirstEntry } from "./utils.ts";
@@ -12,7 +12,7 @@ dayjs.extend(utc);
* @param twtxt
* @returns object containing: following, metadata, twts
*/
export default function parseTwtxt(twtxt: string) {
export default function parseTwtxt(twtxt: string): Twtxt {
const allLines = twtxt.split("\n");
const { commentLines = [], contentLines = [] } = allLines.reduce(

View File

@@ -30,6 +30,7 @@ export interface Twttr {
export interface Twtxt {
following: Twttr[];
lastModified?: string;
metadata: Metadata;
twts: Twt[];
}

View File

@@ -1,6 +1,8 @@
import base32 from "base32.js";
export const base32Encode = (payload: string | Uint8Array<ArrayBufferLike>) => {
export const base32Encode = (
payload: string | Uint8Array<ArrayBufferLike>,
): string => {
const encoder = new base32.Encoder({ type: "rfc4648" });
return encoder.write(payload).finalize();
};