fix oauth
Some checks failed
Deploy ailog / build-and-deploy (push) Has been cancelled

This commit is contained in:
2025-06-12 19:12:33 +09:00
parent eb5aa0a2be
commit 6e6c6e2f53
37 changed files with 32 additions and 41 deletions

View File

@ -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 {

View File

@ -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'}
</button>
<button
onClick={() => handleDeleteUserList(record.uri)}
className="delete-button"
title="Delete user list"
>
🗑
Delete
</button>
</div>
</div>
@ -1006,7 +1006,7 @@ function App() {
className="json-button"
title="Show/Hide JSON"
>
{showJsonFor === record.uri ? '📄' : '📄'}
{showJsonFor === record.uri ? 'Hide' : 'JSON'}
</button>
{/* 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
</button>
)}
</div>

View File

@ -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 = `<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ai.card OAuth Test</title>
<style>
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background-color: #0a0a0a;
color: #ffffff;
}
</style>
<script type="module" crossorigin src="/assets/comment-atproto.js"></script>
<link rel="stylesheet" crossorigin href="/assets/comment-atproto.css">
</head>
<body>
<div id="comment-atproto"></div>
</body>
</html>`
const indexHtmlContent = `<!-- OAuth Comment System - Load globally for session management -->
<script type="module" crossorigin src="/${jsFile}"></script>
<link rel="stylesheet" crossorigin href="/${cssFile}">`
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]';
}
}
}

11
run.zsh
View File

@ -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
}