Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/api/src/routes/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ auth.post('/verify', async (c) => {
auth.post('/password', async (c) => {
const { shioriId, password }: PasswordAuthRequest = await c.req.json();

if (!shioriId || !password) {
if (!shioriId) {
return c.json({
success: false,
error: { code: 'INVALID_INPUT', message: 'shioriId and password are required' }
error: { code: 'INVALID_INPUT', message: 'shioriId is required' }
}, 400);
}

Expand All @@ -52,13 +52,19 @@ auth.post('/password', async (c) => {
}, 404);
}

if (itinerary.password !== password) {
// If itinerary has a password, verify it
if (itinerary.password && itinerary.password !== password) {
return c.json({
success: false,
error: { code: 'UNAUTHORIZED', message: 'Invalid password' }
}, 401);
}

// If itinerary has no password, allow access (password can be anything or empty)
if (!itinerary.password) {
// No check needed
}

const token = await generateToken(shioriId, c.env.JWT_SECRET);

return c.json({
Expand Down
9 changes: 8 additions & 1 deletion apps/web/src/lib/themes/ai-generated/ItineraryView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@
}

if (!itinerary.password) {
hasEditPermission = true;
try {
const token = await authApi.authenticateWithPassword(itinerary.id, "");
auth.setToken(itinerary.id, itinerary.title, token);
hasEditPermission = true;
} catch (e) {
console.error("Failed to authenticate without password", e);
alert("認証に失敗しました");
}
return;
}

Expand Down
9 changes: 8 additions & 1 deletion apps/web/src/lib/themes/minimal/ItineraryView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@
}

if (!itinerary.password) {
hasEditPermission = true;
try {
const token = await authApi.authenticateWithPassword(itinerary.id, "");
auth.setToken(itinerary.id, itinerary.title, token);
hasEditPermission = true;
} catch (e) {
console.error("Failed to authenticate without password", e);
alert("認証に失敗しました");
}
return;
}

Expand Down
29 changes: 16 additions & 13 deletions apps/web/src/lib/themes/standard-autumn/ItineraryView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,17 @@
}
}

// パスワードが設定されていない場合は即座に編集モードに切り替え
// パスワードが設定されていない場合は、空パスワードで認証してトークンを取得
if (!itinerary.password) {
hasEditPermission = true;
showSettingsMenu = false;
try {
const token = await authApi.authenticateWithPassword(itinerary.id, "");
auth.setToken(itinerary.id, itinerary.title, token);
hasEditPermission = true;
showSettingsMenu = false;
} catch (e) {
console.error("Failed to authenticate without password", e);
alert("認証に失敗しました");
}
return;
}

Expand Down Expand Up @@ -472,7 +479,7 @@
<span>Calendar</span>
</button> -->

<div style="position: relative;">
<div class="standard-autumn-btn-wrapper">
<button
class="standard-autumn-bottom-btn"
title={hasEditPermission
Expand Down Expand Up @@ -509,7 +516,7 @@
</button>
</div>
{#if hasEditPermission}
<div style="position: relative;">
<div class="standard-autumn-btn-wrapper">
<button
class="standard-autumn-bottom-btn"
title="設定"
Expand Down Expand Up @@ -555,19 +562,16 @@
</div>
{/if}
{#if showThemeSelect}
<div
style="position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--standard-autumn-card-bg); border: 1px solid var(--standard-autumn-border); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); padding: 0.5rem 1rem; z-index: 200; min-width: 180px; max-width: calc(100vw - 2rem); margin-bottom: 0.5rem;"
>
<div class="standard-autumn-theme-select-popup">
<label
for="theme-select"
style="font-size: 0.95rem; color: var(--standard-autumn-text); margin-bottom: 0.5rem; display: block;"
>テーマを選択</label
class="standard-autumn-theme-select-label">テーマを選択</label
>
<select
id="theme-select"
value={selectedThemeId}
onchange={handleThemeChange}
style="width: 100%; font-size: 1rem; padding: 0.3rem; border-radius: 4px; border: 1px solid var(--standard-autumn-border); background: #fff; color: var(--standard-autumn-text);"
class="standard-autumn-theme-select-input"
>
{#each themes as theme}
<option value={theme.id}>{theme.name}</option>
Expand Down Expand Up @@ -750,8 +754,7 @@
onclick={() => {
showShareDialog = false;
}}
class="standard-autumn-btn standard-autumn-btn-secondary"
style="width: 100%; margin-top: 0.5rem;"
class="standard-autumn-btn standard-autumn-btn-secondary standard-autumn-btn-full"
>
キャンセル
</button>
Expand Down
68 changes: 34 additions & 34 deletions apps/web/src/lib/themes/standard-autumn/StepList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -354,42 +354,42 @@
<div class="standard-autumn-step-content">
<div class="standard-autumn-step-title">
{step.title}
<div class="standard-autumn-step-actions">
<button
onclick={() => startEdit(step)}
class="standard-autumn-btn-icon"
title="編集"
aria-label="編集"
disabled={!hasEditPermission}
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
{#if hasEditPermission}
<div class="standard-autumn-step-actions">
<button
onclick={() => startEdit(step)}
class="standard-autumn-btn-icon"
title="編集"
aria-label="編集"
>
<path
d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"
/>
</svg>
</button>
<button
onclick={() => handleDelete(step.id)}
class="standard-autumn-btn-icon"
title="削除"
aria-label="削除"
disabled={!hasEditPermission}
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
>
<path
d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"
/>
</svg>
</button>
<button
onclick={() => handleDelete(step.id)}
class="standard-autumn-btn-icon"
title="削除"
aria-label="削除"
>
<path
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
/>
</svg>
</button>
</div>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
>
<path
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
/>
</svg>
</button>
</div>
{/if}
</div>
{#if step.location}
<div class="standard-autumn-step-location">
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/lib/themes/standard-autumn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const fallTheme: Theme = {
layout: 'single',
colorScheme: 'light',
customColors: {
primary: '#DFB89A',
secondary: '#F7E3CC',
background: '#FEF6EC',
text: '#333333',
accent: '#8b5e3c'
primary: '#a93529',
secondary: '#e6b422',
background: '#fcf9f2',
text: '#4a3b32',
accent: '#d4762c'
}
},
components: {
Expand Down
Loading