feat: support self-hosted umami (#520)
This commit is contained in:
parent
c294b1ac97
commit
f2b54c2994
|
|
@ -87,6 +87,7 @@
|
|||
"Description": "説明",
|
||||
"Integrate Google Analytics": "Google Analytics と紐付けします。Measurement ID の検索方法については、<2>こちらの文章</2>をご覧ください。",
|
||||
"Integrate Umami Cloud Analytics": "Umami Cloud Analytics と紐付けします。Website ID の検索方法については、<2>こちらの文章</2>をご覧ください。",
|
||||
"Integrate Umami Cloud Analytics (set url)": "空欄にして、<2>公式サービス</2>を使用してください。",
|
||||
"Save": "保存",
|
||||
"Tips": "ヒント",
|
||||
"social tips": {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@
|
|||
"Description": "自我介紹",
|
||||
"Integrate Google Analytics": "將 Google Analytics 整合至你的網站中。請按照<2>這裡</2>的說明查找你的 Measurement ID。",
|
||||
"Integrate Umami Cloud Analytics": "將 Umami Cloud Analytics 整合至你的網站中。請按照<2>這裡</2>的說明查找你的 Website ID。",
|
||||
"Integrate Umami Cloud Analytics (set url)": "留空以使用<2>官方服務</2>。",
|
||||
"Save": "儲存",
|
||||
"Tips": "提示",
|
||||
"social tips": {
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@
|
|||
"Description": "描述",
|
||||
"Integrate Google Analytics": "将 Google Analytics 集成到你的站点中。你可以按照<2>这里</2>的说明查找你的 Measurement ID。",
|
||||
"Integrate Umami Cloud Analytics": "将 Umami Cloud Analytics 集成到你的站点中。你可以按照<2>这里</2>的说明查找你的 Website ID。",
|
||||
"Integrate Umami Cloud Analytics (set url)": "留空以使用<2>官方服务</2>。",
|
||||
"Save": "保存",
|
||||
"Tips": "提示",
|
||||
"social tips": {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export default function SiteSettingsGeneralPage() {
|
|||
description: "",
|
||||
ga: "",
|
||||
ua: "",
|
||||
uh: "",
|
||||
} as {
|
||||
icon: string
|
||||
banner?: {
|
||||
|
|
@ -40,6 +41,7 @@ export default function SiteSettingsGeneralPage() {
|
|||
description: string
|
||||
ga: string
|
||||
ua: string
|
||||
uh: string
|
||||
},
|
||||
})
|
||||
|
||||
|
|
@ -52,6 +54,7 @@ export default function SiteSettingsGeneralPage() {
|
|||
description: values.description,
|
||||
ga: values.ga,
|
||||
ua: values.ua,
|
||||
uh: values.uh,
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -94,6 +97,8 @@ export default function SiteSettingsGeneralPage() {
|
|||
form.setValue("ga", site.data.metadata?.content?.ga || "")
|
||||
!form.getValues("ua") &&
|
||||
form.setValue("ua", site.data.metadata?.content?.ua || "")
|
||||
!form.getValues("uh") &&
|
||||
form.setValue("uh", site.data.metadata?.content?.uh || "")
|
||||
}
|
||||
}, [site.data, form])
|
||||
|
||||
|
|
@ -206,9 +211,31 @@ export default function SiteSettingsGeneralPage() {
|
|||
</div>
|
||||
<div className="mt-5">
|
||||
<Input
|
||||
id="ua"
|
||||
{...form.register("ua")}
|
||||
id="uh"
|
||||
{...form.register("uh")}
|
||||
prefix="https://"
|
||||
placeholder="analytics.umami.is"
|
||||
label="Umami Cloud Analytics"
|
||||
help={
|
||||
<p>
|
||||
<Trans
|
||||
i18nKey="Integrate Umami Cloud Analytics (set url)"
|
||||
ns="dashboard"
|
||||
>
|
||||
Leave blank to use{" "}
|
||||
<UniLink className="underline" href="https://umami.is/">
|
||||
the official service
|
||||
</UniLink>
|
||||
.
|
||||
</Trans>
|
||||
</p>
|
||||
}
|
||||
/>
|
||||
<Input
|
||||
id="ua"
|
||||
className="mt-2"
|
||||
{...form.register("ua")}
|
||||
placeholder="xxxxxxxx-xxxx-..."
|
||||
help={
|
||||
<p>
|
||||
<Trans
|
||||
|
|
|
|||
|
|
@ -113,7 +113,12 @@ export default async function SiteFooter({
|
|||
id="umami-analytics"
|
||||
strategy="afterInteractive"
|
||||
async
|
||||
src="https://analytics.umami.is/script.js"
|
||||
src={`https://analytics.umami.is`}
|
||||
data-host-url={
|
||||
site.metadata?.content?.uh
|
||||
? `https://${site.metadata?.content?.uh}`
|
||||
: null
|
||||
}
|
||||
data-website-id={`${site.metadata?.content?.ua}`}
|
||||
></Script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -110,6 +110,10 @@ export const expandCrossbellCharacter = (site: CharacterEntity) => {
|
|||
(expandedCharacter.metadata?.content?.attributes?.find(
|
||||
(a: any) => a.trait_type === "xlog_ua",
|
||||
)?.value as string) || ""
|
||||
expandedCharacter.metadata.content.uh =
|
||||
(expandedCharacter.metadata?.content?.attributes?.find(
|
||||
(a: any) => a.trait_type === "xlog_uh",
|
||||
)?.value as string) || ""
|
||||
expandedCharacter.metadata.content.custom_domain =
|
||||
(expandedCharacter.metadata?.content?.attributes?.find(
|
||||
(a: any) => a.trait_type === "xlog_custom_domain",
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@
|
|||
"Description": "説明",
|
||||
"Integrate Google Analytics": "Google Analytics と紐付けします。Measurement ID の検索方法については、<2>こちらの文章</2>をご覧ください。",
|
||||
"Integrate Umami Cloud Analytics": "Umami Cloud Analytics と紐付けします。Website ID の検索方法については、<2>こちらの文章</2>をご覧ください。",
|
||||
"Integrate Umami Cloud Analytics (set url)": "空欄にして、<2>公式サービス</2>を使用してください。",
|
||||
"Save": "保存",
|
||||
"Tips": "ヒント",
|
||||
"social tips": {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@
|
|||
"Description": "自我介紹",
|
||||
"Integrate Google Analytics": "將 Google Analytics 整合至你的網站中。請按照<2>這裡</2>的說明查找你的 Measurement ID。",
|
||||
"Integrate Umami Cloud Analytics": "將 Umami Cloud Analytics 整合至你的網站中。請按照<2>這裡</2>的說明查找你的 Website ID。",
|
||||
"Integrate Umami Cloud Analytics (set url)": "留空以使用<2>官方服務</2>。",
|
||||
"Save": "儲存",
|
||||
"Tips": "提示",
|
||||
"social tips": {
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@
|
|||
"Description": "描述",
|
||||
"Integrate Google Analytics": "将 Google Analytics 集成到你的站点中。你可以按照<2>这里</2>的说明查找你的 Measurement ID。",
|
||||
"Integrate Umami Cloud Analytics": "将 Umami Cloud Analytics 集成到你的站点中。你可以按照<2>这里</2>的说明查找你的 Website ID。",
|
||||
"Integrate Umami Cloud Analytics (set url)": "留空以使用<2>官方服务</2>。",
|
||||
"Save": "保存",
|
||||
"Tips": "提示",
|
||||
"social tips": {
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ export type ExpandedCharacter = CharacterEntity & {
|
|||
css?: string
|
||||
ga?: string
|
||||
ua?: string
|
||||
uh?: string
|
||||
custom_domain?: string
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ export async function updateSite(
|
|||
css?: string
|
||||
ga?: string
|
||||
ua?: string
|
||||
uh?: string
|
||||
custom_domain?: string
|
||||
banner?: {
|
||||
address: string
|
||||
|
|
@ -143,6 +144,7 @@ export async function updateSite(
|
|||
payload.css !== undefined ||
|
||||
payload.ga !== undefined ||
|
||||
payload.ua !== undefined ||
|
||||
payload.uh !== undefined ||
|
||||
payload.custom_domain !== undefined) && {
|
||||
attributes: [
|
||||
...(payload.navigation !== undefined
|
||||
|
|
@ -177,6 +179,14 @@ export async function updateSite(
|
|||
},
|
||||
]
|
||||
: []),
|
||||
...(payload.uh !== undefined
|
||||
? [
|
||||
{
|
||||
trait_type: "xlog_uh",
|
||||
value: payload.uh,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(payload.custom_domain !== undefined
|
||||
? [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue