From 6e6c6e2f53f3886414c138bc6e1ea825e5c92ad6 Mon Sep 17 00:00:00 2001 From: syui Date: Thu, 12 Jun 2025 19:12:33 +0900 Subject: [PATCH] fix oauth --- {aicard-web-oauth => oauth}/.env | 0 {aicard-web-oauth => oauth}/.env.development | 0 {aicard-web-oauth => oauth}/.env.production | 0 {aicard-web-oauth => oauth}/index.html | 0 {aicard-web-oauth => oauth}/package.json | 0 .../public/.well-known/jwks.json | 0 .../public/client-metadata.json | 0 {aicard-web-oauth => oauth}/src/App.css | 10 +++-- {aicard-web-oauth => oauth}/src/App.tsx | 8 ++-- .../src/components/Card.tsx | 0 .../src/components/CardBox.tsx | 0 .../src/components/CardList.tsx | 0 .../src/components/CollectionAnalysis.tsx | 0 .../src/components/GachaAnimation.tsx | 0 .../src/components/GachaStats.tsx | 0 .../src/components/Login.tsx | 0 .../src/components/OAuthCallback.tsx | 0 .../src/components/OAuthCallbackPage.tsx | 0 {aicard-web-oauth => oauth}/src/config/app.ts | 0 {aicard-web-oauth => oauth}/src/main.tsx | 0 .../src/services/api.ts | 0 .../src/services/atproto-oauth.ts | 0 .../src/services/auth.ts | 0 .../src/styles/Card.css | 0 .../src/styles/CardBox.css | 0 .../src/styles/CardList.css | 0 .../src/styles/CollectionAnalysis.css | 0 .../src/styles/GachaAnimation.css | 0 .../src/styles/GachaStats.css | 0 .../src/styles/Login.css | 0 {aicard-web-oauth => oauth}/src/types/card.ts | 0 .../src/utils/oauth-endpoints.ts | 0 .../src/utils/oauth-keys.ts | 0 {aicard-web-oauth => oauth}/tsconfig.json | 0 .../tsconfig.node.json | 0 {aicard-web-oauth => oauth}/vite.config.ts | 44 +++++++------------ run.zsh | 11 +++-- 37 files changed, 32 insertions(+), 41 deletions(-) rename {aicard-web-oauth => oauth}/.env (100%) rename {aicard-web-oauth => oauth}/.env.development (100%) rename {aicard-web-oauth => oauth}/.env.production (100%) rename {aicard-web-oauth => oauth}/index.html (100%) rename {aicard-web-oauth => oauth}/package.json (100%) rename {aicard-web-oauth => oauth}/public/.well-known/jwks.json (100%) rename {aicard-web-oauth => oauth}/public/client-metadata.json (100%) rename {aicard-web-oauth => oauth}/src/App.css (99%) rename {aicard-web-oauth => oauth}/src/App.tsx (99%) rename {aicard-web-oauth => oauth}/src/components/Card.tsx (100%) rename {aicard-web-oauth => oauth}/src/components/CardBox.tsx (100%) rename {aicard-web-oauth => oauth}/src/components/CardList.tsx (100%) rename {aicard-web-oauth => oauth}/src/components/CollectionAnalysis.tsx (100%) rename {aicard-web-oauth => oauth}/src/components/GachaAnimation.tsx (100%) rename {aicard-web-oauth => oauth}/src/components/GachaStats.tsx (100%) rename {aicard-web-oauth => oauth}/src/components/Login.tsx (100%) rename {aicard-web-oauth => oauth}/src/components/OAuthCallback.tsx (100%) rename {aicard-web-oauth => oauth}/src/components/OAuthCallbackPage.tsx (100%) rename {aicard-web-oauth => oauth}/src/config/app.ts (100%) rename {aicard-web-oauth => oauth}/src/main.tsx (100%) rename {aicard-web-oauth => oauth}/src/services/api.ts (100%) rename {aicard-web-oauth => oauth}/src/services/atproto-oauth.ts (100%) rename {aicard-web-oauth => oauth}/src/services/auth.ts (100%) rename {aicard-web-oauth => oauth}/src/styles/Card.css (100%) rename {aicard-web-oauth => oauth}/src/styles/CardBox.css (100%) rename {aicard-web-oauth => oauth}/src/styles/CardList.css (100%) rename {aicard-web-oauth => oauth}/src/styles/CollectionAnalysis.css (100%) rename {aicard-web-oauth => oauth}/src/styles/GachaAnimation.css (100%) rename {aicard-web-oauth => oauth}/src/styles/GachaStats.css (100%) rename {aicard-web-oauth => oauth}/src/styles/Login.css (100%) rename {aicard-web-oauth => oauth}/src/types/card.ts (100%) rename {aicard-web-oauth => oauth}/src/utils/oauth-endpoints.ts (100%) rename {aicard-web-oauth => oauth}/src/utils/oauth-keys.ts (100%) rename {aicard-web-oauth => oauth}/tsconfig.json (100%) rename {aicard-web-oauth => oauth}/tsconfig.node.json (100%) rename {aicard-web-oauth => oauth}/vite.config.ts (68%) diff --git a/aicard-web-oauth/.env b/oauth/.env similarity index 100% rename from aicard-web-oauth/.env rename to oauth/.env diff --git a/aicard-web-oauth/.env.development b/oauth/.env.development similarity index 100% rename from aicard-web-oauth/.env.development rename to oauth/.env.development diff --git a/aicard-web-oauth/.env.production b/oauth/.env.production similarity index 100% rename from aicard-web-oauth/.env.production rename to oauth/.env.production diff --git a/aicard-web-oauth/index.html b/oauth/index.html similarity index 100% rename from aicard-web-oauth/index.html rename to oauth/index.html diff --git a/aicard-web-oauth/package.json b/oauth/package.json similarity index 100% rename from aicard-web-oauth/package.json rename to oauth/package.json diff --git a/aicard-web-oauth/public/.well-known/jwks.json b/oauth/public/.well-known/jwks.json similarity index 100% rename from aicard-web-oauth/public/.well-known/jwks.json rename to oauth/public/.well-known/jwks.json diff --git a/aicard-web-oauth/public/client-metadata.json b/oauth/public/client-metadata.json similarity index 100% rename from aicard-web-oauth/public/client-metadata.json rename to oauth/public/client-metadata.json diff --git a/aicard-web-oauth/src/App.css b/oauth/src/App.css similarity index 99% rename from aicard-web-oauth/src/App.css rename to oauth/src/App.css index a9ffffb..987106c 100644 --- a/aicard-web-oauth/src/App.css +++ b/oauth/src/App.css @@ -524,10 +524,12 @@ } .delete-button { - background: none; + background: #dc3545; + color: white; border: none; cursor: pointer; - font-size: 16px; + font-size: 12px; + font-weight: 500; padding: 4px 8px; border-radius: 4px; transition: all 0.3s ease; @@ -535,8 +537,8 @@ } .delete-button:hover { - background: rgba(220, 53, 69, 0.1); - transform: scale(1.1); + background: #c82333; + transform: scale(1.05); } .comment-content { diff --git a/aicard-web-oauth/src/App.tsx b/oauth/src/App.tsx similarity index 99% rename from aicard-web-oauth/src/App.tsx rename to oauth/src/App.tsx index 4f009b5..9246a42 100644 --- a/aicard-web-oauth/src/App.tsx +++ b/oauth/src/App.tsx @@ -920,14 +920,14 @@ function App() { className="json-button" title="Show/Hide JSON" > - {showJsonFor === record.uri ? '📄 Hide JSON' : '📄 Show JSON'} + {showJsonFor === record.uri ? 'Hide JSON' : 'Show JSON'} @@ -1006,7 +1006,7 @@ function App() { className="json-button" title="Show/Hide JSON" > - {showJsonFor === record.uri ? '📄' : '📄'} + {showJsonFor === record.uri ? 'Hide' : 'JSON'} {/* Show delete button only for current user's comments */} {user && record.value.author?.did === user.did && ( @@ -1015,7 +1015,7 @@ function App() { className="delete-button" title="Delete comment" > - 🗑️ + Delete )} diff --git a/aicard-web-oauth/src/components/Card.tsx b/oauth/src/components/Card.tsx similarity index 100% rename from aicard-web-oauth/src/components/Card.tsx rename to oauth/src/components/Card.tsx diff --git a/aicard-web-oauth/src/components/CardBox.tsx b/oauth/src/components/CardBox.tsx similarity index 100% rename from aicard-web-oauth/src/components/CardBox.tsx rename to oauth/src/components/CardBox.tsx diff --git a/aicard-web-oauth/src/components/CardList.tsx b/oauth/src/components/CardList.tsx similarity index 100% rename from aicard-web-oauth/src/components/CardList.tsx rename to oauth/src/components/CardList.tsx diff --git a/aicard-web-oauth/src/components/CollectionAnalysis.tsx b/oauth/src/components/CollectionAnalysis.tsx similarity index 100% rename from aicard-web-oauth/src/components/CollectionAnalysis.tsx rename to oauth/src/components/CollectionAnalysis.tsx diff --git a/aicard-web-oauth/src/components/GachaAnimation.tsx b/oauth/src/components/GachaAnimation.tsx similarity index 100% rename from aicard-web-oauth/src/components/GachaAnimation.tsx rename to oauth/src/components/GachaAnimation.tsx diff --git a/aicard-web-oauth/src/components/GachaStats.tsx b/oauth/src/components/GachaStats.tsx similarity index 100% rename from aicard-web-oauth/src/components/GachaStats.tsx rename to oauth/src/components/GachaStats.tsx diff --git a/aicard-web-oauth/src/components/Login.tsx b/oauth/src/components/Login.tsx similarity index 100% rename from aicard-web-oauth/src/components/Login.tsx rename to oauth/src/components/Login.tsx diff --git a/aicard-web-oauth/src/components/OAuthCallback.tsx b/oauth/src/components/OAuthCallback.tsx similarity index 100% rename from aicard-web-oauth/src/components/OAuthCallback.tsx rename to oauth/src/components/OAuthCallback.tsx diff --git a/aicard-web-oauth/src/components/OAuthCallbackPage.tsx b/oauth/src/components/OAuthCallbackPage.tsx similarity index 100% rename from aicard-web-oauth/src/components/OAuthCallbackPage.tsx rename to oauth/src/components/OAuthCallbackPage.tsx diff --git a/aicard-web-oauth/src/config/app.ts b/oauth/src/config/app.ts similarity index 100% rename from aicard-web-oauth/src/config/app.ts rename to oauth/src/config/app.ts diff --git a/aicard-web-oauth/src/main.tsx b/oauth/src/main.tsx similarity index 100% rename from aicard-web-oauth/src/main.tsx rename to oauth/src/main.tsx diff --git a/aicard-web-oauth/src/services/api.ts b/oauth/src/services/api.ts similarity index 100% rename from aicard-web-oauth/src/services/api.ts rename to oauth/src/services/api.ts diff --git a/aicard-web-oauth/src/services/atproto-oauth.ts b/oauth/src/services/atproto-oauth.ts similarity index 100% rename from aicard-web-oauth/src/services/atproto-oauth.ts rename to oauth/src/services/atproto-oauth.ts diff --git a/aicard-web-oauth/src/services/auth.ts b/oauth/src/services/auth.ts similarity index 100% rename from aicard-web-oauth/src/services/auth.ts rename to oauth/src/services/auth.ts diff --git a/aicard-web-oauth/src/styles/Card.css b/oauth/src/styles/Card.css similarity index 100% rename from aicard-web-oauth/src/styles/Card.css rename to oauth/src/styles/Card.css diff --git a/aicard-web-oauth/src/styles/CardBox.css b/oauth/src/styles/CardBox.css similarity index 100% rename from aicard-web-oauth/src/styles/CardBox.css rename to oauth/src/styles/CardBox.css diff --git a/aicard-web-oauth/src/styles/CardList.css b/oauth/src/styles/CardList.css similarity index 100% rename from aicard-web-oauth/src/styles/CardList.css rename to oauth/src/styles/CardList.css diff --git a/aicard-web-oauth/src/styles/CollectionAnalysis.css b/oauth/src/styles/CollectionAnalysis.css similarity index 100% rename from aicard-web-oauth/src/styles/CollectionAnalysis.css rename to oauth/src/styles/CollectionAnalysis.css diff --git a/aicard-web-oauth/src/styles/GachaAnimation.css b/oauth/src/styles/GachaAnimation.css similarity index 100% rename from aicard-web-oauth/src/styles/GachaAnimation.css rename to oauth/src/styles/GachaAnimation.css diff --git a/aicard-web-oauth/src/styles/GachaStats.css b/oauth/src/styles/GachaStats.css similarity index 100% rename from aicard-web-oauth/src/styles/GachaStats.css rename to oauth/src/styles/GachaStats.css diff --git a/aicard-web-oauth/src/styles/Login.css b/oauth/src/styles/Login.css similarity index 100% rename from aicard-web-oauth/src/styles/Login.css rename to oauth/src/styles/Login.css diff --git a/aicard-web-oauth/src/types/card.ts b/oauth/src/types/card.ts similarity index 100% rename from aicard-web-oauth/src/types/card.ts rename to oauth/src/types/card.ts diff --git a/aicard-web-oauth/src/utils/oauth-endpoints.ts b/oauth/src/utils/oauth-endpoints.ts similarity index 100% rename from aicard-web-oauth/src/utils/oauth-endpoints.ts rename to oauth/src/utils/oauth-endpoints.ts diff --git a/aicard-web-oauth/src/utils/oauth-keys.ts b/oauth/src/utils/oauth-keys.ts similarity index 100% rename from aicard-web-oauth/src/utils/oauth-keys.ts rename to oauth/src/utils/oauth-keys.ts diff --git a/aicard-web-oauth/tsconfig.json b/oauth/tsconfig.json similarity index 100% rename from aicard-web-oauth/tsconfig.json rename to oauth/tsconfig.json diff --git a/aicard-web-oauth/tsconfig.node.json b/oauth/tsconfig.node.json similarity index 100% rename from aicard-web-oauth/tsconfig.node.json rename to oauth/tsconfig.node.json diff --git a/aicard-web-oauth/vite.config.ts b/oauth/vite.config.ts similarity index 68% rename from aicard-web-oauth/vite.config.ts rename to oauth/vite.config.ts index 3cf15c7..4a3fc95 100644 --- a/aicard-web-oauth/vite.config.ts +++ b/oauth/vite.config.ts @@ -31,32 +31,18 @@ export default defineConfig(({ mode }) => { // Generate standalone index.html for testing { name: 'generate-standalone-html', - writeBundle() { - // Generate standalone index.html for testing + writeBundle(options, bundle) { + // Find actual generated filenames + const jsFile = Object.keys(bundle).find(fileName => fileName.startsWith('assets/comment-atproto') && fileName.endsWith('.js')) + const cssFile = Object.keys(bundle).find(fileName => fileName.startsWith('assets/comment-atproto') && fileName.endsWith('.css')) + + // Generate minimal index.html with just asset references const indexHtmlPath = path.resolve(__dirname, 'dist/index.html') - const indexHtmlContent = ` - - - - - ai.card OAuth Test - - - - - -
- -` + const indexHtmlContent = ` + +` fs.writeFileSync(indexHtmlPath, indexHtmlContent) - console.log('Generated standalone index.html for testing') + console.log('Generated minimal index.html with asset references') } } ], @@ -65,14 +51,14 @@ export default defineConfig(({ mode }) => { minify: 'esbuild', rollupOptions: { output: { - // Fixed filenames for ailog integration - entryFileNames: 'assets/comment-atproto.js', - chunkFileNames: 'assets/comment-atproto-[name].js', + // Hash-based filenames to bust cache + entryFileNames: 'assets/comment-atproto-[hash].js', + chunkFileNames: 'assets/comment-atproto-[name]-[hash].js', assetFileNames: (assetInfo) => { if (assetInfo.name && assetInfo.name.endsWith('.css')) { - return 'assets/comment-atproto.css'; + return 'assets/comment-atproto-[hash].css'; } - return 'assets/[name].[ext]'; + return 'assets/[name]-[hash].[ext]'; } } } diff --git a/run.zsh b/run.zsh index 81f54db..67864b3 100755 --- a/run.zsh +++ b/run.zsh @@ -3,12 +3,14 @@ function _env() { d=${0:a:h} ailog=$d/target/release/ailog + oauth=$d/oauth + myblog=$d/my-blog port=4173 case $OSTYPE in darwin*) export NVM_DIR="$HOME/.nvm" - [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm - [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion + [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" + [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ;; esac } @@ -29,12 +31,13 @@ function _server_public() { function _oauth_build() { _env - cd $d/aicard-web-oauth + cd $oauth nvm use 21 npm i source .env.production npm run build - cp -rf dist/* $d/my-blog/static/ + cp -rf dist/* $myblog/static/ + cp $oauth/dist/index.html $myblog/templates/oauth-assets.html #npm run preview }