Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

プライバシーポリシー・運営者情報のリンクを追加 #11925

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

-->

## 2023.x.x (unreleased)
### General
- Feat: プライバシーポリシー・運営者情報(Impressum)の指定が可能になりました
- プライバシーポリシーはサーバー登録時に同意確認が入ります

## 2023.9.3
### General
- Enhance: ノートの翻訳機能の利用可否をロールで設定可能に
Expand Down
6 changes: 6 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,12 @@ export interface Locale {
"notificationRecieveConfig": string;
"mutualFollow": string;
"fileAttachedOnly": string;
"impressum": string;
"impressumUrl": string;
"impressumDescription": string;
"privacyPolicy": string;
"privacyPolicyUrl": string;
"tosAndPrivacyPolicy": string;
"_announcement": {
"forExistingUsers": string;
"forExistingUsersDescription": string;
Expand Down
6 changes: 6 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,12 @@ edited: "編集済み"
notificationRecieveConfig: "通知の受信設定"
mutualFollow: "相互フォロー"
fileAttachedOnly: "ファイル付きのみ"
impressum: "運営者情報"
impressumUrl: "運営者情報URL"
impressumDescription: "ドイツなどの一部の国と地域では表示が義務付けられています(Impressum)。"
privacyPolicy: "プライバシーポリシー"
privacyPolicyUrl: "プライバシーポリシーURL"
tosAndPrivacyPolicy: "利用規約・プライバシーポリシー"

_announcement:
forExistingUsers: "既存ユーザーのみ"
Expand Down
15 changes: 15 additions & 0 deletions packages/backend/migration/1696003580220-AddSomeUrls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class AddSomeUrls1696003580220 {
kakkokari-gtyih marked this conversation as resolved.
Show resolved Hide resolved
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ADD "impressumUrl" character varying(1024)`);
await queryRunner.query(`ALTER TABLE "meta" ADD "privacyPolicyUrl" character varying(1024)`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "impressumUrl"`);
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "privacyPolicyUrl"`);
}
}
12 changes: 12 additions & 0 deletions packages/backend/src/models/Meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,18 @@ export class MiMeta {
})
public feedbackUrl: string | null;

@Column('varchar', {
length: 1024,
nullable: true,
})
public impressumUrl: string | null;

@Column('varchar', {
length: 1024,
nullable: true,
})
public privacyPolicyUrl: string | null;

@Column('varchar', {
length: 8192,
nullable: true,
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
tosUrl: instance.termsOfServiceUrl,
repositoryUrl: instance.repositoryUrl,
feedbackUrl: instance.feedbackUrl,
impressumUrl: instance.impressumUrl,
privacyPolicyUrl: instance.privacyPolicyUrl,
disableRegistration: instance.disableRegistration,
emailRequiredForSignup: instance.emailRequiredForSignup,
enableHcaptcha: instance.enableHcaptcha,
Expand Down
10 changes: 10 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/update-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export const paramDef = {
tosUrl: { type: 'string', nullable: true },
repositoryUrl: { type: 'string' },
feedbackUrl: { type: 'string' },
impressumUrl: { type: 'string' },
privacyPolicyUrl: { type: 'string' },
useObjectStorage: { type: 'boolean' },
objectStorageBaseUrl: { type: 'string', nullable: true },
objectStorageBucket: { type: 'string', nullable: true },
Expand Down Expand Up @@ -341,6 +343,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
set.feedbackUrl = ps.feedbackUrl;
}

if (ps.impressumUrl !== undefined) {
set.impressumUrl = ps.impressumUrl;
}

if (ps.privacyPolicyUrl !== undefined) {
set.privacyPolicyUrl = ps.privacyPolicyUrl;
}

if (ps.useObjectStorage !== undefined) {
set.useObjectStorage = ps.useObjectStorage;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
tosUrl: instance.termsOfServiceUrl,
repositoryUrl: instance.repositoryUrl,
feedbackUrl: instance.feedbackUrl,
impressumUrl: instance.impressumUrl,
privacyPolicyUrl: instance.privacyPolicyUrl,
disableRegistration: instance.disableRegistration,
emailRequiredForSignup: instance.emailRequiredForSignup,
enableHcaptcha: instance.enableHcaptcha,
Expand Down
45 changes: 31 additions & 14 deletions packages/frontend/src/components/MkSignupDialog.rules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch :modelValue="agreeServerRules" style="margin-top: 16px;" @update:modelValue="updateAgreeServerRules">{{ i18n.ts.agree }}</MkSwitch>
</MkFolder>

<MkFolder v-if="availableTos" :defaultOpen="true">
<template #label>{{ i18n.ts.termsOfService }}</template>
<template #suffix><i v-if="agreeTos" class="ti ti-check" style="color: var(--success)"></i></template>

<a :href="instance.tosUrl" class="_link" target="_blank">{{ i18n.ts.termsOfService }} <i class="ti ti-external-link"></i></a>

<MkSwitch :modelValue="agreeTos" style="margin-top: 16px;" @update:modelValue="updateAgreeTos">{{ i18n.ts.agree }}</MkSwitch>
<MkFolder v-if="availableTos || availablePrivacyPolicy" :defaultOpen="true">
<template #label>{{ tosPrivacyPolicyLabel }}</template>
<template #suffix><i v-if="agreeTosAndPrivacyPolicy" class="ti ti-check" style="color: var(--success)"></i></template>
<div class="_gaps_s">
<div v-if="availableTos"><a :href="instance.tosUrl" class="_link" target="_blank">{{ i18n.ts.termsOfService }} <i class="ti ti-external-link"></i></a></div>
<div v-if="availablePrivacyPolicy"><a :href="instance.privacyPolicyUrl" class="_link" target="_blank">{{ i18n.ts.privacyPolicy }} <i class="ti ti-external-link"></i></a></div>
</div>

<MkSwitch :modelValue="agreeTosAndPrivacyPolicy" style="margin-top: 16px;" @update:modelValue="updateAgreeTosAndPrivacyPolicy">{{ i18n.ts.agree }}</MkSwitch>
</MkFolder>

<MkFolder :defaultOpen="true">
Expand Down Expand Up @@ -70,21 +72,34 @@ import MkInfo from '@/components/MkInfo.vue';
import * as os from '@/os.js';

const availableServerRules = instance.serverRules.length > 0;
const availableTos = instance.tosUrl != null;
const availableTos = instance.tosUrl != null && instance.tosUrl !== '';
const availablePrivacyPolicy = instance.privacyPolicyUrl != null && instance.privacyPolicyUrl !== '';

const agreeServerRules = ref(false);
const agreeTos = ref(false);
const agreeTosAndPrivacyPolicy = ref(false);
const agreeNote = ref(false);

const agreed = computed(() => {
return (!availableServerRules || agreeServerRules.value) && (!availableTos || agreeTos.value) && agreeNote.value;
return (!availableServerRules || agreeServerRules.value) && ((!availableTos && !availablePrivacyPolicy) || agreeTosAndPrivacyPolicy.value) && agreeNote.value;
});

const emit = defineEmits<{
(ev: 'cancel'): void;
(ev: 'done'): void;
}>();

const tosPrivacyPolicyLabel = computed(() => {
if (availableTos && availablePrivacyPolicy) {
return i18n.ts.tosAndPrivacyPolicy;
} else if (availableTos) {
return i18n.ts.termsOfService;
} else if (availablePrivacyPolicy) {
return i18n.ts.privacyPolicy;
} else {
return "";
}
});

async function updateAgreeServerRules(v: boolean) {
if (v) {
const confirm = await os.confirm({
Expand All @@ -99,17 +114,19 @@ async function updateAgreeServerRules(v: boolean) {
}
}

async function updateAgreeTos(v: boolean) {
async function updateAgreeTosAndPrivacyPolicy(v: boolean) {
if (v) {
const confirm = await os.confirm({
type: 'question',
title: i18n.ts.doYouAgree,
text: i18n.t('iHaveReadXCarefullyAndAgree', { x: i18n.ts.termsOfService }),
text: i18n.t('iHaveReadXCarefullyAndAgree', {
x: tosPrivacyPolicyLabel.value,
}),
});
if (confirm.canceled) return;
agreeTos.value = true;
agreeTosAndPrivacyPolicy.value = true;
} else {
agreeTos.value = false;
agreeTosAndPrivacyPolicy.value = false;
}
}

Expand Down
20 changes: 19 additions & 1 deletion packages/frontend/src/components/MkVisitorDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,25 @@ function showMenu(ev) {
action: () => {
os.pageWindow('/about-misskey');
},
}, null, {
}, null, (instance.impressumUrl) ? {
text: i18n.ts.impressum,
icon: 'ti ti-file-invoice',
action: () => {
window.open(instance.impressumUrl, '_blank');
},
} : undefined, (instance.tosUrl) ? {
text: i18n.ts.termsOfService,
icon: 'ti ti-notebook',
action: () => {
window.open(instance.tosUrl, '_blank');
},
} : undefined, (instance.privacyPolicyUrl) ? {
text: i18n.ts.privacyPolicy,
icon: 'ti ti-shield-lock',
action: () => {
window.open(instance.privacyPolicyUrl, '_blank');
},
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : null, {
text: i18n.ts.help,
icon: 'ti ti-help-circle',
action: () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/src/pages/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<li v-for="item in instance.serverRules" :class="$style.rule"><div :class="$style.ruleText" v-html="item"></div></li>
</ol>
</MkFolder>
<FormLink v-if="instance.impressumUrl" :to="instance.impressumUrl" external>{{ i18n.ts.impressum }}</FormLink>
<FormLink v-if="instance.tosUrl" :to="instance.tosUrl" external>{{ i18n.ts.termsOfService }}</FormLink>
<FormLink v-if="instance.privacyPolicyUrl" :to="instance.privacyPolicyUrl" external>{{ i18n.ts.privacyPolicy }}</FormLink>
</div>
</FormSection>

Expand Down
8 changes: 8 additions & 0 deletions packages/frontend/src/pages/admin/moderation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.tosUrl }}</template>
</MkInput>

<MkInput v-model="privacyPolicyUrl">
<template #prefix><i class="ti ti-link"></i></template>
<template #label>{{ i18n.ts.privacyPolicyUrl }}</template>
</MkInput>

<MkTextarea v-model="preservedUsernames">
<template #label>{{ i18n.ts.preservedUsernames }}</template>
<template #caption>{{ i18n.ts.preservedUsernamesDescription }}</template>
Expand Down Expand Up @@ -69,6 +74,7 @@ let emailRequiredForSignup: boolean = $ref(false);
let sensitiveWords: string = $ref('');
let preservedUsernames: string = $ref('');
let tosUrl: string | null = $ref(null);
let privacyPolicyUrl: string | null = $ref(null);

async function init() {
const meta = await os.api('admin/meta');
Expand All @@ -77,13 +83,15 @@ async function init() {
sensitiveWords = meta.sensitiveWords.join('\n');
preservedUsernames = meta.preservedUsernames.join('\n');
tosUrl = meta.tosUrl;
privacyPolicyUrl = meta.privacyPolicyUrl;
}

function save() {
os.apiWithDialog('admin/update-meta', {
disableRegistration: !enableRegistration,
emailRequiredForSignup,
tosUrl,
privacyPolicyUrl,
sensitiveWords: sensitiveWords.split('\n'),
preservedUsernames: preservedUsernames.split('\n'),
}).then(() => {
Expand Down
9 changes: 9 additions & 0 deletions packages/frontend/src/pages/admin/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkInput>
</FormSplit>

<MkInput v-model="impressumUrl">
<template #label>{{ i18n.ts.impressumUrl }}</template>
<template #prefix><i class="ti ti-link"></i></template>
<template #caption>{{ i18n.ts.impressumDescription }}</template>
</MkInput>

<MkTextarea v-model="pinnedUsers">
<template #label>{{ i18n.ts.pinnedUsers }}</template>
<template #caption>{{ i18n.ts.pinnedUsersDescription }}</template>
Expand Down Expand Up @@ -127,6 +133,7 @@ let shortName: string | null = $ref(null);
let description: string | null = $ref(null);
let maintainerName: string | null = $ref(null);
let maintainerEmail: string | null = $ref(null);
let impressumUrl: string | null = $ref(null);
let pinnedUsers: string = $ref('');
let cacheRemoteFiles: boolean = $ref(false);
let cacheRemoteSensitiveFiles: boolean = $ref(false);
Expand All @@ -143,6 +150,7 @@ async function init(): Promise<void> {
description = meta.description;
maintainerName = meta.maintainerName;
maintainerEmail = meta.maintainerEmail;
impressumUrl = meta.impressumUrl;
pinnedUsers = meta.pinnedUsers.join('\n');
cacheRemoteFiles = meta.cacheRemoteFiles;
cacheRemoteSensitiveFiles = meta.cacheRemoteSensitiveFiles;
Expand All @@ -160,6 +168,7 @@ function save(): void {
description,
maintainerName,
maintainerEmail,
impressumUrl,
pinnedUsers: pinnedUsers.split('\n'),
cacheRemoteFiles,
cacheRemoteSensitiveFiles,
Expand Down
20 changes: 19 additions & 1 deletion packages/frontend/src/ui/_common_/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,25 @@ export function openInstanceMenu(ev: MouseEvent) {
text: i18n.ts.manageCustomEmojis,
icon: 'ti ti-icons',
} : undefined],
}, null, {
}, null, (instance.impressumUrl) ? {
text: i18n.ts.impressum,
icon: 'ti ti-file-invoice',
action: () => {
window.open(instance.impressumUrl, '_blank');
},
} : undefined, (instance.tosUrl) ? {
text: i18n.ts.termsOfService,
icon: 'ti ti-notebook',
action: () => {
window.open(instance.tosUrl, '_blank');
},
} : undefined, (instance.privacyPolicyUrl) ? {
text: i18n.ts.privacyPolicy,
icon: 'ti ti-shield-lock',
action: () => {
window.open(instance.privacyPolicyUrl, '_blank');
},
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : null, {
text: i18n.ts.help,
icon: 'ti ti-help-circle',
action: () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/misskey-js/etc/misskey-js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2412,6 +2412,8 @@ type LiteInstanceMetadata = {
tosUrl: string | null;
repositoryUrl: string;
feedbackUrl: string;
impressumUrl: string | null;
privacyPolicyUrl: string | null;
disableRegistration: boolean;
disableLocalTimeline: boolean;
disableGlobalTimeline: boolean;
Expand Down Expand Up @@ -2983,7 +2985,7 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
// src/api.types.ts:631:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/entities.ts:107:2 - (ae-forgotten-export) The symbol "notificationTypes_2" needs to be exported by the entry point index.d.ts
// src/entities.ts:595:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
// src/entities.ts:597:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
Expand Down
2 changes: 2 additions & 0 deletions packages/misskey-js/src/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ export type LiteInstanceMetadata = {
tosUrl: string | null;
repositoryUrl: string;
feedbackUrl: string;
impressumUrl: string | null;
privacyPolicyUrl: string | null;
disableRegistration: boolean;
disableLocalTimeline: boolean;
disableGlobalTimeline: boolean;
Expand Down
Loading