Change mentions regex to support punycode

This commit is contained in:
Crimekillz 2024-05-02 03:01:44 +02:00
parent 295e15205e
commit 16e0cc9471
2 changed files with 3 additions and 2 deletions

View File

@ -96,6 +96,7 @@ import XModalWindow from "@/components/MkModalWindow.vue";
import * as os from "@/os"; import * as os from "@/os";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { toASCII } from "punycode/";
const emit = defineEmits<{ const emit = defineEmits<{
(ev: "ok", selected: misskey.entities.UserDetailed): void; (ev: "ok", selected: misskey.entities.UserDetailed): void;
@ -117,7 +118,7 @@ const search = () => {
} }
os.api("users/search-by-username-and-host", { os.api("users/search-by-username-and-host", {
username: username, username: username,
host: host, host: toASCII(host),
limit: 10, limit: 10,
detail: false, detail: false,
}).then((_users) => { }).then((_users) => {

View File

@ -3,7 +3,7 @@ import getCaretCoordinates from "textarea-caret";
import { toASCII } from "punycode/"; import { toASCII } from "punycode/";
import { popup } from "@/os"; import { popup } from "@/os";
const mentionRegex = /@(?<user>[a-zA-Z0-9_]+|$)@?(?<host>[a-zA-Z0-9-.]+)?$/g; const mentionRegex = /@(?<user>[a-zA-Z0-9_]+|$)@?(?<host>[\S]+)?$/g;
export class Autocomplete { export class Autocomplete {
private suggestion: { private suggestion: {