Compare commits

..

2 Commits

Author SHA1 Message Date
e442ccc926 fix title 2026-01-18 20:02:19 +09:00
3b2c7435f3 minimal 2026-01-18 19:38:49 +09:00
6 changed files with 27 additions and 22 deletions

View File

@@ -2,7 +2,7 @@ name: Deploy to GitHub Pages
on:
push:
branches: [min]
branches: [main]
workflow_dispatch:
permissions:

13
index.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ailog</title>
<link rel="stylesheet" href="/src/styles/main.css">
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@@ -1,9 +1,8 @@
{
"title": "ailog",
"handle": "syui.ai",
"collection": "ai.syui.log.post",
"network": "bsky.social",
"color": "#EF454A",
"siteUrl": "https://syui.github.io",
"oauth": false
"title": "ailog",
"handle": "syui.ai",
"collection": "ai.syui.log.post",
"network": "bsky.social",
"color": "#EF454A",
"siteUrl": "https://syui.github.io"
}

View File

@@ -1,15 +1,12 @@
import { isLoggedIn, getLoggedInHandle } from '../lib/auth'
export function renderHeader(currentHandle: string, oauth: boolean = true): string {
export function renderHeader(currentHandle: string): string {
const loggedIn = isLoggedIn()
const handle = getLoggedInHandle()
let loginBtn = ''
if (oauth) {
loginBtn = loggedIn
? `<button type="button" class="header-btn user-btn" id="logout-btn" title="Logout">${handle || 'logout'}</button>`
: `<button type="button" class="header-btn login-btn" id="login-btn" title="Login"><img src="/icon/user.svg" alt="Login" class="login-icon"></button>`
}
const loginBtn = loggedIn
? `<button type="button" class="header-btn user-btn" id="logout-btn" title="Logout">${handle || 'logout'}</button>`
: `<button type="button" class="header-btn login-btn" id="login-btn" title="Login"><img src="/icon/user.svg" alt="Login" class="login-icon"></button>`
return `
<header id="header">

View File

@@ -67,9 +67,6 @@ async function render(route: Route): Promise<void> {
document.title = config.title
}
// Check OAuth enabled
const oauthEnabled = config.oauth !== false
// Handle OAuth callback if present (check both ? and #)
const searchParams = new URLSearchParams(window.location.search)
const hashParams = window.location.hash ? new URLSearchParams(window.location.hash.slice(1)) : null
@@ -111,7 +108,7 @@ async function render(route: Route): Promise<void> {
if (!did) {
app.innerHTML = `
${renderHeader(handle, oauthEnabled)}
${renderHeader(handle)}
<div class="error">Could not resolve handle: ${handle}</div>
${renderFooter(handle)}
`
@@ -142,7 +139,7 @@ async function render(route: Route): Promise<void> {
const langList = Array.from(availableLangs)
// Build page
let html = renderHeader(handle, oauthEnabled)
let html = renderHeader(handle)
// Mode tabs (Blog/Browser/Post/PDS)
const activeTab = route.type === 'postpage' ? 'post' :
@@ -267,7 +264,7 @@ async function render(route: Route): Promise<void> {
} catch (error) {
console.error('Render error:', error)
app.innerHTML = `
${renderHeader(currentHandle, false)}
${renderHeader(currentHandle)}
<div class="error">Error: ${error}</div>
${renderFooter(currentHandle)}
`

View File

@@ -6,7 +6,6 @@ export interface AppConfig {
network: string
color: string
siteUrl: string
oauth?: boolean
}
export interface Networks {