feat: add Apple App Store metadata and improve server logging

- Added meta tags for Apple App Store integration in both desktop and SSR index HTML files.
- Enhanced server logging to display the server's IP address when running outside of Vercel.
- Introduced a constant for the Apple App Store ID to streamline future updates.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2025-04-30 22:37:42 +08:00
parent 571a991dd4
commit 0e069ecdd7
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
7 changed files with 36 additions and 6 deletions

View File

@ -18,7 +18,7 @@
<link rel="apple-touch-icon" href="/apple-touch-icon-180x180.png" />
<title>Folo</title>
<meta name="apple-itunes-app" content="app-id=6739802604" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Folo" />
<meta property="og:url" content="https://app.follow.is" />

View File

@ -1,4 +1,5 @@
import type { GetHydrateData } from "@client/lib/helper"
import { APPLE_APP_STORE_ID } from "@follow/constants"
import { defineMetadata } from "~/meta-handler"
@ -29,6 +30,11 @@ const meta = defineMetadata(async ({ params, apiClient, origin, throwError }) =>
path: apiClient.feeds.$url({ query: { id: feedId } }).pathname,
key: `feeds.$get,query:id=${feedId}`,
},
{
type: "meta",
property: "apple-itunes-app",
content: `app-id=${APPLE_APP_STORE_ID}, app-argument:follow://add?id=${feedId}&type=feed`,
},
] as const
})

View File

@ -17,6 +17,7 @@
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<title>Folo</title>
<meta name="apple-itunes-app" content="app-id=6739802604" />
<link rel="manifest" href="/manifest.json" />
<script>

View File

@ -83,7 +83,22 @@ export const createApp = async () => {
if (!isVercel) {
createApp().then(async (app) => {
await app.listen({ port: 2234 })
await app.listen({ port: 2234, host: "0.0.0.0" })
console.info("Server is running on http://localhost:2234")
const ip = getIPAddress()
if (ip) console.info(`Server is running on http://${ip}:2234`)
})
}
function getIPAddress() {
const interfaces = require("node:os").networkInterfaces()
for (const devName in interfaces) {
const iface = interfaces[devName]
for (const alias of iface) {
if (alias.family === "IPv4" && alias.address !== "127.0.0.1" && !alias.internal)
return alias.address
}
}
return "0.0.0.0"
}

View File

@ -135,10 +135,16 @@ async function injectMetaToTemplate(document: Document, req: FastifyRequest, res
break
}
case "meta": {
const $meta = document.createElement("meta")
$meta.setAttribute("property", meta.property)
$meta.setAttribute("content", xss(meta.content))
document.head.append($meta)
// Find Old Meta
const $oldMeta = document.querySelector(`meta[name="${meta.property}"]`)
if ($oldMeta) {
$oldMeta.setAttribute("content", xss(meta.content))
} else {
const $meta = document.createElement("meta")
$meta.setAttribute("name", meta.property)
$meta.setAttribute("content", xss(meta.content))
document.head.append($meta)
}
break
}
case "title": {

View File

@ -0,0 +1 @@
export const APPLE_APP_STORE_ID = "6739802604"

View File

@ -1,3 +1,4 @@
export * from "./app"
export * from "./auth-providers"
export * from "./enums"
export * from "./rsshub"