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:
@@ -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 {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -30,6 +30,7 @@ export interface Twttr {
|
||||
|
||||
export interface Twtxt {
|
||||
following: Twttr[];
|
||||
lastModified?: string;
|
||||
metadata: Metadata;
|
||||
twts: Twt[];
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user