mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-28 06:48:36 +09:00
enhance(frontend): 外部サイトへのリンクは移動の前に警告を表示するように (MisskeyIO#558)
(cherry picked from commit 01ec286f3f479d030bd4a59ab666b513b1175bca)
This commit is contained in:
parent
c9c6424205
commit
bf37e95e57
8
locales/index.d.ts
vendored
8
locales/index.d.ts
vendored
@ -4812,6 +4812,14 @@ export interface Locale extends ILocale {
|
||||
* リアクションする
|
||||
*/
|
||||
"doReaction": string;
|
||||
/**
|
||||
* よく知られたウェブサイト
|
||||
*/
|
||||
"wellKnownWebsites": string;
|
||||
/**
|
||||
* スペースで区切るとAND指定になり、改行で区切るとOR指定になります。スラッシュで囲むと正規表現になります。一致した場合、外部サイトへのリダイレクトの警告を省略させることができます。
|
||||
*/
|
||||
"wellKnownWebsitesDescription": string;
|
||||
/**
|
||||
* コード
|
||||
*/
|
||||
|
@ -1199,6 +1199,8 @@ useGroupedNotifications: "通知をグルーピングして表示する"
|
||||
signupPendingError: "メールアドレスの確認中に問題が発生しました。リンクの有効期限が切れている可能性があります。"
|
||||
cwNotationRequired: "「内容を隠す」がオンの場合は注釈の記述が必要です。"
|
||||
doReaction: "リアクションする"
|
||||
wellKnownWebsites: "よく知られたウェブサイト"
|
||||
wellKnownWebsitesDescription: "スペースで区切るとAND指定になり、改行で区切るとOR指定になります。スラッシュで囲むと正規表現になります。一致した場合、外部サイトへのリダイレクトの警告を省略させることができます。"
|
||||
code: "コード"
|
||||
reloadRequiredToApplySettings: "設定の反映にはリロードが必要です。"
|
||||
remainingN: "残り: {n}"
|
||||
|
@ -0,0 +1,11 @@
|
||||
export class ExternalWebsiteWarn1711008460816 {
|
||||
name = 'ExternalWebsiteWarn1711008460816'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" ADD "wellKnownWebsites" character varying(3072) array NOT NULL DEFAULT '{}'`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "wellKnownWebsites"`);
|
||||
}
|
||||
}
|
@ -100,6 +100,7 @@ export class MetaEntityService {
|
||||
imageUrl: ad.imageUrl,
|
||||
dayOfWeek: ad.dayOfWeek,
|
||||
})),
|
||||
wellKnownWebsites: instance.wellKnownWebsites,
|
||||
notesPerOneAd: instance.notesPerOneAd,
|
||||
enableEmail: instance.enableEmail,
|
||||
enableServiceWorker: instance.enableServiceWorker,
|
||||
|
@ -603,6 +603,11 @@ export class MiMeta {
|
||||
})
|
||||
public urlPreviewRequireContentLength: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 3072, array: true, default: '{}',
|
||||
})
|
||||
public wellKnownWebsites: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
|
@ -186,6 +186,14 @@ export const packedMetaLiteSchema = {
|
||||
},
|
||||
},
|
||||
},
|
||||
wellKnownWebsites: {
|
||||
type: 'array',
|
||||
optional: false, nullable: false,
|
||||
items: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
notesPerOneAd: {
|
||||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
|
@ -371,6 +371,14 @@ export const meta = {
|
||||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
wellKnownWebsites: {
|
||||
type: 'array',
|
||||
optional: false, nullable: false,
|
||||
items: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
backgroundImageUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
@ -601,6 +609,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
perRemoteUserUserTimelineCacheMax: instance.perRemoteUserUserTimelineCacheMax,
|
||||
perUserHomeTimelineCacheMax: instance.perUserHomeTimelineCacheMax,
|
||||
perUserListTimelineCacheMax: instance.perUserListTimelineCacheMax,
|
||||
wellKnownWebsites: instance.wellKnownWebsites,
|
||||
notesPerOneAd: instance.notesPerOneAd,
|
||||
summalyProxy: instance.urlPreviewSummaryProxyUrl,
|
||||
urlPreviewEnabled: instance.urlPreviewEnabled,
|
||||
|
@ -153,6 +153,11 @@ export const paramDef = {
|
||||
type: 'string', nullable: true,
|
||||
description: '[Deprecated] Use "urlPreviewSummaryProxyUrl" instead.',
|
||||
},
|
||||
wellKnownWebsites: {
|
||||
type: 'array', nullable: true, items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
urlPreviewEnabled: { type: 'boolean' },
|
||||
urlPreviewTimeout: { type: 'integer' },
|
||||
urlPreviewMaximumContentLength: { type: 'integer' },
|
||||
@ -202,6 +207,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
return h !== '' && h !== lv && !set.blockedHosts?.includes(h);
|
||||
});
|
||||
}
|
||||
|
||||
if (Array.isArray(ps.wellKnownWebsites)) {
|
||||
set.wellKnownWebsites = ps.wellKnownWebsites.filter(Boolean);
|
||||
}
|
||||
|
||||
if (ps.themeColor !== undefined) {
|
||||
set.themeColor = ps.themeColor;
|
||||
}
|
||||
|
@ -45,6 +45,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template #caption>{{ i18n.ts.prohibitedWordsDescription }}<br>{{ i18n.ts.prohibitedWordsDescription2 }}</template>
|
||||
</MkTextarea>
|
||||
|
||||
<MkTextarea v-model="wellKnownWebsites">
|
||||
<template #label>{{ i18n.ts.wellKnownWebsites }}</template>
|
||||
<template #caption>{{ i18n.ts.wellKnownWebsitesDescription }}</template>
|
||||
</MkTextarea>
|
||||
|
||||
<MkTextarea v-model="hiddenTags">
|
||||
<template #label>{{ i18n.ts.hiddenTags }}</template>
|
||||
<template #caption>{{ i18n.ts.hiddenTagsDescription }}</template>
|
||||
@ -86,6 +91,7 @@ const hiddenTags = ref<string>('');
|
||||
const preservedUsernames = ref<string>('');
|
||||
const tosUrl = ref<string | null>(null);
|
||||
const privacyPolicyUrl = ref<string | null>(null);
|
||||
const wellKnownWebsites = ref<string>('');
|
||||
|
||||
async function init() {
|
||||
const meta = await misskeyApi('admin/meta');
|
||||
@ -97,6 +103,7 @@ async function init() {
|
||||
preservedUsernames.value = meta.preservedUsernames.join('\n');
|
||||
tosUrl.value = meta.tosUrl;
|
||||
privacyPolicyUrl.value = meta.privacyPolicyUrl;
|
||||
wellKnownWebsites.value = meta.wellKnownWebsites.join('\n');
|
||||
}
|
||||
|
||||
function save() {
|
||||
@ -109,6 +116,7 @@ function save() {
|
||||
prohibitedWords: prohibitedWords.value.split('\n'),
|
||||
hiddenTags: hiddenTags.value.split('\n'),
|
||||
preservedUsernames: preservedUsernames.value.split('\n'),
|
||||
wellKnownWebsites: wellKnownWebsites.value.split('\n'),
|
||||
}).then(() => {
|
||||
fetchInstance(true);
|
||||
});
|
||||
|
@ -4804,6 +4804,7 @@ export type components = {
|
||||
imageUrl: string;
|
||||
dayOfWeek: number;
|
||||
}[];
|
||||
wellKnownWebsites: string[];
|
||||
/** @default 0 */
|
||||
notesPerOneAd: number;
|
||||
enableEmail: boolean;
|
||||
@ -4948,6 +4949,7 @@ export type operations = {
|
||||
perUserHomeTimelineCacheMax: number;
|
||||
perUserListTimelineCacheMax: number;
|
||||
notesPerOneAd: number;
|
||||
wellKnownWebsites: string[];
|
||||
backgroundImageUrl: string | null;
|
||||
deeplAuthKey: string | null;
|
||||
deeplIsPro: boolean;
|
||||
@ -8928,6 +8930,7 @@ export type operations = {
|
||||
silencedHosts?: string[] | null;
|
||||
/** @description [Deprecated] Use "urlPreviewSummaryProxyUrl" instead. */
|
||||
summalyProxy?: string | null;
|
||||
wellKnownWebsites?: string[] | null;
|
||||
urlPreviewEnabled?: boolean;
|
||||
urlPreviewTimeout?: number;
|
||||
urlPreviewMaximumContentLength?: number;
|
||||
|
Loading…
Reference in New Issue
Block a user