summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts/url.ts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-07-14 15:27:52 +0900
committerGitHub <noreply@github.com>2024-07-14 15:27:52 +0900
commit3c032dd5b917c97bf8fb1b87a69f36d56537f493 (patch)
treedacd9e664ed11cc77a351a81d48c52c6f7116c61 /packages/frontend/src/scripts/url.ts
parentenhance(frontend): サーバー情報・お問い合わせページを改修 ... (diff)
downloadsharkey-3c032dd5b917c97bf8fb1b87a69f36d56537f493.tar.gz
sharkey-3c032dd5b917c97bf8fb1b87a69f36d56537f493.tar.bz2
sharkey-3c032dd5b917c97bf8fb1b87a69f36d56537f493.zip
enhance: 非ログイン時には別サーバーに遷移できるように (#13089)
* enhance: 非ログイン時にはMisskey Hub経由で別サーバーに遷移できるように * fix * サーバーサイド照会を削除 * クライアント側の照会動作 * hubを経由せずにリモートで続行できるように * fix と pleaseLogin誘導箇所の追加 * fix * fix * Update CHANGELOG.md --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/scripts/url.ts')
-rw-r--r--packages/frontend/src/scripts/url.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/frontend/src/scripts/url.ts b/packages/frontend/src/scripts/url.ts
index e3072b3b7d..c477fb5506 100644
--- a/packages/frontend/src/scripts/url.ts
+++ b/packages/frontend/src/scripts/url.ts
@@ -21,3 +21,8 @@ export function query(obj: Record<string, any>): string {
export function appendQuery(url: string, query: string): string {
return `${url}${/\?/.test(url) ? url.endsWith('?') ? '' : '&' : '?'}${query}`;
}
+
+export function extractDomain(url: string) {
+ const match = url.match(/^(https)?:?\/{0,2}([^\/]+)/);
+ return match ? match[2] : null;
+}