summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/stream/channels/local-timeline.ts
diff options
context:
space:
mode:
authoranatawa12 <anatawa12@icloud.com>2024-07-18 20:04:23 +0900
committerGitHub <noreply@github.com>2024-07-18 20:04:23 +0900
commit10ce7bf3c45c3e09dc86f1b9c3a0d7e79c23f5ee (patch)
treec098b60b4fee0030c4f6502c92035672f3fda44f /packages/backend/src/server/api/stream/channels/local-timeline.ts
parentfix(frontend): 子メニューの最大長調整が行われていない問... (diff)
downloadsharkey-10ce7bf3c45c3e09dc86f1b9c3a0d7e79c23f5ee.tar.gz
sharkey-10ce7bf3c45c3e09dc86f1b9c3a0d7e79c23f5ee.tar.bz2
sharkey-10ce7bf3c45c3e09dc86f1b9c3a0d7e79c23f5ee.zip
kill any from streaming API Implementation (#14251)
* chore: add JsonValue type * refactor: kill any from Connection.ts * refactor: fix StreamEventEmitter contains undefined instead of null * refactor: kill any from channels * docs(changelog): Fix: Steaming APIが不正なデータを受けた場合の動作が不安定である問題 * fix license header * fix lints
Diffstat (limited to 'packages/backend/src/server/api/stream/channels/local-timeline.ts')
-rw-r--r--packages/backend/src/server/api/stream/channels/local-timeline.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts
index 442d08ae51..491029f5de 100644
--- a/packages/backend/src/server/api/stream/channels/local-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts
@@ -10,6 +10,7 @@ import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js';
import { RoleService } from '@/core/RoleService.js';
import { isQuotePacked, isRenotePacked } from '@/misc/is-renote.js';
+import type { JsonObject } from '@/misc/json-value.js';
import Channel, { type MiChannelService } from '../channel.js';
class LocalTimelineChannel extends Channel {
@@ -33,13 +34,13 @@ class LocalTimelineChannel extends Channel {
}
@bindThis
- public async init(params: any) {
+ public async init(params: JsonObject) {
const policies = await this.roleService.getUserPolicies(this.user ? this.user.id : null);
if (!policies.ltlAvailable) return;
- this.withRenotes = params.withRenotes ?? true;
- this.withReplies = params.withReplies ?? false;
- this.withFiles = params.withFiles ?? false;
+ this.withRenotes = !!(params.withRenotes ?? true);
+ this.withReplies = !!(params.withReplies ?? false);
+ this.withFiles = !!(params.withFiles ?? false);
// Subscribe events
this.subscriber.on('notesStream', this.onNote);