From d8fd91a35d1d3081dac534d1e70200e9e3297f8b Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 07:29:33 +0000 Subject: [PATCH 01/20] =?UTF-8?q?=F0=9F=9A=A8=20astro/src/components/Clien?= =?UTF-8?q?t/bsky/=E3=81=ABESLint=E3=81=AE--fix=E3=82=AA=E3=83=97=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=E9=81=A9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro/src/components/Client/bsky/LoginForm.tsx | 2 +- .../components/Client/bsky/MediaPreview/DeleteItemButton.tsx | 2 +- astro/src/components/Client/bsky/MediaPreview/MetaView.tsx | 2 +- astro/src/components/Client/bsky/buttons/DraftSaveButton.tsx | 2 +- astro/src/components/Client/bsky/unique/LoadSession.tsx | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/astro/src/components/Client/bsky/LoginForm.tsx b/astro/src/components/Client/bsky/LoginForm.tsx index 3cd729e..59f7580 100644 --- a/astro/src/components/Client/bsky/LoginForm.tsx +++ b/astro/src/components/Client/bsky/LoginForm.tsx @@ -35,7 +35,7 @@ export const Component = ({ password: pw }) if (typeof res.error !== "undefined") { - let e: Error = new Error(res.message) + const e: Error = new Error(res.message) e.name = res.error throw e } else { diff --git a/astro/src/components/Client/bsky/MediaPreview/DeleteItemButton.tsx b/astro/src/components/Client/bsky/MediaPreview/DeleteItemButton.tsx index 754f788..aa4a205 100644 --- a/astro/src/components/Client/bsky/MediaPreview/DeleteItemButton.tsx +++ b/astro/src/components/Client/bsky/MediaPreview/DeleteItemButton.tsx @@ -30,7 +30,7 @@ const Component = ({ return } // Listから自身のitemIdを取り除き、これをリストに追加する - let result = mediaData.images.filter( + const result = mediaData.images.filter( (_, index) => index !== itemId ) // 全てのメディアが削除された場合は null とする diff --git a/astro/src/components/Client/bsky/MediaPreview/MetaView.tsx b/astro/src/components/Client/bsky/MediaPreview/MetaView.tsx index 458e35a..3654adc 100644 --- a/astro/src/components/Client/bsky/MediaPreview/MetaView.tsx +++ b/astro/src/components/Client/bsky/MediaPreview/MetaView.tsx @@ -10,7 +10,7 @@ export const Component = ({ if (mediaData === null || mediaData.type !== "external") { return } - let mediaDataItem = mediaData.meta + const mediaDataItem = mediaData.meta return (
{ const isValidPost = (): boolean => { - let result: boolean = postText.length >= 1 + const result: boolean = postText.length >= 1 return result } diff --git a/astro/src/components/Client/bsky/unique/LoadSession.tsx b/astro/src/components/Client/bsky/unique/LoadSession.tsx index 45cc824..d2c565d 100644 --- a/astro/src/components/Client/bsky/unique/LoadSession.tsx +++ b/astro/src/components/Client/bsky/unique/LoadSession.tsx @@ -33,7 +33,7 @@ export const Component = ({ const refreshResult = await refreshSession({ refreshJwt: r_jwts }) if (typeof refreshResult?.error !== "undefined") { resetJwt() - let e: Error = new Error(refreshResult.message) + const e: Error = new Error(refreshResult.message) e.name = refreshResult.error throw e } @@ -54,7 +54,7 @@ export const Component = ({ setProfile: setProfile }) if (typeof resLoadProfile?.error !== "undefined") { - let e: Error = new Error(resLoadProfile.message) + const e: Error = new Error(resLoadProfile.message) e.name = resLoadProfile.error throw e } From 40f97ec5cc7fe909e5d203356fe16ca490f16d1a Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 07:32:03 +0000 Subject: [PATCH 02/20] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20target=3D"=5Fblan?= =?UTF-8?q?k"=E4=BB=98=E3=81=AE=E3=82=BF=E3=82=B0=E3=81=AE=E8=84=86?= =?UTF-8?q?=E5=BC=B1=E6=80=A7=E5=AF=BE=E7=AD=96=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 詳細は下記を確認してください。 https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md --- astro/src/components/Client/bsky/LoginForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astro/src/components/Client/bsky/LoginForm.tsx b/astro/src/components/Client/bsky/LoginForm.tsx index 59f7580..27ed461 100644 --- a/astro/src/components/Client/bsky/LoginForm.tsx +++ b/astro/src/components/Client/bsky/LoginForm.tsx @@ -136,7 +136,7 @@ export const Component = ({ (BskyLinXに限らず)非公式のアプリを使う際はAppPasswordの利用が推奨されています。 + href="https://bsky.app/settings/app-passwords" rel="noopener noreferrer"> bsky.appの⚙設定🔒高度な設定(新規タブが開きます) から生成してください。
From 624cf9e6690ccf2f834365fa39f26e97811dbb04 Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:05:49 +0000 Subject: [PATCH 03/20] =?UTF-8?q?=F0=9F=9A=A8=20readDrafts()=E3=81=8C?= =?UTF-8?q?=E5=B8=B8=E3=81=ABtruthy=E3=81=AA=E5=80=A4=E3=82=92=E8=BF=94?= =?UTF-8?q?=E3=81=99=E3=82=88=E3=81=86=E3=81=AA=E3=81=AE=E3=81=A7=E3=80=81?= =?UTF-8?q?OR=E6=BC=94=E7=AE=97=E5=AD=90=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro/src/components/Client/bsky/buttons/DraftSaveButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astro/src/components/Client/bsky/buttons/DraftSaveButton.tsx b/astro/src/components/Client/bsky/buttons/DraftSaveButton.tsx index ba30c36..0bde6be 100644 --- a/astro/src/components/Client/bsky/buttons/DraftSaveButton.tsx +++ b/astro/src/components/Client/bsky/buttons/DraftSaveButton.tsx @@ -46,7 +46,7 @@ export const Component = ({ saveTagToSavedTags({ postText }) - const newDrafts = [postText, ...readDrafts() || []] + const newDrafts = [postText, ...readDrafts()] saveDrafts(newDrafts) setDrafts(newDrafts) From 82ad2cd80392c261a9db4c323bc167d9f312378b Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:24:31 +0000 Subject: [PATCH 04/20] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20atproto=5Fapi?= =?UTF-8?q?=E3=81=AE=E5=9E=8B=E5=AE=9A=E7=BE=A9=E5=A4=89=E6=9B=B4=E3=81=AB?= =?UTF-8?q?=E4=BC=B4=E3=81=84=E3=80=81=E6=97=A2=E5=AD=98=E3=81=AE=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E3=81=AE=E5=9E=8B=E6=83=85=E5=A0=B1=E3=82=92=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Client/bsky/LoginForm.tsx | 17 +++++++------- .../Client/bsky/buttons/PostButton.tsx | 23 ++++++++++++------- .../Client/bsky/unique/LoadSession.tsx | 17 ++++++++------ astro/src/utils/atproto_api/uploadBlob.ts | 4 ++-- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/astro/src/components/Client/bsky/LoginForm.tsx b/astro/src/components/Client/bsky/LoginForm.tsx index 27ed461..7efee8a 100644 --- a/astro/src/components/Client/bsky/LoginForm.tsx +++ b/astro/src/components/Client/bsky/LoginForm.tsx @@ -2,14 +2,14 @@ import { useState, useEffect, useContext, Dispatch, SetStateAction } from "react import { inputtext_base, link } from "../common/tailwindVariants" import { Session_context, Profile_context } from "../common/contexts" import { type msgInfo } from "../common/types" -import createSession from "@/utils/atproto_api/createSession"; -import loadProfile from "./lib/loadProfile"; +import createSession from "@/utils/atproto_api/createSession" +import dummyCreateSessionObject from "@/utils/atproto_api/models/createSession.json" +import loadProfile from "./lib/loadProfile" -import { writeJwt } from "@/utils/useLocalStorage" import ProcButton from "../common/ProcButton" import Tooltip from "../common/Tooltip" import SavePasswordToggle from "./optionToggles/SavePasswordToggle" -import { readLogininfo, setLogininfo } from "@/utils/useLocalStorage" +import {writeJwt, readLogininfo, setLogininfo } from "@/utils/useLocalStorage" export const Component = ({ setMsgInfo, @@ -34,14 +34,15 @@ export const Component = ({ identifier: id, password: pw }) - if (typeof res.error !== "undefined") { + if ("error" in res && typeof res.error != "undefined") { const e: Error = new Error(res.message) e.name = res.error throw e } else { - setSession(res) + const successResponse = res as typeof dummyCreateSessionObject + setSession(successResponse) // セッションをlocalstorageへ保存 - writeJwt(res.refreshJwt) + writeJwt(successResponse.refreshJwt) setMsgInfo({ msg: "セッションを開始しました!", isError: false, @@ -55,7 +56,7 @@ export const Component = ({ } // プロフィールを読み込み await loadProfile({ - session: res, + session: successResponse, setProfile: setProfile }) } diff --git a/astro/src/components/Client/bsky/buttons/PostButton.tsx b/astro/src/components/Client/bsky/buttons/PostButton.tsx index aa273a9..290482a 100644 --- a/astro/src/components/Client/bsky/buttons/PostButton.tsx +++ b/astro/src/components/Client/bsky/buttons/PostButton.tsx @@ -12,13 +12,17 @@ import { label } from "@/utils/atproto_api/labels" import detectFacets from "@/utils/atproto_api/detectFacets" import createRecord from "@/utils/atproto_api/createRecord" import type record from "@/utils/atproto_api/record" -import uploadBlob, { - type uploadBlobResult, +import uploadBlob from "@/utils/atproto_api/uploadBlob" +import type { + uploadBlobSuccessResult, + uploadBlobResult, } from "@/utils/atproto_api/uploadBlob" import resolveHandle, { type resolveHandleResult, } from "@/utils/atproto_api/resolveHandle" +import dummyCreateRecordObject from "@/utils/atproto_api/models/createRecord.json" + // backend api import createPage from "@/lib/pagedbAPI/createPage" import browserImageCompression from "@/utils/browserImageCompression" @@ -221,12 +225,15 @@ export const Component = ({ ) // Blobのアップロードに失敗したファイルが一つでも存在した場合停止する resultUploadBlob.forEach(value => { - if (typeof value?.error !== "undefined") { + if ("error" in value && typeof value.error != "undefined") { const e: Error = new Error(value.message) e.name = value.error throw e } }) + + const resultUploadBlobSuccess = resultUploadBlob as uploadBlobSuccessResult[] + // Recordの作成 switch (mediaData.type) { case "images": @@ -234,7 +241,7 @@ export const Component = ({ ...Record, embed: { $type: "app.bsky.embed.images", - images: resultUploadBlob.map((value, index) => { + images: resultUploadBlobSuccess.map((value, index) => { return { image: value.blob, alt: mediaData.images[index].alt, @@ -251,8 +258,8 @@ export const Component = ({ $type: "app.bsky.embed.external", external: { thumb: - resultUploadBlob.length >= 1 - ? resultUploadBlob[0].blob + resultUploadBlobSuccess.length >= 1 + ? resultUploadBlobSuccess[0].blob : undefined, uri: mediaData.meta.url, title: mediaData.meta.title, @@ -280,7 +287,7 @@ export const Component = ({ accessJwt: session.accessJwt, record: Record, }) - if (typeof createRecordResult?.error !== "undefined") { + if ("error" in createRecordResult && typeof createRecordResult.error != "undefined") { const e: Error = new Error(createRecordResult.message) e.name = createRecordResult.error throw e @@ -301,7 +308,7 @@ export const Component = ({ }) const createPageResult = await createPage({ accessJwt: session.accessJwt, - uri: createRecordResult.uri, + uri: (createRecordResult as typeof dummyCreateRecordObject).uri, }) if (typeof createPageResult?.error !== "undefined") { const e: Error = new Error(createPageResult.message) diff --git a/astro/src/components/Client/bsky/unique/LoadSession.tsx b/astro/src/components/Client/bsky/unique/LoadSession.tsx index d2c565d..fe5e484 100644 --- a/astro/src/components/Client/bsky/unique/LoadSession.tsx +++ b/astro/src/components/Client/bsky/unique/LoadSession.tsx @@ -13,6 +13,8 @@ import { readJwt, resetJwt, writeJwt } from "@/utils/useLocalStorage" import loadProfile from "../lib/loadProfile"; import { Session_context, Profile_context } from "../../common/contexts" +import dummyRefreshSessionObject from "@/utils/atproto_api/models/refreshSession.json" + export const Component = ({ setIsLoad, setMsgInfo @@ -31,26 +33,27 @@ export const Component = ({ msg: "セッションの再開中...", isError: false }) const refreshResult = await refreshSession({ refreshJwt: r_jwts }) - if (typeof refreshResult?.error !== "undefined") { + if ("error" in refreshResult && typeof refreshResult.error != "undefined") { resetJwt() const e: Error = new Error(refreshResult.message) e.name = refreshResult.error throw e } + const refreshSuccessResult = refreshResult as typeof dummyRefreshSessionObject setSession({ - did: refreshResult.did, - accessJwt: refreshResult.accessJwt, - refreshJwt: refreshResult.refreshJwt, - handle: refreshResult.handle, + did: refreshSuccessResult.did, + accessJwt: refreshSuccessResult.accessJwt, + refreshJwt: refreshSuccessResult.refreshJwt, + handle: refreshSuccessResult.handle, }) // リフレッシュしたトークンを上書き - writeJwt(refreshResult.refreshJwt) + writeJwt(refreshSuccessResult.refreshJwt) setMsgInfo({ msg: "セッションを再開しました!", isError: false }) const resLoadProfile = await loadProfile({ - session: refreshResult, + session: refreshSuccessResult, setProfile: setProfile }) if (typeof resLoadProfile?.error !== "undefined") { diff --git a/astro/src/utils/atproto_api/uploadBlob.ts b/astro/src/utils/atproto_api/uploadBlob.ts index 15c0fee..d79bcce 100644 --- a/astro/src/utils/atproto_api/uploadBlob.ts +++ b/astro/src/utils/atproto_api/uploadBlob.ts @@ -2,7 +2,7 @@ import getEndpoint, { com_atproto } from "./base" const apiName = com_atproto.repo.uploadBlob const endpoint = getEndpoint(apiName) -type uploadBlobSuccessResult = { +export type uploadBlobSuccessResult = { blob: { $type: "blob" ref: { @@ -13,7 +13,7 @@ type uploadBlobSuccessResult = { } } -type uploadBlobErrorResult = { +export type uploadBlobErrorResult = { error: string message: string } From c8c9587c6bcd7d8e1bffb8bc802351d05c1a9201 Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:25:24 +0000 Subject: [PATCH 05/20] =?UTF-8?q?=F0=9F=9A=A8=20Promise=E3=82=92?= =?UTF-8?q?=E8=BF=94=E3=81=99=E9=96=A2=E6=95=B0=E3=81=ABvoid=E3=82=AD?= =?UTF-8?q?=E3=83=BC=E3=83=AF=E3=83=BC=E3=83=89=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro/src/components/Client/bsky/LoginForm.tsx | 2 +- astro/src/components/Client/bsky/unique/LoadSession.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/astro/src/components/Client/bsky/LoginForm.tsx b/astro/src/components/Client/bsky/LoginForm.tsx index 7efee8a..726c55f 100644 --- a/astro/src/components/Client/bsky/LoginForm.tsx +++ b/astro/src/components/Client/bsky/LoginForm.tsx @@ -85,7 +85,7 @@ export const Component = ({ } } useEffect(() => { - handleOnLoad() + void handleOnLoad() }, []) return ( diff --git a/astro/src/components/Client/bsky/unique/LoadSession.tsx b/astro/src/components/Client/bsky/unique/LoadSession.tsx index fe5e484..91366a3 100644 --- a/astro/src/components/Client/bsky/unique/LoadSession.tsx +++ b/astro/src/components/Client/bsky/unique/LoadSession.tsx @@ -79,7 +79,7 @@ export const Component = ({ setIsLoad(true) } useEffect(() => { - handleLoad() + void handleLoad() }, []) return ( From 7afa8cb207adef4551646a43135b5bee99891f1e Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:26:25 +0000 Subject: [PATCH 06/20] =?UTF-8?q?=F0=9F=9A=A8=20=E3=83=90=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=82=AF=E3=82=A9=E3=83=BC=E3=83=88=E3=81=A7=E5=9B=B2?= =?UTF-8?q?=E3=82=8F=E3=82=8C=E3=81=9F=E3=83=80=E3=83=96=E3=83=AB=E3=82=AF?= =?UTF-8?q?=E3=82=A9=E3=83=BC=E3=83=88=E3=81=AE=E3=82=A8=E3=82=B9=E3=82=B1?= =?UTF-8?q?=E3=83=BC=E3=83=97=E3=82=92=E8=A7=A3=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro/src/components/Client/bsky/unique/TagInputList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astro/src/components/Client/bsky/unique/TagInputList.tsx b/astro/src/components/Client/bsky/unique/TagInputList.tsx index 1d13721..735d66f 100644 --- a/astro/src/components/Client/bsky/unique/TagInputList.tsx +++ b/astro/src/components/Client/bsky/unique/TagInputList.tsx @@ -21,7 +21,7 @@ export const Component = ({ outputText = [tag + " "].join("") } else { // 末尾が改行文字か、半角文字の場合は区切り記号を挿入しない - console.log(`last : \"${postText.slice(-1)}\"`) + console.log(`last : "${postText.slice(-1)}"`) outputText = [postText, new RegExp(/[ \n\r]/).test( postText.slice(-1)) ? "" : " ", From fc6aca651b8e6ed29370aa60e0c2be5b6f37a72c Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:27:40 +0000 Subject: [PATCH 07/20] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20identifier=E3=81=AE?= =?UTF-8?q?=E7=B6=B4=E3=82=8A=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro/src/components/Client/bsky/LoginForm.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astro/src/components/Client/bsky/LoginForm.tsx b/astro/src/components/Client/bsky/LoginForm.tsx index 726c55f..06fc1aa 100644 --- a/astro/src/components/Client/bsky/LoginForm.tsx +++ b/astro/src/components/Client/bsky/LoginForm.tsx @@ -18,7 +18,7 @@ export const Component = ({ }) => { const [loading, setLoad] = useState(false) const [savePassword, setSavePassword] = useState(false) - const [identifier, setIdentifer] = useState("") + const [identifier, setIdentifier] = useState("") const [password, setPassword] = useState("") const { setSession } = useContext(Session_context) const { setProfile } = useContext(Profile_context) @@ -95,7 +95,7 @@ export const Component = ({ - setIdentifer(event.target.value)} + setIdentifier(event.target.value)} placeholder="example.bsky.social" disabled={loading} className={inputtext_base({ From d5221f372d20509d5ea4fd9ea0f03f63f26f7b12 Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:28:14 +0000 Subject: [PATCH 08/20] =?UTF-8?q?=F0=9F=9A=A8=20map()=E3=81=A7=E7=B9=B0?= =?UTF-8?q?=E3=82=8A=E8=BF=94=E3=81=97=E5=87=BA=E5=8A=9B=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=8D=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=81=AB=E3=80=81key=E5=B1=9E=E6=80=A7=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro/src/components/Client/bsky/unique/TagInputList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astro/src/components/Client/bsky/unique/TagInputList.tsx b/astro/src/components/Client/bsky/unique/TagInputList.tsx index 735d66f..25d0260 100644 --- a/astro/src/components/Client/bsky/unique/TagInputList.tsx +++ b/astro/src/components/Client/bsky/unique/TagInputList.tsx @@ -54,8 +54,8 @@ export const Component = ({ return (
{ - readSavedTags().map((value) => { - return + readSavedTags().map((value, index) => { + return }) }
From 5dde2ec13f8d6a8106d78e6e5771d25f0569395f Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:28:52 +0000 Subject: [PATCH 09/20] =?UTF-8?q?=F0=9F=9A=A8=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E5=A4=89=E6=95=B0=E3=81=AB=E3=82=A2=E3=83=B3=E3=83=80=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=82=B3=E3=82=A2=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro/src/components/Client/bsky/unique/TextInputBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astro/src/components/Client/bsky/unique/TextInputBox.tsx b/astro/src/components/Client/bsky/unique/TextInputBox.tsx index 4450dea..20524e6 100644 --- a/astro/src/components/Client/bsky/unique/TextInputBox.tsx +++ b/astro/src/components/Client/bsky/unique/TextInputBox.tsx @@ -147,7 +147,7 @@ const Component = ({ }) const segments = segmenterJa.segment(postText) return Array.from(segments).length - } catch (e) { + } catch (_e) { // Intl.Segmenterがfirefoxでは未対応であるため、やむをえずレガシーな方法で対処 // 絵文字のカウント数が想定より多く設定されてしまうため、firefox_v125までは非推奨ブラウザとする return postText.length From ac8f1d7991e0ca4e18f0087a8e2c89008bf9cfe1 Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:32:44 +0000 Subject: [PATCH 10/20] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20atproto=5Fapi?= =?UTF-8?q?=E3=81=AE=E5=9E=8B=E5=AE=9A=E7=BE=A9=E5=A4=89=E6=9B=B4=E3=81=AB?= =?UTF-8?q?=E4=BC=B4=E3=81=84=E3=80=81=E6=97=A2=E5=AD=98=E3=81=AE=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E3=81=AE=E5=9E=8B=E6=83=85=E5=A0=B1=E3=82=92=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro/src/components/Client/bsky/lib/loadProfile.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/astro/src/components/Client/bsky/lib/loadProfile.ts b/astro/src/components/Client/bsky/lib/loadProfile.ts index bc28efc..eeecef9 100644 --- a/astro/src/components/Client/bsky/lib/loadProfile.ts +++ b/astro/src/components/Client/bsky/lib/loadProfile.ts @@ -22,9 +22,8 @@ export const loadProfile = async ({ accessJwt: session.accessJwt, handle: session.handle }) - if (res !== null && typeof res?.error === "undefined") { - const res_prof: typeof model_getProfile = res as typeof model_getProfile - setProfile(res_prof) + if (res != null && !("error" in res)) { + setProfile(res) } } catch (e: unknown) { if (e instanceof Error){ From 7c1baacc03e8f0bf7a32e76f89d6dd0fbc0d29c9 Mon Sep 17 00:00:00 2001 From: ZEKE320 <46393375+ZEKE320@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:37:59 +0000 Subject: [PATCH 11/20] =?UTF-8?q?=F0=9F=8E=A8=20astro/src/components/Clien?= =?UTF-8?q?t/bsky=E3=81=ABPrettier=E3=82=92=E9=81=A9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Client/bsky/LoginForm.tsx | 87 +++++++----- .../Client/bsky/MediaPreview/AltDialog.tsx | 86 ++++++------ .../bsky/MediaPreview/DeleteItemButton.tsx | 16 ++- .../Client/bsky/MediaPreview/MetaView.tsx | 47 ++++--- .../Client/bsky/buttons/AddImageButton.tsx | 33 +++-- .../Client/bsky/buttons/DraftSaveButton.tsx | 33 +++-- .../Client/bsky/buttons/LogoutButton.tsx | 21 +-- .../Client/bsky/buttons/PostButton.tsx | 33 +++-- .../Client/bsky/lib/addImageMediaData.ts | 22 +-- .../components/Client/bsky/lib/loadProfile.ts | 18 +-- .../bsky/optionToggles/AppendViaToggle.tsx | 9 +- .../bsky/optionToggles/AutoXPopupToggle.tsx | 9 +- .../bsky/optionToggles/ForceIntentToggle.tsx | 9 +- .../bsky/optionToggles/NoGenerateToggle.tsx | 9 +- .../bsky/optionToggles/SavePasswordToggle.tsx | 9 +- .../bsky/optionToggles/ShowTaittsuuToggle.tsx | 9 +- .../bsky/selectLists/LanguageSelectList.tsx | 33 +++-- .../bsky/selectLists/SelfLabelsSelectList.tsx | 74 ++++++----- .../Client/bsky/unique/DraftDialog.tsx | 125 ++++++++++-------- .../Client/bsky/unique/LoadSession.tsx | 44 +++--- .../Client/bsky/unique/TagInputList.tsx | 43 +++--- 21 files changed, 436 insertions(+), 333 deletions(-) diff --git a/astro/src/components/Client/bsky/LoginForm.tsx b/astro/src/components/Client/bsky/LoginForm.tsx index 06fc1aa..0f6da34 100644 --- a/astro/src/components/Client/bsky/LoginForm.tsx +++ b/astro/src/components/Client/bsky/LoginForm.tsx @@ -1,4 +1,10 @@ -import { useState, useEffect, useContext, Dispatch, SetStateAction } from "react" +import { + useState, + useEffect, + useContext, + Dispatch, + SetStateAction, +} from "react" import { inputtext_base, link } from "../common/tailwindVariants" import { Session_context, Profile_context } from "../common/contexts" import { type msgInfo } from "../common/types" @@ -9,12 +15,12 @@ import loadProfile from "./lib/loadProfile" import ProcButton from "../common/ProcButton" import Tooltip from "../common/Tooltip" import SavePasswordToggle from "./optionToggles/SavePasswordToggle" -import {writeJwt, readLogininfo, setLogininfo } from "@/utils/useLocalStorage" +import { writeJwt, readLogininfo, setLogininfo } from "@/utils/useLocalStorage" export const Component = ({ setMsgInfo, }: { - setMsgInfo: Dispatch>, + setMsgInfo: Dispatch> }) => { const [loading, setLoad] = useState(false) const [savePassword, setSavePassword] = useState(false) @@ -32,7 +38,7 @@ export const Component = ({ } const res = await createSession({ identifier: id, - password: pw + password: pw, }) if ("error" in res && typeof res.error != "undefined") { const e: Error = new Error(res.message) @@ -51,13 +57,13 @@ export const Component = ({ if (savePassword === true) { setLogininfo({ id: identifier, - pw: password + pw: password, }) } // プロフィールを読み込み await loadProfile({ session: successResponse, - setProfile: setProfile + setProfile: setProfile, }) } } catch (error: unknown) { @@ -67,7 +73,7 @@ export const Component = ({ } setMsgInfo({ msg: msg, - isError: true + isError: true, }) } setLoad(false) @@ -79,9 +85,7 @@ export const Component = ({ msg: "ブラウザに保存されたID/APWでログイン中...", isError: false, }) - await handleLogin( - loginInfo.id, - loginInfo.pw) + await handleLogin(loginInfo.id, loginInfo.pw) } } useEffect(() => { @@ -89,67 +93,84 @@ export const Component = ({ }, []) return ( - <> +
- setIdentifier(event.target.value)} + setIdentifier(event.target.value)} placeholder="example.bsky.social" disabled={loading} className={inputtext_base({ class: "max-w-52 w-full px-2", kind: "outbound", - disabled: loading - })} type="text" /> + disabled: loading, + })} + type="text" + />
- setPassword(event.target.value)} + setPassword(event.target.value)} placeholder="this-isex-ampl-epwd" disabled={loading} className={inputtext_base({ class: "max-w-52 w-full px-2", kind: "outbound", - disabled: loading - })} type="password" /> + disabled: loading, + })} + type="password" + />
0 && password.length > 0)} - showAnimation={true} /> + disabled={ + !(identifier.length > 0 && password.length > 0) + } + showAnimation={true} + />
+ setProp={setSavePassword} + />
- -
- (BskyLinXに限らず)非公式のアプリを使う際はAppPasswordの利用が推奨されています。 - - bsky.appの⚙設定🔒高度な設定(新規タブが開きます) - から生成してください。 + +
+ (BskyLinXに限らず)非公式のアプリを使う際はAppPasswordの利用が推奨されています。 + + bsky.appの⚙設定→ + 🔒高度な設定(新規タブが開きます) + + から生成してください。 +
-
- }> + } + > ※AppPasswordとは?(タップで説明を表示)
- + ) } -export default Component \ No newline at end of file +export default Component diff --git a/astro/src/components/Client/bsky/MediaPreview/AltDialog.tsx b/astro/src/components/Client/bsky/MediaPreview/AltDialog.tsx index 57aa0d4..0a4a89e 100644 --- a/astro/src/components/Client/bsky/MediaPreview/AltDialog.tsx +++ b/astro/src/components/Client/bsky/MediaPreview/AltDialog.tsx @@ -1,5 +1,5 @@ // utils -import React, { memo, useRef, useCallback, useState, useEffect } from "react"; +import React, { memo, useRef, useCallback, useState, useEffect } from "react" // component import OverlayDialog from "../../common/OverlayDialog" @@ -9,7 +9,7 @@ import { inputtext_base, link } from "../../common/tailwindVariants" import { MediaData } from "../../common/types" const Img = ({ - mediaDataItem + mediaDataItem, }: { mediaDataItem: { alt: string @@ -17,16 +17,19 @@ const Img = ({ } }) => { return ( - + ) } const MemoImg = memo(Img) export const Component = ({ itemId, - mediaData + mediaData, }: { - itemId: number, + itemId: number mediaData: MediaData }) => { // mediaDataがimageではない場合はコンポーネントを無効に @@ -34,7 +37,7 @@ export const Component = ({ return } let mediaDataItem = mediaData.images[itemId] - const textref = useRef(null); + const textref = useRef(null) const [altBoxText, setAltBoxText] = useState(mediaDataItem.alt) const maxShowAltLength = 10 @@ -42,17 +45,18 @@ export const Component = ({ if (textref.current) { textref.current.value = mediaDataItem.alt } - }; + } const handleCloseDialog = () => { mediaDataItem.alt = altBoxText - }; + } const handleClickInDialog = useCallback( (e: React.MouseEvent) => { - e.stopPropagation(); - }, [] - ); + e.stopPropagation() + }, + [], + ) const handleOnChange = (event: React.ChangeEvent) => { // メディアがimagesの場合のみ処理 @@ -81,43 +85,51 @@ export const Component = ({ callbackOpenDialog={handleOpenDialog} callbackCloseDialog={handleCloseDialog} buttonOption={{ - className: [ - "rounded-lg", "border-1", - "bg-opacity-70", "px-2", - "bg-black", "border-white", - "text-white", "absolute", - "left-1", "bottom-1"].join(" ") + ( - altBoxText !== "" ? (" bg-blue-500") : ("") - ), + className: + [ + "rounded-lg", + "border-1", + "bg-opacity-70", + "px-2", + "bg-black", + "border-white", + "text-white", + "absolute", + "left-1", + "bottom-1", + ].join(" ") + (altBoxText !== "" ? " bg-blue-500" : ""), content: - altBoxText !== "" ? ( - `${altBoxText.slice(0, maxShowAltLength) - }${altBoxText.length >= maxShowAltLength - ? ("...") : ("")}` - ) : ( - "Altを設定" - ) - }}> -
- - -