Open
Conversation
Google Drive の .md ファイルを編集できる Web アプリプラグイン。 - バックエンド: Hono (AWS Lambda + Lambda Function URL) - フロントエンド: 素の React + Vite (pnpm workspace) - Google OAuth 2.0 + JWT cookie セッション管理 - CodeMirror 6 エディタ + react-markdown リアルタイムプレビュー - 入力停止 2 秒後の自動保存 (debounce) - Google Drive「アプリで開く」対応 (state パラメータ処理) https://claude.ai/code/session_019qAvxV5QqGkQNYuyxNDR5T
[1] OAuth CSRF 対策
- /api/auth/login で crypto.randomUUID() による nonce を生成し httpOnly cookie に保存
- OAuth state を { nonce, ds: drive_state } の JSON に変更
- /api/auth/callback で nonce の照合に失敗した場合は 400 を返す
[2] refresh_token 保存 + アクセストークン自動更新
- SessionPayload に refresh_token / access_token_expires_at を追加
- JWT セッション有効期間を 1h → 7d に延長
- Google から返された refresh_token と expires_in を session に保存
- drive.ts ミドルウェアでトークン残時間 < 5 分のときに自動リフレッシュし
session cookie を更新(ユーザーが気づかず 1 時間で編集内容が失われる問題を修正)
- lib/token.ts に refreshGoogleToken ヘルパーを追加
[3] TODO: template.yaml の Lambda Function URL AllowOrigins を APP_URL に限定
https://claude.ai/code/session_019qAvxV5QqGkQNYuyxNDR5T
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Google Drive の .md ファイルを編集できる Web アプリプラグイン。
https://claude.ai/code/session_019qAvxV5QqGkQNYuyxNDR5T