fix(frontend): follow-up of #13089 (#14206)

* fix(frontend): #13089 を修正

* fix

* 正規表現を強化

* fix
This commit is contained in:
かっこかり 2024-07-14 17:28:34 +09:00 committed by GitHub
parent 09d30fef5b
commit 722acf5986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 56 additions and 28 deletions

View file

@ -9,13 +9,38 @@ import { i18n } from '@/i18n.js';
import { popup } from '@/os.js';
export type OpenOnRemoteOptions = {
/**
* Misskey Webで特定のパスを開く
*/
type: 'web';
/**
* : `/settings`
*/
path: string;
} | {
/**
* Misskey Webで照会する
*/
type: 'lookup';
path: string;
/**
* URL
*
* : `https://misskey.example.com/notes/abcdexxxxyz`
*/
url: string;
} | {
/**
* Misskeyでートする
*/
type: 'share';
/**
* `/share`
*
* @see https://go.misskey-hub.net/spec/share/
*/
params: Record<string, string>;
};

View file

@ -23,6 +23,6 @@ export function appendQuery(url: string, query: string): string {
}
export function extractDomain(url: string) {
const match = url.match(/^(https)?:?\/{0,2}([^\/]+)/);
return match ? match[2] : null;
const match = url.match(/^(?:https?:)?(?:\/\/)?(?:[^@\n]+@)?([^:\/\n]+)/im);
return match ? match[1] : null;
}