This commit is contained in:
@ -720,6 +720,29 @@ function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// OAuth実行関数
|
||||||
|
const executeOAuth = async () => {
|
||||||
|
if (!handleInput.trim()) {
|
||||||
|
alert('Please enter your Bluesky handle first');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await atprotoOAuthService.initiateOAuthFlow(handleInput);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('OAuth failed:', err);
|
||||||
|
alert('認証の開始に失敗しました。再度お試しください。');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ユーザーハンドルからプロフィールURLを生成
|
||||||
|
const generateProfileUrl = (handle: string, did: string): string => {
|
||||||
|
if (handle.endsWith('.syu.is')) {
|
||||||
|
return `https://web.syu.is/profile/${did}`;
|
||||||
|
} else {
|
||||||
|
return `https://bsky.app/profile/${did}`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// OAuth callback is now handled by React Router in main.tsx
|
// OAuth callback is now handled by React Router in main.tsx
|
||||||
console.log('=== APP.TSX URL CHECK ===');
|
console.log('=== APP.TSX URL CHECK ===');
|
||||||
console.log('Full URL:', window.location.href);
|
console.log('Full URL:', window.location.href);
|
||||||
@ -737,18 +760,7 @@ function App() {
|
|||||||
{!user ? (
|
{!user ? (
|
||||||
<div className="auth-section">
|
<div className="auth-section">
|
||||||
<button
|
<button
|
||||||
onClick={async () => {
|
onClick={executeOAuth}
|
||||||
if (!handleInput.trim()) {
|
|
||||||
alert('Please enter your Bluesky handle first');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await atprotoOAuthService.initiateOAuthFlow(handleInput);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('OAuth failed:', err);
|
|
||||||
alert('認証の開始に失敗しました。再度お試しください。');
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
className="atproto-button"
|
className="atproto-button"
|
||||||
>
|
>
|
||||||
atproto
|
atproto
|
||||||
@ -760,6 +772,12 @@ function App() {
|
|||||||
className="handle-input"
|
className="handle-input"
|
||||||
value={handleInput}
|
value={handleInput}
|
||||||
onChange={(e) => setHandleInput(e.target.value)}
|
onChange={(e) => setHandleInput(e.target.value)}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
e.preventDefault();
|
||||||
|
executeOAuth();
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -877,22 +895,6 @@ function App() {
|
|||||||
<div className="comments-list">
|
<div className="comments-list">
|
||||||
<div className="comments-header">
|
<div className="comments-header">
|
||||||
<h3>Comments</h3>
|
<h3>Comments</h3>
|
||||||
<div className="comments-controls">
|
|
||||||
<button
|
|
||||||
onClick={() => user && loadUserComments(user.did)}
|
|
||||||
className="comments-toggle-button"
|
|
||||||
disabled={!user}
|
|
||||||
title={!user ? "Login required to view your comments" : ""}
|
|
||||||
>
|
|
||||||
My Comments {!user && "(Login Required)"}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={() => loadAllComments()}
|
|
||||||
className="comments-toggle-button"
|
|
||||||
>
|
|
||||||
All Comments (No Filter)
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{comments.length === 0 ? (
|
{comments.length === 0 ? (
|
||||||
<p className="no-comments">No comments yet</p>
|
<p className="no-comments">No comments yet</p>
|
||||||
@ -909,7 +911,14 @@ function App() {
|
|||||||
<span className="comment-author">
|
<span className="comment-author">
|
||||||
{record.value.author?.displayName || record.value.author?.handle || 'unknown'}
|
{record.value.author?.displayName || record.value.author?.handle || 'unknown'}
|
||||||
</span>
|
</span>
|
||||||
<span className="comment-handle">@{record.value.author?.handle || 'unknown'}</span>
|
<a
|
||||||
|
href={generateProfileUrl(record.value.author?.handle || '', record.value.author?.did || '')}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="comment-handle"
|
||||||
|
>
|
||||||
|
@{record.value.author?.handle || 'unknown'}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<span className="comment-date">
|
<span className="comment-date">
|
||||||
{new Date(record.value.createdAt).toLocaleString()}
|
{new Date(record.value.createdAt).toLocaleString()}
|
||||||
@ -929,7 +938,7 @@ function App() {
|
|||||||
{record.value.text}
|
{record.value.text}
|
||||||
</div>
|
</div>
|
||||||
<div className="comment-meta">
|
<div className="comment-meta">
|
||||||
<small>URI: {record.uri}</small>
|
<small>{record.uri}</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
|
2
run.zsh
2
run.zsh
@ -38,9 +38,9 @@ function _oauth_build() {
|
|||||||
export VITE_OAUTH_REDIRECT_URI="https://log.syui.ai/oauth/callback"
|
export VITE_OAUTH_REDIRECT_URI="https://log.syui.ai/oauth/callback"
|
||||||
|
|
||||||
npm run build
|
npm run build
|
||||||
#npm run preview
|
|
||||||
cp -rf dist/* $d/my-blog/static/
|
cp -rf dist/* $d/my-blog/static/
|
||||||
#cp -rf dist/index.html $d/my-blog/public/
|
#cp -rf dist/index.html $d/my-blog/public/
|
||||||
|
#npm run preview
|
||||||
}
|
}
|
||||||
|
|
||||||
function _server_comment() {
|
function _server_comment() {
|
||||||
|
Reference in New Issue
Block a user