From e2cac3d949b1b6d96c1c3a27278781c5a0829697 Mon Sep 17 00:00:00 2001 From: Nya Candy Date: Thu, 9 Nov 2023 20:21:39 +0800 Subject: [PATCH] fix: show real instance url (#12273) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update CHANGELOG.md * fix: show real instance url --------- Co-authored-by: tamaina Co-authored-by: syuilo Co-authored-by: atsuchan <83960488+atsu1125@users.noreply.github.com> Co-authored-by: Masaya Suzuki <15100604+massongit@users.noreply.github.com> Co-authored-by: Kagami Sascha Rosylight Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com> Co-authored-by: xianon Co-authored-by: kabo2468 <28654659+kabo2468@users.noreply.github.com> Co-authored-by: YS <47836716+yszkst@users.noreply.github.com> Co-authored-by: Khsmty Co-authored-by: Soni L Co-authored-by: mei23 Co-authored-by: daima3629 <52790780+daima3629@users.noreply.github.com> Co-authored-by: Windymelt <1113940+windymelt@users.noreply.github.com> Co-authored-by: Ebise Lutica <7106976+EbiseLutica@users.noreply.github.com> Co-authored-by: nenohi Co-authored-by: Acid Chicken (硫酸鶏) Co-authored-by: rinsuki <428rinsuki+git@gmail.com> Co-authored-by: FineArchs <133759614+FineArchs@users.noreply.github.com> --- packages/backend/src/server/web/ClientServerService.ts | 1 + packages/backend/src/server/web/views/base.pug | 1 + packages/frontend/src/config.ts | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index 7a2a52a982..3e35d5415e 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -175,6 +175,7 @@ export class ClientServerService { serverErrorImageUrl: meta.serverErrorImageUrl ?? 'https://xn--931a.moe/assets/error.jpg', infoImageUrl: meta.infoImageUrl ?? 'https://xn--931a.moe/assets/info.jpg', notFoundImageUrl: meta.notFoundImageUrl ?? 'https://xn--931a.moe/assets/not-found.jpg', + instanceUrl: this.config.url, }; } diff --git a/packages/backend/src/server/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index 9b6c671cad..2cb3fd4738 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -26,6 +26,7 @@ html meta(name='theme-color' content= themeColor || '#86b300') meta(name='theme-color-orig' content= themeColor || '#86b300') meta(property='og:site_name' content= instanceName || 'Misskey') + meta(property='instance_url' content= instanceUrl) meta(name='viewport' content='width=device-width, initial-scale=1') link(rel='icon' href= icon || '/favicon.ico') link(rel='apple-touch-icon' href= appleTouchIcon || '/apple-touch-icon.png') diff --git a/packages/frontend/src/config.ts b/packages/frontend/src/config.ts index 60fc8c9d34..9de29e80df 100644 --- a/packages/frontend/src/config.ts +++ b/packages/frontend/src/config.ts @@ -5,7 +5,7 @@ import { miLocalStorage } from '@/local-storage.js'; -const address = new URL(location.href); +const address = new URL(document.querySelector('meta[property="instance_url"]')?.content || location.href); const siteName = document.querySelector('meta[property="og:site_name"]')?.content; export const host = address.host;