disableLocalTimeline機能を強化
* ストリームだけではなくAPIも無効に * モデレーターは無効の場合でも見れるように * グローバルタイムラインも無効に(連合数が少ないインスタンスではグローバルタイムラインは実質的にローカルタイムラインと同一なので)
This commit is contained in:
parent
c8e2b22942
commit
c2f6b09969
7 changed files with 38 additions and 18 deletions
|
@ -4,6 +4,7 @@ import Mute from '../../../../models/mute';
|
|||
import { packMany } from '../../../../models/note';
|
||||
import define from '../../define';
|
||||
import { countIf } from '../../../../prelude/array';
|
||||
import fetchMeta from '../../../../misc/fetch-meta';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
|
@ -66,6 +67,13 @@ export const meta = {
|
|||
};
|
||||
|
||||
export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
||||
const meta = await fetchMeta();
|
||||
if (meta.disableLocalTimeline) {
|
||||
if (user == null || (!user.isAdmin && !user.isModerator)) {
|
||||
return rej('local timeline disabled');
|
||||
}
|
||||
}
|
||||
|
||||
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
||||
if (countIf(x => x != null, [ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate]) > 1) {
|
||||
return rej('only one of sinceId, untilId, sinceDate, untilDate can be specified');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue