feat: カスタム絵文字ごとにそれをリアクションとして使えるロールを設定できるように

This commit is contained in:
syuilo
2023-05-18 18:45:49 +09:00
parent 9b5b3a4d1b
commit 7ce569424a
17 changed files with 376 additions and 115 deletions

View File

@@ -16,6 +16,9 @@ type IWebFinger = {
subject: string;
};
const urlRegex = /^https?:\/\//;
const mRegex = /^([^@]+)@(.*)/;
@Injectable()
export class WebfingerService {
constructor(
@@ -35,12 +38,12 @@ export class WebfingerService {
@bindThis
private genUrl(query: string): string {
if (query.match(/^https?:\/\//)) {
if (query.match(urlRegex)) {
const u = new URL(query);
return `${u.protocol}//${u.hostname}/.well-known/webfinger?` + urlQuery({ resource: query });
}
const m = query.match(/^([^@]+)@(.*)/);
const m = query.match(mRegex);
if (m) {
const hostname = m[2];
const useHttp = process.env.MISSKEY_WEBFINGER_USE_HTTP && process.env.MISSKEY_WEBFINGER_USE_HTTP.toLowerCase() === 'true';