wip
This commit is contained in:
parent
5aeedf59ff
commit
b78a58a2f0
|
@ -6380,6 +6380,10 @@ export interface Locale extends ILocale {
|
||||||
* 脆弱性などの理由で、サーバーのソフトウェアの名前及びバージョンの範囲を指定して配信を停止できます。このバージョン情報はサーバーが提供したものであり、信頼性は保証されません。バージョン指定には semver の範囲指定が使用できますが、>= 2024.3.1 と指定すると 2024.3.1-custom.0 のようなカスタムバージョンが含まれないため、>= 2024.3.1-0 のように prerelease の指定を行うことを推奨します。
|
* 脆弱性などの理由で、サーバーのソフトウェアの名前及びバージョンの範囲を指定して配信を停止できます。このバージョン情報はサーバーが提供したものであり、信頼性は保証されません。バージョン指定には semver の範囲指定が使用できますが、>= 2024.3.1 と指定すると 2024.3.1-custom.0 のようなカスタムバージョンが含まれないため、>= 2024.3.1-0 のように prerelease の指定を行うことを推奨します。
|
||||||
*/
|
*/
|
||||||
"deliverSuspendedSoftwareDescription": string;
|
"deliverSuspendedSoftwareDescription": string;
|
||||||
|
/**
|
||||||
|
* 非ログイン訪問者に対するユーザー作成コンテンツの公開範囲
|
||||||
|
*/
|
||||||
|
"visibleUserGeneratedContentsForNonLoggedInVisitors": string;
|
||||||
};
|
};
|
||||||
"_accountMigration": {
|
"_accountMigration": {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1621,6 +1621,7 @@ _serverSettings:
|
||||||
thisSettingWillAutomaticallyOffWhenModeratorsInactive: "一定期間モデレーターのアクティビティが検出されなかった場合、スパム防止のためこの設定は自動でオフになります。"
|
thisSettingWillAutomaticallyOffWhenModeratorsInactive: "一定期間モデレーターのアクティビティが検出されなかった場合、スパム防止のためこの設定は自動でオフになります。"
|
||||||
deliverSuspendedSoftware: "配信停止中のソフトウェア"
|
deliverSuspendedSoftware: "配信停止中のソフトウェア"
|
||||||
deliverSuspendedSoftwareDescription: "脆弱性などの理由で、サーバーのソフトウェアの名前及びバージョンの範囲を指定して配信を停止できます。このバージョン情報はサーバーが提供したものであり、信頼性は保証されません。バージョン指定には semver の範囲指定が使用できますが、>= 2024.3.1 と指定すると 2024.3.1-custom.0 のようなカスタムバージョンが含まれないため、>= 2024.3.1-0 のように prerelease の指定を行うことを推奨します。"
|
deliverSuspendedSoftwareDescription: "脆弱性などの理由で、サーバーのソフトウェアの名前及びバージョンの範囲を指定して配信を停止できます。このバージョン情報はサーバーが提供したものであり、信頼性は保証されません。バージョン指定には semver の範囲指定が使用できますが、>= 2024.3.1 と指定すると 2024.3.1-custom.0 のようなカスタムバージョンが含まれないため、>= 2024.3.1-0 のように prerelease の指定を行うことを推奨します。"
|
||||||
|
visibleUserGeneratedContentsForNonLoggedInVisitors: "非ログイン訪問者に対するユーザー作成コンテンツの公開範囲"
|
||||||
|
|
||||||
_accountMigration:
|
_accountMigration:
|
||||||
moveFrom: "別のアカウントからこのアカウントに移行"
|
moveFrom: "別のアカウントからこのアカウントに移行"
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
export class VisibleUserGeneratedContentsForNonLoggedInVisitors1746330901644 {
|
||||||
|
name = 'VisibleUserGeneratedContentsForNonLoggedInVisitors1746330901644'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" ADD "visibleUserGeneratedContentsForNonLoggedInVisitors" character varying(128) NOT NULL DEFAULT 'local'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "visibleUserGeneratedContentsForNonLoggedInVisitors"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -659,6 +659,12 @@ export class MiMeta {
|
||||||
})
|
})
|
||||||
public federationHosts: string[];
|
public federationHosts: string[];
|
||||||
|
|
||||||
|
@Column('varchar', {
|
||||||
|
length: 128,
|
||||||
|
default: 'local',
|
||||||
|
})
|
||||||
|
public visibleUserGeneratedContentsForNonLoggedInVisitors: 'all' | 'local' | 'none';
|
||||||
|
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
length: 64,
|
length: 64,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
|
@ -546,6 +546,11 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
visibleUserGeneratedContentsForNonLoggedInVisitors: {
|
||||||
|
type: 'string',
|
||||||
|
enum: ['all', 'local', 'none'],
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -691,6 +696,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
federation: instance.federation,
|
federation: instance.federation,
|
||||||
federationHosts: instance.federationHosts,
|
federationHosts: instance.federationHosts,
|
||||||
deliverSuspendedSoftware: instance.deliverSuspendedSoftware,
|
deliverSuspendedSoftware: instance.deliverSuspendedSoftware,
|
||||||
|
visibleUserGeneratedContentsForNonLoggedInVisitors: instance.visibleUserGeneratedContentsForNonLoggedInVisitors,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,6 +196,10 @@ export const paramDef = {
|
||||||
required: ['software', 'versionRange'],
|
required: ['software', 'versionRange'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
visibleUserGeneratedContentsForNonLoggedInVisitors: {
|
||||||
|
type: 'string',
|
||||||
|
enum: ['all', 'local', 'none'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
required: [],
|
required: [],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -690,6 +694,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
set.federationHosts = ps.federationHosts.filter(Boolean).map(x => x.toLowerCase());
|
set.federationHosts = ps.federationHosts.filter(Boolean).map(x => x.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ps.visibleUserGeneratedContentsForNonLoggedInVisitors !== undefined) {
|
||||||
|
set.visibleUserGeneratedContentsForNonLoggedInVisitors = ps.visibleUserGeneratedContentsForNonLoggedInVisitors;
|
||||||
|
}
|
||||||
|
|
||||||
const before = await this.metaService.fetch(true);
|
const before = await this.metaService.fetch(true);
|
||||||
|
|
||||||
await this.metaService.update(set);
|
await this.metaService.update(set);
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { GetterService } from '@/server/api/GetterService.js';
|
import { GetterService } from '@/server/api/GetterService.js';
|
||||||
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { MiMeta } from '@/models/Meta.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -46,6 +48,9 @@ export const paramDef = {
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||||
constructor(
|
constructor(
|
||||||
|
@Inject(DI.meta)
|
||||||
|
private serverSettings: MiMeta,
|
||||||
|
|
||||||
private noteEntityService: NoteEntityService,
|
private noteEntityService: NoteEntityService,
|
||||||
private getterService: GetterService,
|
private getterService: GetterService,
|
||||||
) {
|
) {
|
||||||
|
@ -59,6 +64,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.signinRequired);
|
throw new ApiError(meta.errors.signinRequired);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.serverSettings.visibleUserGeneratedContentsForNonLoggedInVisitors === 'none' && me == null) {
|
||||||
|
throw new ApiError(meta.errors.signinRequired);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.serverSettings.visibleUserGeneratedContentsForNonLoggedInVisitors === 'local' && note.userHost != null && me == null) {
|
||||||
|
throw new ApiError(meta.errors.signinRequired);
|
||||||
|
}
|
||||||
|
|
||||||
return await this.noteEntityService.pack(note, me, {
|
return await this.noteEntityService.pack(note, me, {
|
||||||
detail: true,
|
detail: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -513,7 +513,12 @@ export class ClientServerService {
|
||||||
|
|
||||||
vary(reply.raw, 'Accept');
|
vary(reply.raw, 'Accept');
|
||||||
|
|
||||||
if (user != null) {
|
if (
|
||||||
|
user != null && (
|
||||||
|
this.meta.visibleUserGeneratedContentsForNonLoggedInVisitors === 'all' ||
|
||||||
|
(this.meta.visibleUserGeneratedContentsForNonLoggedInVisitors === 'local' && user.host == null)
|
||||||
|
)
|
||||||
|
) {
|
||||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
||||||
const me = profile.fields
|
const me = profile.fields
|
||||||
? profile.fields
|
? profile.fields
|
||||||
|
@ -577,7 +582,13 @@ export class ClientServerService {
|
||||||
relations: ['user'],
|
relations: ['user'],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (note && !note.user!.requireSigninToViewContents) {
|
if (
|
||||||
|
note &&
|
||||||
|
!note.user!.requireSigninToViewContents &&
|
||||||
|
(this.meta.visibleUserGeneratedContentsForNonLoggedInVisitors === 'all' ||
|
||||||
|
(this.meta.visibleUserGeneratedContentsForNonLoggedInVisitors === 'local' && note.userHost == null)
|
||||||
|
)
|
||||||
|
) {
|
||||||
const _note = await this.noteEntityService.pack(note);
|
const _note = await this.noteEntityService.pack(note);
|
||||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: note.userId });
|
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: note.userId });
|
||||||
reply.header('Cache-Control', 'public, max-age=15');
|
reply.header('Cache-Control', 'public, max-age=15');
|
||||||
|
|
|
@ -20,6 +20,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #label>{{ i18n.ts.emailRequiredForSignup }}</template>
|
<template #label>{{ i18n.ts.emailRequiredForSignup }}</template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
|
|
||||||
|
<MkSelect v-model="visibleUserGeneratedContentsForNonLoggedInVisitors" @update:modelValue="onChange_visibleUserGeneratedContentsForNonLoggedInVisitors">
|
||||||
|
<template #label>{{ i18n.ts._serverSettings.visibleUserGeneratedContentsForNonLoggedInVisitors }}</template>
|
||||||
|
<option value="all">{{ i18n.ts.all }}</option>
|
||||||
|
<option value="local">{{ i18n.ts.localOnly }}</option>
|
||||||
|
<option value="none">{{ i18n.ts.none }}</option>
|
||||||
|
</MkSelect>
|
||||||
|
|
||||||
<FormLink to="/admin/server-rules">{{ i18n.ts.serverRules }}</FormLink>
|
<FormLink to="/admin/server-rules">{{ i18n.ts.serverRules }}</FormLink>
|
||||||
|
|
||||||
<MkFolder>
|
<MkFolder>
|
||||||
|
@ -137,9 +144,11 @@ import { definePage } from '@/page.js';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import FormLink from '@/components/form/link.vue';
|
import FormLink from '@/components/form/link.vue';
|
||||||
import MkFolder from '@/components/MkFolder.vue';
|
import MkFolder from '@/components/MkFolder.vue';
|
||||||
|
import MkSelect from '@/components/MkSelect.vue';
|
||||||
|
|
||||||
const enableRegistration = ref<boolean>(false);
|
const enableRegistration = ref<boolean>(false);
|
||||||
const emailRequiredForSignup = ref<boolean>(false);
|
const emailRequiredForSignup = ref<boolean>(false);
|
||||||
|
const visibleUserGeneratedContentsForNonLoggedInVisitors = ref<string>('all');
|
||||||
const sensitiveWords = ref<string>('');
|
const sensitiveWords = ref<string>('');
|
||||||
const prohibitedWords = ref<string>('');
|
const prohibitedWords = ref<string>('');
|
||||||
const prohibitedWordsForNameOfUser = ref<string>('');
|
const prohibitedWordsForNameOfUser = ref<string>('');
|
||||||
|
@ -153,6 +162,7 @@ async function init() {
|
||||||
const meta = await misskeyApi('admin/meta');
|
const meta = await misskeyApi('admin/meta');
|
||||||
enableRegistration.value = !meta.disableRegistration;
|
enableRegistration.value = !meta.disableRegistration;
|
||||||
emailRequiredForSignup.value = meta.emailRequiredForSignup;
|
emailRequiredForSignup.value = meta.emailRequiredForSignup;
|
||||||
|
visibleUserGeneratedContentsForNonLoggedInVisitors.value = meta.visibleUserGeneratedContentsForNonLoggedInVisitors;
|
||||||
sensitiveWords.value = meta.sensitiveWords.join('\n');
|
sensitiveWords.value = meta.sensitiveWords.join('\n');
|
||||||
prohibitedWords.value = meta.prohibitedWords.join('\n');
|
prohibitedWords.value = meta.prohibitedWords.join('\n');
|
||||||
prohibitedWordsForNameOfUser.value = meta.prohibitedWordsForNameOfUser.join('\n');
|
prohibitedWordsForNameOfUser.value = meta.prohibitedWordsForNameOfUser.join('\n');
|
||||||
|
@ -189,6 +199,14 @@ function onChange_emailRequiredForSignup(value: boolean) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onChange_visibleUserGeneratedContentsForNonLoggedInVisitors(value: string) {
|
||||||
|
os.apiWithDialog('admin/update-meta', {
|
||||||
|
visibleUserGeneratedContentsForNonLoggedInVisitors: value,
|
||||||
|
}).then(() => {
|
||||||
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function save_preservedUsernames() {
|
function save_preservedUsernames() {
|
||||||
os.apiWithDialog('admin/update-meta', {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
preservedUsernames: preservedUsernames.value.split('\n'),
|
preservedUsernames: preservedUsernames.value.split('\n'),
|
||||||
|
|
|
@ -8769,6 +8769,8 @@ export type operations = {
|
||||||
software: string;
|
software: string;
|
||||||
versionRange: string;
|
versionRange: string;
|
||||||
}[];
|
}[];
|
||||||
|
/** @enum {string} */
|
||||||
|
visibleUserGeneratedContentsForNonLoggedInVisitors: 'all' | 'local' | 'none';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -11439,6 +11441,8 @@ export type operations = {
|
||||||
software: string;
|
software: string;
|
||||||
versionRange: string;
|
versionRange: string;
|
||||||
}[];
|
}[];
|
||||||
|
/** @enum {string} */
|
||||||
|
visibleUserGeneratedContentsForNonLoggedInVisitors?: 'all' | 'local' | 'none';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue