refactor: replace pinyin with pinyin-pro

This commit is contained in:
DIYgod
2023-05-08 23:49:48 +01:00
parent b1d097b786
commit 9af342cb26
5 changed files with 42 additions and 413 deletions
+18
View File
@@ -1,3 +1,4 @@
import { getDefaultSlug } from "~/lib/default-slug"
import { NextServerResponse, getQuery } from "~/lib/server-helper"
export async function GET(req: Request) {
@@ -17,5 +18,22 @@ export async function GET(req: Request) {
})
).json()
if (result.data?.projectFeed?.posts?.length) {
result.data.projectFeed.posts = result.data.projectFeed.posts.map(
(post: any) => {
return {
title: post.title,
date_published: new Date(
post.publishedAtTimestamp * 1000,
).toISOString(),
slug: getDefaultSlug(post.title, post.digest),
tags: ["Mirror.xyz"],
content: post.body,
external_urls: [`https://mirror.xyz/${address}/${post.digest}`],
}
},
)
}
return new NextServerResponse().status(200).json(result)
}