From a81cb602bcc2ab21b0c56280b39a46526d5de457 Mon Sep 17 00:00:00 2001 From: xpadev Date: Wed, 22 Nov 2023 15:11:17 +0900 Subject: [PATCH] improve: add auth check --- src/@types/niconico.d.ts | 13 +++++++++++++ .../comment-picker/remote/remote-comment-picker.tsx | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/src/@types/niconico.d.ts b/src/@types/niconico.d.ts index 46ed851..cf9af6e 100644 --- a/src/@types/niconico.d.ts +++ b/src/@types/niconico.d.ts @@ -42,6 +42,19 @@ export type TWatchV3Metadata = { commentableUserTypeForPayment: string; "9d091f87": boolean; }; + viewer: V3MetadataViewerItem | null; + }; +}; + +export type V3MetadataViewerItem = { + id: number; + nickname: string; + isPremium: boolean; + allowSensitiveContents: boolean; + existence: { + age: number; + prefecture: string; + sex: string; }; }; diff --git a/src/controller/comment-picker/remote/remote-comment-picker.tsx b/src/controller/comment-picker/remote/remote-comment-picker.tsx index c147d0b..0b3c83f 100644 --- a/src/controller/comment-picker/remote/remote-comment-picker.tsx +++ b/src/controller/comment-picker/remote/remote-comment-picker.tsx @@ -65,6 +65,13 @@ const RemoteCommentPicker: FC = ({ onChange }) => { }); return; } + if (targetMetadata.data.viewer === null) { + setMessage({ + title: "ログインが必須です", + content: "コメントのダウンロードにはアカウントが必須です", + }); + return; + } setMetadata(targetMetadata); lastUrl.current = nicoId; })();