Compare commits
6
Commits
02fb77f72b
...
v0.17.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96065d1e89 | ||
|
|
2cbaa9342d | ||
|
|
38b0fe2a94 | ||
|
|
667776e43f | ||
|
|
02edb51b8a | ||
|
|
b61fbc38a4 |
No files matched your search
@@ -5,6 +5,7 @@ data/*
|
||||
!data/test_cli_dr.py
|
||||
!data/pageswiki-remote
|
||||
/data2/
|
||||
/docs/local/
|
||||
/.codex/
|
||||
/.agents/
|
||||
/.env
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
services:
|
||||
app:
|
||||
image: pageswiki-app:task-index-20261109
|
||||
app2:
|
||||
image: pageswiki-app:task-index-20261109
|
||||
@@ -55,7 +55,12 @@
|
||||
- `POST /_/api/v1/editor/convert`:作業中 HTML を安全な authoring Markdown に変換。
|
||||
`POST /_/api/v1/render/markdown` の `authoring:true` で保護フェンスを元の HTML に戻す。
|
||||
`projection:true` と併用したプレビューでは従来の sanitizer・macro 展開を適用する。
|
||||
- 変換できない HTML は文書全体を保護する保守的な実装。フェンスは
|
||||
- 2026-11-09から、全体変換が構造を保てない場合はbody直下のブロック単位に変換する。
|
||||
往復で構造が一致する見出し・段落・リスト等はMarkdownへ戻し、不一致のブロックだけを保護する。
|
||||
再結合後も文書全体を比較し、head内要素等を失う場合は全文保護へ戻す。
|
||||
保護ブロックはDOM再シリアライズを避け、原文の引用符・タグ表記をそのまま保持する。
|
||||
分割は最大1024区間。省略終了タグ等で境界を確定できない場合も全文保護へ戻す。
|
||||
リスト・表の構造要素間の空白は比較時に正規化し、インラインの単語境界やコード内空白は保持する。フェンスは
|
||||
`` ```{=html} `` 形式(本文にバッククォートがある場合はそれより長い区切り)。
|
||||
任意の属性、コメント、未知要素、表の結合、画像キャプション、コード内空白を保持。
|
||||
フェンス内を編集でき、外側に Markdown を追記できる。通常のコードフェンス内にある
|
||||
@@ -84,7 +89,7 @@ CSVの表編集は既存保存・下書き・履歴の契約へ接続済みで
|
||||
管理者にだけ見える監視ではなく、同じ Page/language を編集できる参加者に限定する。
|
||||
2. **E6b realtime**:下記 CRDT 詳細設計・採用ライブラリ・同時変換ルールを確定した後に
|
||||
feature flag 付きで実装。現時点の CAS を最終コミット時の保護として残す。
|
||||
3. **E5b / E3b**:HTML ブロック単位の保護、hosted editor/CLI への保護フェンス対応、
|
||||
3. **E5b / E3b**:入れ子コンポーネント内のより細粒度なMarkdown復元、hosted editor/CLI への保護フェンス対応、
|
||||
アセットピッカーと拡張挿入パーツ。通常の Markdown だけを扱う外部エディタへ
|
||||
このフェンスを無断で渡さない。既存の外部エディタ変換経路は本変更の対象外。
|
||||
4. 保存 API の旧クライアント移行と base 必須化、下書き大容量化・明示破棄 UX、
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# オーガナイザーのナビゲーションと個人ダッシュボード
|
||||
|
||||
タスク・カレンダー・連絡先の入口を共通化し、個人設定と日々の振り返りを分離する。ダッシュボードは本人の作業を見る画面であり、サーバーの実行状態・リソース監視画面とは別に扱う。以下は2026-11-02のソース実装範囲で、2026-11-04にv0.7.0として本番へ反映した。移行・検証・復旧点は[本番反映記録](../../operations/deployments/2026-11-04-v0.7.0.md)を参照する。
|
||||
タスク・カレンダー・連絡先の入口を共通化し、個人設定と日々の振り返りを分離する。ダッシュボードは本人の作業を見る画面であり、サーバーの実行状態・リソース監視画面とは別に扱う。初期実装は2026-11-04にv0.7.0として本番へ反映した。2026-11-09の追加実装は、明日の予定・コマンドウィジェット、件名Markdown、参照欄、個人の外観設定。これらの追加分は本番未反映。
|
||||
|
||||
## 入口と設定の配置
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
| --- | --- |
|
||||
| `/v/plan/dashboard` | ウィジェット形式の個人ダッシュボード |
|
||||
| `/v/plan/tasks` | 既存のインライン編集可能なタスク一覧 |
|
||||
| `/v/plan/tasks/index` | neomutt風のキーボード操作によるタスク一覧 |
|
||||
| `/v/plan` | 既存のカレンダー表示。保存されたビューを尊重 |
|
||||
| `/v/plan/contacts` | 個人アドレス帳・履歴・CardDAV接続 |
|
||||
| `/-/sys/config?panel=organizer` | タスクの既定値、日次メール、既定のカレンダー |
|
||||
| `/-/sys/config?panel=organizer` | タスクの既定値、日次メール、既定のカレンダー、個人の外観 |
|
||||
|
||||
旧 `/v/plan/tasks/report` はダッシュボードの達成度ウィジェットへ、旧 `/v/plan/tasks/settings` は個人設定へ303リダイレクトする。カレンダーの表示選択ダイアログはその場の表示変更に使い、既定値の永続化は個人設定へ移す。
|
||||
|
||||
個人設定は通常の設定画面と同じURI体系・テーマを使うが、専用の軽量な画面として返す。GET/HEADかつ正確な `panel=organizer` の場合だけ個人向けハンドラーに振り分け、管理用設定やアカウント一覧は取得・描画しない。POSTの管理者チェックは緩和しない。保存先は既存の本人用APIであり、一般利用者に管理権限を付与しない。
|
||||
個人設定は通常の設定画面と同じURI体系・テーマを使うが、専用の軽量な画面として返す。GET/HEADかつ正確な `panel=organizer`、またはPOSTで `panel=organizer§ion=appearance` の場合だけ個人向けハンドラーに振り分ける。管理用設定のPOSTは従来どおり管理者を要求する。個人設定の保存は本人のactiveアカウントに限定し、管理権限を付与しない。
|
||||
|
||||
## タスク編集画面と通知既定値
|
||||
|
||||
@@ -26,6 +27,43 @@
|
||||
|
||||
760px以下では1カラムにし、主な入力と選択ボタンは44px以上のタッチ領域を確保する。個人設定には新規タスクの期限日・取り組む日のInbox通知と通知時刻を設ける。適用条件と既存データの扱いは[タスク通知](task-reminders.md)を参照する。
|
||||
|
||||
## キーボード操作のタスク一覧
|
||||
|
||||
`/v/plan/tasks/index` を既存のインライン編集とは別の表示として提供する。タスク画面の「キーボード一覧」から開く。左側はプロジェクト、右側は状態・件名・期限・取り組む日・優先度・関連Wikiの表。件名Markdownと選択行のテーマ色を使い、サブタスクは矢印で区別する。順序は指定ソートを優先し、親子の隣接は保証しない。
|
||||
|
||||
| キー | 操作 |
|
||||
| --- | --- |
|
||||
| `j` / `k`、上下矢印 | 次/前のタスクを選択 |
|
||||
| `Ctrl+j` / `Ctrl+k` | 次/前のプロジェクトへ表示を切り替え(所属変更ではない) |
|
||||
| `o` / `O` | ソート選択欄へ/昇順・降順を反転 |
|
||||
| `l` / `Esc` | 絞り込み欄へ/一覧へ戻る。絞り込みはEnterで適用 |
|
||||
| `d` | 選択タスクを完了。削除やアーカイブではない |
|
||||
| `s` | 選択タスクで25分Pomodoroを開始。実行中セッションは上書きしない |
|
||||
| `c` / `m` | 作成/既存の編集ダイアログを開く |
|
||||
| `w` | 関連Wikiへ移動。リンクがなければ案内し、暗黙に新規作成しない |
|
||||
| `?` | キーと絞り込み式のヘルプ |
|
||||
|
||||
入力欄、IME変換中、ダイアログ表示中にはショートカットを実行しない。更新系キーはキーリピートを無視する。作成時は選択中のプロジェクトを引き継ぎ、「すべて」では個人の既定値、「プロジェクトなし」では明示的な未所属とする。ブラウザやOSが予約しているキーをページ側へ渡さない環境では、同じ操作を画面のボタンから行う。
|
||||
|
||||
初期絞り込みは `~active`。複数条件はAND、`!` を条件の前に付けると否定する。OR・括弧・正規表現は扱わない。空欄はアーカイブ以外の全状態を表示する。
|
||||
|
||||
| 書式 | 意味 |
|
||||
| --- | --- |
|
||||
| `~s "リリース準備"` | 件名の部分一致。空白を含む値は引用符で囲む |
|
||||
| `~active` / `~todo` / `~doing` / `~done` / `~cancelled` | 未完了/未着手/着手中/完了/取りやめ |
|
||||
| `~overdue` | ドメインの今日より前に期限を迎えた未完了タスク |
|
||||
| `~due <=today` / `~planned tomorrow` / `~start >=2026-11-01` / `~review <today` | 期限・取り組む日・着手日・見直す日。日付はYYYY-MM-DD、today、tomorrow。比較は `= < <= > >=` |
|
||||
| `~due none` | 日付なし。planned、start、reviewにも使用可能 |
|
||||
| `~bucket inbox` / `~bucket backlog` / `~bucket someday` | 整理先 |
|
||||
| `~priority 3` | 優先度0〜3の一致 |
|
||||
| `~wiki` / `~attachment` / `~archived` | 関連Wikiあり/URL・Path参照あり/アーカイブ済み |
|
||||
|
||||
例:`~s "リリース" ~doing !~overdue`。プロジェクト・条件・ソートはURLクエリへreplaceStateで保持し、操作ごとに履歴エントリを増やさない。
|
||||
|
||||
取得は既存 `items` APIの `view=index`。`filter`、`sort`(due/planned/title/status/priority/created/updated)、`order`(asc/desc)、`project`、`before`を使う。未所属は `project=none`。サーバーで対象全体を絞り込み・ソートして100件ずつ取得し、末尾での下移動または追加読込で次を取得する。ソート値とUUIDによる順序を使い、他ユーザーのカーソルから内容を返さない。日付未設定は昇順の末尾、完全な逆順では先頭になる。並行更新時の固定スナップショットではないため、再読込で最新状態を確認する。
|
||||
|
||||
条件は1000バイト・最大64トークン。SQLは値をバインドし、ソート列は許可リストから選ぶ。不正条件は422で、旧表示を残して操作ボタンを無効化する。プロジェクトも検索・50件単位の追加読込とし、一括取得しない。完了は表示時のversionをIf-Matchで送る。別更新があれば412で止め、メモ等を最新取得しても古い選択行からの更新を無条件に通さない。本人の権限・読み取り専用制限は既存APIに従う。この一覧追加にDBスキーマ変更はない。
|
||||
|
||||
## ウィジェット
|
||||
|
||||
初期構成は次の6種類。任意のHTML・iframe・外部URL・スクリプトを登録する機能ではなく、サーバーが許可する組み込みIDを使う。
|
||||
@@ -39,13 +77,15 @@
|
||||
| `schedule` | 既定カレンダーにある今日の予定 |
|
||||
| `activity` | 完了数・ポイント・作業時間・集中時間、日別ヒートマップ |
|
||||
|
||||
追加メニューには `feeds`(RSS)、`tomorrow-schedule`(明日の予定)、`commands`(タスクコマンド)も用意する。既存の保存済み配置に自動追加せず、追加後に「配置を保存」で確定する。予定は時刻範囲・件名・カレンダー名をカード状に配置し、開催中の予定を強調する。終日予定は時刻の代わりに「終日」を表示する。
|
||||
|
||||
タブはウィジェットの枠内で内容を切り替える。iframeを使わず、ページやブラウザ履歴を移動しない。タスク件名や右上の矢印は既存の詳細・一覧へ移動する。タスクの編集操作は従来の一覧・詳細画面を利用する。
|
||||
|
||||
達成率の分母は `planned_on=今日`、分子はそのうち `status=done` の件数。取りやめ・アーカイブ・プロジェクトを除く。日付はドメインのタイムゾーンで判定する。対象0件は100%でなく「—」を表示する。期限超過を含む「本日のタスク」の件数とは意図的に異なり、画面に定義を明記する。ヒートマップのポイント計算は[タスクの集計契約](task-productivity-contacts.md)に従う。
|
||||
|
||||
## 配置と保存
|
||||
|
||||
デスクトップは12列グリッド。幅は3〜12列、高さは2〜10単位、1単位の表示基準は72pxと12pxの間隔。順序に従ってグリッドへ配置するため、幅の組み合わせによって空白が生じる。任意の絶対座標を保持するレイアウトではない。
|
||||
デスクトップは画面幅いっぱいの12列グリッド。幅は3〜12列、高さは2〜10単位、1単位の表示基準は72pxと12pxの間隔。順序に従ってグリッドへ配置するため、幅の組み合わせによって空白が生じる。任意の絶対座標を保持するレイアウトではない。
|
||||
|
||||
歯車で配置モードを開き、ハンドルのドラッグで並べ替え、右下のハンドルでサイズを変える。矢印ボタンと幅・高さの選択欄でも同じ操作が可能。追加・除去・初期配置への復帰に対応し、「配置を保存」で確定する。タブの選択も配置の一部として保存できる。未保存の離脱を警告し、保存失敗・競合時には編集中の配置を残す。ブラウザ再起動をまたぐ未保存レイアウトの下書きは持たない。
|
||||
|
||||
@@ -69,6 +109,28 @@ APIは `/_/api/v1/extension/organizer.tasks/` 配下。
|
||||
|
||||
## 検証と後続範囲
|
||||
|
||||
### タスク表示と参照
|
||||
|
||||
件名の保存形式は文字列のまま。Web一覧では太字、斜体、取り消し線、インラインコード、リンクのラベルをDOMで描画する。HTML・画像・マクロを実行しない。インライン編集のフォーカス中はMarkdownソースをそのまま入力できる。関連Wikiがある行は塗りつぶした文書アイコンとテーマ色で区別する。
|
||||
|
||||
`TaskRecord.references` はURLまたはWiki Pathの配列(最大20件、1件4096バイト)で、タスクの編集画面の詳細設定から変更する。http/httpsと同一サイトの絶対Pathだけを認め、認証情報入りURL・プロトコル相対URL・制御文字は拒否する。リンク先の取得や公開範囲の変更は行わない。Path参照は文字列のためrenameには追従しない。rename追従が必要な主たる関連Wikiには従来の `page_uuid` を使う。
|
||||
|
||||
正本JSONと変更履歴に参照を保存し、タスクの列追加は不要。旧CLI等がこのフィールドを省略した更新では既存値を維持し、明示的な空配列で解除する。CalDAV更新でも維持するが、VTODOのATTACHへの投影は後続範囲。
|
||||
|
||||
### タスクコマンド
|
||||
|
||||
`add task 件名`、`today UUID`、`tomorrow UUID`、`due UUID YYYY-MM-DD`、`due UUID clear`、`done UUID`、`delete UUID` を提供する。対象は件名検索のサジェストから選ぶとUUIDが入る(250ms debounce、最大10件)。シェルコマンドではない。追加は個人の既定値を読み、通信失敗時は同じUUIDで再試行できる。既存タスクへの操作は取得時のversionをIf-Matchで送信し、競合時は上書きしない。削除は件名を確認してから実行する。今日・明日はダッシュボード読込時のドメイン日付を基準とする。
|
||||
|
||||
### 個人の外観とログイン画面
|
||||
|
||||
壁紙Path・不透明度・グラス透明度・壁紙からの色抽出を個人設定へ追加する。トップ画面の歯車も同じ本人用保存先を使う。初回は既存のドメイン設定を初期値として引き継ぎ、保存後は個人値を優先する。空の壁紙Pathは「壁紙なし」。フォルダ選択時は従来どおり閲覧可能な直下の画像から選ぶ。
|
||||
|
||||
`personal_appearance` はDomain UUIDと本人UUIDを複合キーにしたJSON+versionのテーブル。起動時の設定テーブル初期化で追加する。既存テーブル・正本を破壊せず、保存はversion比較で競合409を返す。タスク既定値・メール同意のversionを変更しない。ドメイン設定画面の外観項目は初期値用として区別する。
|
||||
|
||||
ログイン画面は壁紙なしとし、旧 `/_/auth/wallpaper` は404を返す。個人・ドメインのトップ壁紙をログイン前に公開しない。別のログイン専用背景Pathは今回追加しない。
|
||||
|
||||
### 回帰検証
|
||||
|
||||
合成データで、所有者分離、CAS、読み取り専用、匿名拒否、管理設定への権限拡大がないこと、空配置、禁止ウィジェット、メール設定の不変、今日の集計・予定範囲を検証する。ブラウザではデスクトップとスマホの導線、タブ、設定保存、配置保存、横はみ出しを確認し、デスクトップのドラッグ・リサイズには実ポインター入力を使う。本番の外部取り込みカレンダーは検証に使わない。
|
||||
|
||||
次段階は以下を別途設計する。
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# メールWikiのPath依存404の調査
|
||||
|
||||
## 状態と回避策
|
||||
|
||||
2026年11月6日、別インスタンスでNeoMuttから作成したWikiが一覧には見える一方、`/tasks` とその配下への直接アクセスで `{"detail":"Not Found"}` になる報告があった。同じオブジェクトに `/prj/awesome` 側のリンクを追加すると表示できた。原因は未確定で、修正済みとは扱わない。
|
||||
|
||||
回避策は表示できるWiki親prefixを既定値にし、既存オブジェクトには別Pathのリンクを使うこと。メールの再取り込み、オブジェクトの削除、既存Pathの一括移動は不要。Pathごとに権限が異なりうるため、新しいリンク先の公開範囲も確認する。
|
||||
|
||||
## アプリ内で確認した境界
|
||||
|
||||
タスク画面は `/v/plan/tasks`、APIは `/_/api/v1/extension/organizer.tasks/`。`/tasks` は予約ルートではなく、通常のWiki Pathとして解決する。末尾スラッシュは301で取り除く。
|
||||
|
||||
NeoMuttの `pipe_decode=no`・`pipe_split=yes` 相当の標準入力を使い、CLIプロセスから一時DBのフルHTTPハンドラへ取り込む試験を追加した。42パターンは、親prefix7種類、UTF-8/ISO-2022-JPの件名、ML連番/Message-ID/原文hashの組合せ。公開CLI v0.4.0でも一覧のdata-path、直接表示、末尾スラッシュ、言語指定を確認し、代表3パターンをChromiumで表示した。実メール・実アカウント設定は使用しない。
|
||||
|
||||
Python・Chromiumに依存しないGoテストでは、実際のAPIへ既定prefix `/tasks` を設定して取り込み、同一オブジェクトの `/tasks/...` と `/prj/awesome` の両方がHTMLの200を返すことを検証する。未認証閲覧のログイン誘導、一覧表示、旧CLI形式も対象。CIでPythonがない場合もこのテストは実行される。
|
||||
|
||||
親に文書がない場合は、仮想フォルダページ無効ならHTMLの404、有効ならchildren一覧の200となる。これは作成済み子ページまでJSONの404になる報告とは区別する。設定箇所は `/-/sys/config?panel=home` の「仮想フォルダページ」。設定は対象ドメイン単位で、調査のために自動変更しない。
|
||||
|
||||
## 機密情報を共有しない切り分け
|
||||
|
||||
以下は問題のインスタンス内で行う。実URL・メール本文・Cookie・Bearer token・ログ全文を外部へ共有しない。
|
||||
|
||||
1. 問題のPathへのGET時刻を控え、PagesWikiプロセスのアクセスログに同じ要求が到達するか確認する。到達しない場合はプロキシ、ブラウザ、キャッシュなどアプリより手前を調べる。ログ出力先の取り違えにも注意する。
|
||||
2. 公開HTTPSとPagesWikiの直接待受で応答を比較する。Domainの振り分けが変わらないよう、同じHostとPathを使う。まず資格情報なし・リダイレクトを追わないGETのstatusとContent-Typeを比較すれば、メール本文を取得せずに判断できる。認証後の比較が必要ならローカル環境内の安全な手順を使い、コマンド履歴に資格情報を残さない。
|
||||
3. 直接待受は正常でプロキシ経由だけ失敗する場合、`/tasks` に一致するlocation、正規表現location、rewrite、別upstream、Custom Locationsを確認する。実際の設定で確認できるまではプロキシが原因と断定しない。
|
||||
4. PagesWikiへの直接要求も失敗する場合は、稼働イメージrevision、HostによるDomain選択、Path別ACL、既存リンクの対象UUIDをローカルで確認する。同一オブジェクトの別名が読めても、元Pathの権限が同じとは限らない。
|
||||
|
||||
X-Request-IDやServerヘッダーだけで応答元を断定しない。プロキシによる付加・上書きがありうる。原因が判明するまで、推測による `/tasks` 専用ルート追加や権限の緩和はしない。
|
||||
|
||||
## 回帰テストと残件
|
||||
|
||||
```sh
|
||||
go test ./internal/server -run 'TestTaskWikiPrefixRouting|TestNeoMuttMailViewerFlow' -count=1
|
||||
# Chromiumがある開発環境のみ
|
||||
PAGESWIKI_BROWSER_TEST=1 go test ./internal/server -run '^TestNeoMuttMailViewerFlow$' -count=1
|
||||
# 配布ELFでも同じ一時プロファイルを用いて確認する場合
|
||||
PAGES_CLI_TEST_BINARY=/absolute/path/to/pages PAGESWIKI_BROWSER_TEST=1 go test ./internal/server -run '^TestNeoMuttMailViewerFlow$' -count=1
|
||||
```
|
||||
|
||||
- [x] `/tasks` 配下のメール作成から通常ビューアまでの合成HTTP試験。
|
||||
- [x] 同一オブジェクトの別名、親の仮想フォルダ設定、認証境界のGo回帰テスト。
|
||||
- [ ] 問題インスタンスで、直接待受とプロキシ経由の差分を確定する。
|
||||
- [ ] 特定された原因に修正を適用し、元の `/tasks` でも表示できることを確認する。
|
||||
|
||||
テストと調査記録の追加は障害修正リリースではない。既存の回避策とデータを維持する。
|
||||
@@ -0,0 +1,39 @@
|
||||
# PagesWiki v0.16.0
|
||||
|
||||
2026-11-09 05:58:14 JSTに本番の配備後確認を完了しました。CSVの表編集・複数セル貼り付けと、Reveal.jsのビューア・編集プレビューを追加します。
|
||||
|
||||
## 変更と利用方法
|
||||
|
||||
- 既存CSVを `/e/-/{path}` で表編集。行列操作、Undo/Redo、タブ区切りの複数セル貼り付け、既存の下書き・履歴・競合確認に対応します。未変更セルの引用符・BOM・改行を保持し、上限超過時は部分反映しません。
|
||||
- HTMLページのスライドアイコン、または `/v/slides/{path}` でReveal.js表示。エディタのスライドアイコンで未保存HTML/Markdownをプレビューします。Markdownの空行で囲んだ `---`、HTML直下の `<hr>` で区切ります。
|
||||
- Reveal.js 6.0.2をMITライセンスとともにローカル同梱。sandbox、Path認可、入力上限、テーマ追従、スマホの全幅プレビューに対応。拡張設定の `viewer.slides` でドメイン単位に停止できます。
|
||||
|
||||
CSVは全体256 KiB、表200行・32列・セル16 KiB以内。スライドは256 KiB・100枚以内です。縦スライド・発表者ノート・専用印刷・外部画像承認連携は含みません。通常HTMLの自動表示をスライドへ置き換えません。
|
||||
|
||||
## リリースと検証
|
||||
|
||||
対象commitは `02fb77f72b45c342c6b458d733f840b38cc3ae56`。[build 80](https://git.anya.jp/anya/pages/actions/runs/80)と[release 81](https://git.anya.jp/anya/pages/actions/runs/81)が成功し、同じSHAのイメージを再ビルドせずv0.16.0へ昇格しました。
|
||||
|
||||
開発環境で全Goテスト・go vet・JS単体テスト、1280px/390pxのChromium試験を実施しました。CSV保存・競合・履歴・貼り付け拒否、スライドのライブ更新・通常プレビュー復帰・左右キー・履歴非変更・隔離を確認しています。
|
||||
|
||||
本番ではapp・app2・adaptor-gateway・excalidraw-viewerのrevision一致、running、再起動0を確認。両アプリのhealth、外部HTTPSのhealth/login 200、匿名タスク・スライドの303、タスクAPIの401を確認しました。CSV/Reveal.js関連の11配信ファイルはリリースcommitとSHA-256一致。両DBのquick_checkはok、管理対象13componentはcurrentで版変更なしです。legacy領域全体の移行検証を意味しません。起動直後のpanic・fatal・DB/schema失敗・event job失敗に該当するログはありませんでした。
|
||||
|
||||
本番の実コンテンツを編集する試験、外部カレンダー・メール内容の取得は行っていません。pages-cliは変更せず、Gecko relayも起動していません。
|
||||
|
||||
## 保全と切替
|
||||
|
||||
DBスキーマ・ストレージ形式の変更はありません。保全先は `.deployment-backups/release-v0.16.0-20261109/`。`config/` に旧設定、`cutover/data` と `cutover/data2` に停止時点のファイルを保持しています。DBだけは容量を考慮して `pages.db.gz` とし、gzip検査と展開内容のバイト一致を確認しました。他のファイルは停止時checksum比較で一致しています。復旧用に展開する場合は、稼働DBを上書きせず別の停止済み復旧領域に `pages.db` として展開します。
|
||||
|
||||
初回は圧縮で変わったバックアップ先フォルダmtimeを厳密差分検査が検出し、新版起動前にv0.15.0へ自動復帰しました。圧縮後にフォルダmtimeを元に合わせる修正を行い、内容の検証は省略せず再実行しています。再試行は05:54:59 JSTに停止、05:57:28にバックアップ検証完了、05:57:34に新版health確認完了です。
|
||||
|
||||
旧イメージは `rollback-before-v0.16.0-20261109` タグで保持し、過去のバックアップも削除していません。今回のUI機能を切り戻す場合はwriterを止め、現データを保持してv0.15.0のイメージへ戻せます。バックアップ時点へのデータ復旧を選ぶ場合は、切替後の書き込みを別途保全して差分を扱い、黙って破棄しません。
|
||||
|
||||
`.env.release` は `PAGESWIKI_IMAGE_TAG=v0.16.0`。配備後の空き容量は約8.1 GiBのため、次の大きなビルド・バックアップの前に保持世代と不要キャッシュの整理が必要です。
|
||||
|
||||
## 配備イメージ
|
||||
|
||||
- `pageswiki-app`: `sha256:428f4c38297e7d2b529af13b32d45e6a9b40f58915fbd170148a0ad07958a034`
|
||||
- `pageswiki-adaptor-gateway`: `sha256:cdf99b4f02a9abade8862caea1c23cfe775f229118c5c1aabf2584d84a02be50`
|
||||
- `pageswiki-excalidraw-viewer`: `sha256:854fa1d0bb931642e81af394ab4631b47397a94264eb1b34d4f8ff0ca5435e25`
|
||||
|
||||
レジストリのprefixは `git.anya.jp/anya/`、共通タグは `v0.16.0` です。
|
||||
@@ -3,6 +3,8 @@ package grammaratur
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -12,17 +14,93 @@ import (
|
||||
|
||||
// HTMLToMarkdownAuthoring keeps source HTML when conversion loses structure,
|
||||
// attributes, comments or text. This is not a sanitization boundary.
|
||||
var nestedListGap = regexp.MustCompile(`\n[\t ]*\n([\t ]+(?:[-+*]|[0-9]+\.) )`)
|
||||
|
||||
func authoringMarkdown(source string) (string, error) {
|
||||
md, err := HTMLToMarkdown(source)
|
||||
if err != nil {
|
||||
return md, err
|
||||
}
|
||||
// The converter inserts a loose-list gap before nested lists. Only accept
|
||||
// tightening when the resulting DOM matches; code and real paragraphs stay protected.
|
||||
tight := nestedListGap.ReplaceAllString(md, "\n$1")
|
||||
if tight != md && htmlStructure(source) == htmlStructure(MarkdownToHTML(tight)) {
|
||||
return tight, nil
|
||||
}
|
||||
return md, nil
|
||||
}
|
||||
|
||||
func HTMLToMarkdownAuthoring(source string) (string, error) {
|
||||
converted, err := HTMLToMarkdown(source)
|
||||
converted, err := authoringMarkdown(source)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if htmlStructure(source) != htmlStructure(MarkdownToHTML(converted)) {
|
||||
return rawHTMLBlock(source), nil
|
||||
// Protect only the blocks which cannot round-trip. One custom component
|
||||
// must not turn the headings, lists and paragraphs around it into HTML.
|
||||
blocks, ok := authoringBlocks(source)
|
||||
if !ok {
|
||||
return rawHTMLBlock(source), nil
|
||||
}
|
||||
var parts []string
|
||||
for _, raw := range blocks {
|
||||
if strings.TrimSpace(raw) == "" {
|
||||
continue
|
||||
}
|
||||
md, e := authoringMarkdown(raw)
|
||||
if e != nil || htmlStructure(raw) != htmlStructure(MarkdownToHTML(md)) {
|
||||
md = rawHTMLBlock(raw)
|
||||
}
|
||||
parts = append(parts, md)
|
||||
}
|
||||
mixed := strings.Join(parts, "\n\n")
|
||||
// Includes head content, comments outside body and fragment edge cases.
|
||||
if htmlStructure(source) != htmlStructure(MarkdownAuthoringHTML(mixed)) {
|
||||
return rawHTMLBlock(source), nil
|
||||
}
|
||||
return mixed, nil
|
||||
}
|
||||
return converted, nil
|
||||
}
|
||||
|
||||
// Token boundaries retain the exact source of protected components (including
|
||||
// attribute quoting and void-element syntax). Never serialize the parsed DOM
|
||||
// back over their source. Malformed/implicit nesting uses whole-document fallback.
|
||||
func authoringBlocks(source string) ([]string, bool) {
|
||||
z := html.NewTokenizer(strings.NewReader(source))
|
||||
var stack, blocks []string
|
||||
start, offset := 0, 0
|
||||
for {
|
||||
kind := z.Next()
|
||||
if kind == html.ErrorToken {
|
||||
return blocks, z.Err() == io.EOF && len(stack) == 0 && offset == len(source)
|
||||
}
|
||||
offset += len(z.Raw())
|
||||
switch kind {
|
||||
case html.StartTagToken:
|
||||
name, _ := z.TagName()
|
||||
switch string(name) {
|
||||
case "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr":
|
||||
default:
|
||||
stack = append(stack, string(name))
|
||||
}
|
||||
case html.EndTagToken:
|
||||
name, _ := z.TagName()
|
||||
if len(stack) == 0 || stack[len(stack)-1] != string(name) {
|
||||
return nil, false
|
||||
}
|
||||
stack = stack[:len(stack)-1]
|
||||
}
|
||||
if len(stack) == 0 {
|
||||
blocks = append(blocks, source[start:offset])
|
||||
start = offset
|
||||
if len(blocks) > 1024 {
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// {=html} is an explicit authoring fence, not an ordinary code sample. The
|
||||
// closing delimiter is longer than any run in the source, so arbitrary HTML
|
||||
// (including Markdown examples) cannot accidentally terminate it.
|
||||
@@ -110,6 +188,28 @@ func htmlStructure(source string) string {
|
||||
literal = literal || n.Data == "pre" || n.Data == "code" || n.Data == "script" || n.Data == "style"
|
||||
data := n.Data
|
||||
if n.Type == html.TextNode && !literal {
|
||||
// Formatting whitespace beside a nested block is not an inline word
|
||||
// separator. Keep all whitespace between inline siblings significant.
|
||||
if n.Parent != nil && n.Parent.Data == "li" {
|
||||
isList := func(x *html.Node) bool {
|
||||
return x != nil && x.Type == html.ElementNode && (x.Data == "ul" || x.Data == "ol")
|
||||
}
|
||||
if isList(n.NextSibling) {
|
||||
data = strings.TrimRight(data, " \t\r\n")
|
||||
}
|
||||
if isList(n.PrevSibling) {
|
||||
data = strings.TrimLeft(data, " \t\r\n")
|
||||
}
|
||||
if data == "" {
|
||||
return
|
||||
}
|
||||
}
|
||||
if strings.TrimSpace(data) == "" && n.Parent != nil {
|
||||
switch n.Parent.Data {
|
||||
case "ul", "ol", "table", "thead", "tbody", "tfoot", "tr":
|
||||
return
|
||||
}
|
||||
}
|
||||
if strings.TrimSpace(data) == "" && (n.Parent == nil || n.Parent.Data == "body" || n.Parent.Data == "html") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -65,3 +65,19 @@ func TestAuthoringWhitespaceComparisonIsConservative(t *testing.T) {
|
||||
t.Fatal("word boundaries ignored")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthoringPartialMarkdownRecovery(t *testing.T) {
|
||||
source := `<h1>Title</h1><p>Some <strong>bold</strong> text.</p><figure data-x="keep"><img src="/image"><figcaption>Caption</figcaption></figure><ul><li>First</li><li>Second</li></ul>`
|
||||
md, err := HTMLToMarkdownAuthoring(source)
|
||||
if err != nil || !strings.HasPrefix(md, "# Title") || !strings.Contains(md, "**bold**") || strings.Count(md, "{=html}") != 1 || !strings.Contains(md, "- First") {
|
||||
t.Fatalf("markdown not recovered: %q %v", md, err)
|
||||
}
|
||||
if htmlStructure(source) != htmlStructure(MarkdownAuthoringHTML(md)) {
|
||||
t.Fatal("HTML lost during partial conversion")
|
||||
}
|
||||
protected := `<figure data-x='original'><img src=/image><figcaption>Caption</figcaption></figure>`
|
||||
md, err = HTMLToMarkdownAuthoring("<h1>Title</h1>" + protected + "<p>Tail</p>")
|
||||
if err != nil || !strings.Contains(MarkdownAuthoringHTML(md), protected) || !strings.HasPrefix(md, "# Title") {
|
||||
t.Fatalf("protected bytes changed: %q %v", md, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package grammaratur
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAuthoringNestedLists(t *testing.T) {
|
||||
for _, source := range []string{
|
||||
"<ul><li>Parent<ul><li>Child</li></ul></li></ul>",
|
||||
"<ul>\n<li>Parent\n<ul>\n<li>Child</li>\n</ul>\n</li>\n</ul>",
|
||||
"<ul><li>Parent<ul><li>Child<ul><li>Grandchild</li></ul></li></ul></li><li>Sibling</li></ul>",
|
||||
"<ol><li>Parent<ul><li>Child</li></ul></li></ol>",
|
||||
"<ul><li><strong>Parent</strong><ul><li>Child</li></ul></li></ul>",
|
||||
} {
|
||||
md, err := HTMLToMarkdownAuthoring(source)
|
||||
if htmlStructure(source) != htmlStructure(MarkdownAuthoringHTML(md)) {
|
||||
t.Errorf("list structure changed: %q", md)
|
||||
}
|
||||
if err != nil || strings.Contains(md, "{=html}") {
|
||||
plain, _ := HTMLToMarkdown(source)
|
||||
t.Errorf("source=%q md=%q plain=%q rendered=%q err=%v", source, md, plain, MarkdownToHTML(plain), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthoringNestedListPreservesAttributes(t *testing.T) {
|
||||
source := `<ul><li data-custom="keep">Parent<ul><li>Child</li></ul></li></ul>`
|
||||
md, err := HTMLToMarkdownAuthoring(source)
|
||||
if err != nil || MarkdownAuthoringHTML(md) != source {
|
||||
t.Fatalf("protected list changed: %q %v", md, err)
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -321,13 +320,6 @@ func (s *Server) renderAuthPage(w http.ResponseWriter, r *http.Request, data map
|
||||
transparency := s.homeGlassTransparency(domainUUID)
|
||||
data["HomeGlassTransparency"] = transparency
|
||||
data["HomeGlassOpacity"] = 100 - transparency
|
||||
configured, opacity := s.homeWallpaperConfig(domainUUID)
|
||||
data["HomeWallpaperOpacity"] = strconv.FormatFloat(float64(opacity)/100, 'f', 2, 64)
|
||||
if configured != "" {
|
||||
// Only the administrator-selected login wallpaper is exposed; the
|
||||
// request cannot choose an arbitrary document address.
|
||||
data["HomeWallpaperURL"] = "/_/auth/wallpaper"
|
||||
w.Header().Set("Cache-Control", "private, no-store")
|
||||
}
|
||||
// Login has no wallpaper: private home images must not become public.
|
||||
s.renderWithContext(w, r, "auth.gohtml", data)
|
||||
}
|
||||
@@ -72,6 +72,15 @@ func TestCalendarUpcomingDefaultsAndBounds(t *testing.T) {
|
||||
t.Fatal("tomorrow event in today's widget", event.Start)
|
||||
}
|
||||
}
|
||||
w = calendarRequest(s, token, "GET", calendarAPI+"upcoming?period=day&date="+end.Format("2006-01-02"), "", "")
|
||||
if w.Code != 200 || json.Unmarshal(w.Body.Bytes(), &result) != nil {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
for _, event := range result.Events {
|
||||
if !event.Start.Before(end.AddDate(0, 0, 1)) || !event.End.After(end) {
|
||||
t.Fatal("event outside tomorrow", event.Start, event.End)
|
||||
}
|
||||
}
|
||||
if w = calendarRequest(s, "", "GET", calendarAPI+"upcoming", "", ""); w.Code != 403 {
|
||||
t.Fatal("anonymous access", w.Code)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"math/big"
|
||||
"mime"
|
||||
@@ -9,7 +8,6 @@ import (
|
||||
pathpkg "path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"pageswiki/internal/store"
|
||||
)
|
||||
@@ -23,75 +21,16 @@ type homeWallpaperView struct {
|
||||
Key string
|
||||
}
|
||||
|
||||
// configuredLoginWallpaper returns only the image selected by the Domain
|
||||
// administrator as the home/login wallpaper. It intentionally does not use
|
||||
// the requesting principal's document permissions: choosing an image as the
|
||||
// login wallpaper makes that one image public on the sign-in surface.
|
||||
func (s *Server) configuredLoginWallpaper(domainUUID string) *store.Revision {
|
||||
configured, _ := s.homeWallpaperConfig(domainUUID)
|
||||
if configured == "" {
|
||||
return nil
|
||||
}
|
||||
if objectUUID, err := s.store.ResolvePathInDomain(domainUUID, configured); err == nil {
|
||||
revision, revisionErr := s.store.GetLatestRevisionForLanguages(objectUUID, []string{s.getLocale(domainUUID), "und"})
|
||||
if revisionErr == nil && imageContentType(revision.ContentType) {
|
||||
return revision
|
||||
}
|
||||
}
|
||||
entries, err := s.store.ListBrowserEntriesInDomain(domainUUID, configured)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
candidates := make([]store.BrowserEntry, 0, len(entries))
|
||||
for _, entry := range entries {
|
||||
if !entry.IsDir && entry.RevisionUUID != "" && imageContentType(entry.ContentType) {
|
||||
candidates = append(candidates, entry)
|
||||
}
|
||||
}
|
||||
if len(candidates) == 0 {
|
||||
return nil
|
||||
}
|
||||
index := 0
|
||||
if value, randomErr := rand.Int(rand.Reader, big.NewInt(int64(len(candidates)))); randomErr == nil {
|
||||
index = int(value.Int64())
|
||||
}
|
||||
revision, err := s.store.GetRevision(candidates[index].RevisionUUID)
|
||||
if err != nil || !imageContentType(revision.ContentType) {
|
||||
return nil
|
||||
}
|
||||
return revision
|
||||
}
|
||||
|
||||
// Legacy route retained as a deliberate 404. Home wallpapers are never
|
||||
// published to unauthenticated clients through the sign-in screen.
|
||||
func (s *Server) handleAuthWallpaper(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet && r.Method != http.MethodHead {
|
||||
w.Header().Set("Allow", "GET, HEAD")
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
revision := s.configuredLoginWallpaper(s.domainUUIDForRequest(r))
|
||||
if revision == nil {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
contentType := revision.ContentType
|
||||
mediaType, _, err := mime.ParseMediaType(contentType)
|
||||
if err != nil || !strings.HasPrefix(strings.ToLower(mediaType), "image/") {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
filename := strings.TrimSpace(revision.Filename)
|
||||
if filename == "" {
|
||||
filename = "wallpaper"
|
||||
}
|
||||
w.Header().Set("Cache-Control", "private, no-store")
|
||||
w.Header().Set("Content-Type", contentType)
|
||||
w.Header().Set("Content-Disposition", mime.FormatMediaType("inline", map[string]string{"filename": filename}))
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
w.Header().Set("ETag", `"`+revision.DocumentHash+`"`)
|
||||
if strings.EqualFold(mediaType, "image/svg+xml") {
|
||||
w.Header().Set("Content-Security-Policy", "default-src 'none'; sandbox")
|
||||
}
|
||||
http.ServeContent(w, r, filename, time.UnixMilli(revision.CreatedAtMS), bytes.NewReader([]byte(revision.Body)))
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
|
||||
func normalizePickerPath(raw string) (string, bool) {
|
||||
@@ -135,7 +74,8 @@ func (s *Server) homeWallpaperConfig(domainUUID string) (string, int) {
|
||||
|
||||
func (s *Server) homeWallpaperForRequest(r *http.Request) homeWallpaperView {
|
||||
domainUUID := s.domainUUIDForRequest(r)
|
||||
configured, opacity := s.homeWallpaperConfig(domainUUID)
|
||||
p := s.appearanceForRequest(r)
|
||||
configured, opacity := p.Path, p.Opacity
|
||||
view := homeWallpaperView{Path: configured, Opacity: strconv.FormatFloat(float64(opacity)/100, 'f', 2, 64)}
|
||||
if configured == "" {
|
||||
return view
|
||||
|
||||
@@ -22,7 +22,7 @@ func saveWallpaperFixture(t *testing.T, s *Server, domain, path, contentType str
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthPageUsesConfiguredWallpaperAndGlass(t *testing.T) {
|
||||
func TestAuthPageDoesNotPublishHomeWallpaper(t *testing.T) {
|
||||
s, _, domain := configFixture(t)
|
||||
s.mux.HandleFunc("/_/auth/", s.handleAuth)
|
||||
saveWallpaperFixture(t, s, domain, "/wallpapers/login.jpg", "image/jpeg")
|
||||
@@ -46,8 +46,6 @@ func TestAuthPageUsesConfiguredWallpaperAndGlass(t *testing.T) {
|
||||
for _, expected := range []string{
|
||||
`class="auth-page"`,
|
||||
`--home-glass-opacity:53%`,
|
||||
`class="home-wallpaper" src="/_/auth/wallpaper"`,
|
||||
`style="opacity:0.41"`,
|
||||
`/static/css/auth.css?v=1`,
|
||||
`class="auth-provider-button"`,
|
||||
`OpenID Connectでログイン`,
|
||||
@@ -56,10 +54,13 @@ func TestAuthPageUsesConfiguredWallpaperAndGlass(t *testing.T) {
|
||||
t.Fatalf("auth page missing %q: status=%d body=%s", expected, response.Code, body)
|
||||
}
|
||||
}
|
||||
if strings.Contains(body, `class="home-wallpaper"`) || strings.Contains(body, `/_/auth/wallpaper`) {
|
||||
t.Fatal("private home wallpaper exposed at login")
|
||||
}
|
||||
|
||||
wallpaper := httptest.NewRecorder()
|
||||
s.withAuthorization(s.mux).ServeHTTP(wallpaper, httptest.NewRequest(http.MethodGet, "http://localhost/_/auth/wallpaper?path=/private/ignored", nil))
|
||||
if wallpaper.Code != http.StatusOK || wallpaper.Body.String() != "fixture" || wallpaper.Header().Get("Content-Type") != "image/jpeg" || wallpaper.Header().Get("X-Content-Type-Options") != "nosniff" {
|
||||
if wallpaper.Code != http.StatusNotFound || wallpaper.Body.String() == "fixture" {
|
||||
t.Fatalf("login wallpaper: status=%d type=%q body=%q", wallpaper.Code, wallpaper.Header().Get("Content-Type"), wallpaper.Body.String())
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ var translations = map[string]map[string]string{
|
||||
"home.palette_brightness": "Light and dark",
|
||||
"home.palette_preserve": "Keep the current theme brightness",
|
||||
"home.palette_auto": "Choose from the displayed wallpaper",
|
||||
"home.palette_help": "Applies only to the home page and its dialogs. Warning colors are preserved. If extraction fails, the selected theme remains. Shared by this domain.",
|
||||
"home.palette_help": "Applies only to the home page and its dialogs. Warning colors are preserved. If extraction fails, the selected theme remains.",
|
||||
"home.glass_transparency": "Glass transparency (%)",
|
||||
"home.glass_help": "Controls the shared transparency of the home search, menus, suggestions, cards, and dialogs. Higher values are more transparent.",
|
||||
"picker.open": "Browse PagesWiki",
|
||||
@@ -330,6 +330,8 @@ var translations = map[string]map[string]string{
|
||||
"viewer.metadata_unavailable": "The metadata queue is unavailable. Download is still available.",
|
||||
"viewer.archive_truncated": "The listing limit was reached. Download the archive for the complete contents.",
|
||||
"history.title": "Revision History",
|
||||
"history.message": "Change message",
|
||||
"history.message_optional": "Optional summary of changes",
|
||||
"history.older": "Older revisions",
|
||||
"history.newest": "Newest revisions",
|
||||
"history.view": "View",
|
||||
@@ -1019,7 +1021,7 @@ var translations = map[string]map[string]string{
|
||||
"home.palette_brightness": "明暗",
|
||||
"home.palette_preserve": "現在のテーマの明暗を維持",
|
||||
"home.palette_auto": "表示中の壁紙から自動判定",
|
||||
"home.palette_help": "トップ画面とその上のダイアログにのみ適用します。警告色は変更しません。色を抽出できない場合は選択中のテーマを維持します。このドメインで共通の設定です。",
|
||||
"home.palette_help": "トップ画面とその上のダイアログにのみ適用します。警告色は変更しません。色を抽出できない場合は選択中のテーマを維持します。",
|
||||
"home.glass_transparency": "グラスの透明度(%)",
|
||||
"home.glass_help": "トップ画面の検索、メニュー、サジェスト、カード、ダイアログに共通の透明度です。数値を上げるほど背景が透けます。",
|
||||
"picker.open": "PagesWikiから選択",
|
||||
@@ -1120,6 +1122,8 @@ var translations = map[string]map[string]string{
|
||||
"viewer.metadata_unavailable": "メタデータの待ち行列を利用できません。ダウンロードは利用できます。",
|
||||
"viewer.archive_truncated": "表示件数の上限に達しました。全内容はダウンロードして確認してください。",
|
||||
"history.title": "リビジョン履歴",
|
||||
"history.message": "更新メッセージ",
|
||||
"history.message_optional": "変更内容(任意)",
|
||||
"history.older": "以前のリビジョン",
|
||||
"history.newest": "最新のリビジョン",
|
||||
"history.view": "表示",
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func personalOrganizerSettings(r *http.Request) bool {
|
||||
return r.URL.Path == "/-/sys/config" && r.URL.Query().Get("panel") == "organizer" && (r.Method == "GET" || r.Method == "HEAD")
|
||||
return r.URL.Path == "/-/sys/config" && r.URL.Query().Get("panel") == "organizer" && (r.Method == "GET" || r.Method == "HEAD" || r.Method == "POST" && r.URL.Query().Get("section") == "appearance")
|
||||
}
|
||||
|
||||
func (s *Server) handleOrganizerDashboard(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -33,7 +33,13 @@ func (s *Server) handleOrganizerSettings(w http.ResponseWriter, r *http.Request)
|
||||
s.authRequired(w, r)
|
||||
return
|
||||
}
|
||||
s.renderWithContext(w, r, "organizer_settings.gohtml", map[string]any{"TaskWritable": active})
|
||||
if r.Method == "POST" {
|
||||
s.savePersonalAppearance(w, r, actor, active)
|
||||
return
|
||||
}
|
||||
data := s.appearanceData(r)
|
||||
data["TaskWritable"] = active
|
||||
s.renderWithContext(w, r, "organizer_settings.gohtml", data)
|
||||
}
|
||||
|
||||
func (s *Server) handleDashboardData(w http.ResponseWriter, r *http.Request, actor string, active bool, kind string) {
|
||||
@@ -110,6 +116,12 @@ func organizerSection(path string) string {
|
||||
}
|
||||
|
||||
func init() {
|
||||
translations["en"]["home.domain_appearance_defaults"] = "Appearance defaults (personal settings take precedence)"
|
||||
translations["ja"]["home.domain_appearance_defaults"] = "外観の初期値(個人設定を優先)"
|
||||
translations["en"]["home.personal_wallpaper"] = "Personal wallpaper Path (empty: none)"
|
||||
translations["ja"]["home.personal_wallpaper"] = "個人の壁紙Path(空欄:なし)"
|
||||
translations["en"]["home.personal_opacity"] = "Wallpaper opacity (%)"
|
||||
translations["ja"]["home.personal_opacity"] = "壁紙の不透明度(%)"
|
||||
translations["en"]["task.work_history"] = "Work history"
|
||||
translations["ja"]["task.work_history"] = "作業記録"
|
||||
for lang, entries := range map[string]map[string]string{
|
||||
|
||||
@@ -69,12 +69,22 @@ func TestOrganizerDashboardLayoutIsolationAndCAS(t *testing.T) {
|
||||
if err = json.Unmarshal(w.Body.Bytes(), &layout); err != nil || len(layout.Widgets) != 0 {
|
||||
t.Fatal("empty layout reset", layout, err)
|
||||
}
|
||||
for _, invalid := range [][]store.DashboardWidget{{{ID: "iframe", Width: 4, Height: 3}}, {{ID: "tasks", Width: 13, Height: 3, Tab: "inbox"}}, {{ID: "tasks", Width: 4, Height: 3, Tab: "secret"}}, {{ID: "progress", Width: 4, Height: 3}, {ID: "progress", Width: 4, Height: 3}}} {
|
||||
for _, invalid := range [][]store.DashboardWidget{{{ID: "iframe", Width: 4, Height: 3}}} {
|
||||
w = taskRequest(s, token, "PUT", "dashboard", map[string]any{"version": layout.Version, "widgets": invalid}, "")
|
||||
if w.Code != 422 {
|
||||
t.Fatal("invalid accepted", w.Code, w.Body)
|
||||
}
|
||||
}
|
||||
for _, id := range []string{"commands", "tomorrow-schedule", "feeds"} {
|
||||
input := []store.DashboardWidget{{ID: "tasks", Width: 13, Height: 0}, {ID: id, Width: 6, Height: 4, Tab: "obsolete"}, {ID: id, Width: 6, Height: 4}}
|
||||
w = taskRequest(s, token, "PUT", "dashboard", map[string]any{"version": layout.Version, "widgets": input}, "")
|
||||
if w.Code != 200 {
|
||||
t.Fatal("normalizable layout rejected", w.Code, w.Body)
|
||||
}
|
||||
if err = json.Unmarshal(w.Body.Bytes(), &layout); err != nil || len(layout.Widgets) != 2 || layout.Widgets[0].Width != 12 || layout.Widgets[0].Height != 2 || layout.Widgets[0].Tab != "inbox" || layout.Widgets[1].Tab != "" {
|
||||
t.Fatal("normalization", layout, err)
|
||||
}
|
||||
}
|
||||
other, err := s.store.CreatePasswordAccount(domain, "dashboardother", "long test password", "Other", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Personal appearance is separate from domain defaults and from organizer mail
|
||||
// preferences. It never makes the selected documents publicly readable.
|
||||
type personalAppearance struct {
|
||||
Version int64
|
||||
Path string
|
||||
Opacity int
|
||||
Glass int
|
||||
Palette homePaletteSettings
|
||||
}
|
||||
|
||||
func (s *Server) appearanceForRequest(r *http.Request) personalAppearance {
|
||||
domain := s.domainUUIDForRequest(r)
|
||||
path, opacity := s.homeWallpaperConfig(domain)
|
||||
p := personalAppearance{Path: path, Opacity: opacity, Glass: s.homeGlassTransparency(domain), Palette: s.homePalette(domain)}
|
||||
principal := s.requestPrincipal(r)
|
||||
if principal == nil {
|
||||
return p
|
||||
}
|
||||
var raw string
|
||||
var version int64
|
||||
if s.store.DB.QueryRowContext(r.Context(), `SELECT version,data FROM personal_appearance WHERE domain_uuid=? AND owner_uuid=?`, domain, principal.UUID).Scan(&version, &raw) == nil {
|
||||
var saved personalAppearance
|
||||
if json.Unmarshal([]byte(raw), &saved) == nil {
|
||||
saved.Version = version
|
||||
return saved
|
||||
}
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
func (s *Server) appearanceData(r *http.Request) map[string]any {
|
||||
p := s.appearanceForRequest(r)
|
||||
return map[string]any{"AppearanceVersion": p.Version, "HomeWallpaperPath": p.Path, "HomeWallpaperPercent": p.Opacity, "HomeGlassTransparency": p.Glass, "HomePalette": p.Palette}
|
||||
}
|
||||
|
||||
func (s *Server) savePersonalAppearance(w http.ResponseWriter, r *http.Request, actor string, active bool) {
|
||||
if !active || s.store.ReadOnly {
|
||||
http.Error(w, "forbidden", 403)
|
||||
return
|
||||
}
|
||||
r.Body = http.MaxBytesReader(w, r.Body, 16384)
|
||||
if r.ParseForm() != nil {
|
||||
http.Error(w, "invalid form", 400)
|
||||
return
|
||||
}
|
||||
domain := s.domainUUIDForRequest(r)
|
||||
p := s.appearanceForRequest(r)
|
||||
version, err := strconv.ParseInt(r.FormValue("version"), 10, 64)
|
||||
if err != nil || version < 0 {
|
||||
http.Error(w, "invalid version", 400)
|
||||
return
|
||||
}
|
||||
if p.Version != version {
|
||||
http.Error(w, "Settings changed elsewhere; reload before saving.", 409)
|
||||
return
|
||||
}
|
||||
if p.Glass, err = normalizeHomeGlassTransparency(r.FormValue("home_glass_transparency")); err != nil {
|
||||
http.Error(w, "invalid transparency", 400)
|
||||
return
|
||||
}
|
||||
if p.Palette, err = s.parseHomePalette(domain, r.Form); err != nil {
|
||||
http.Error(w, "invalid palette", 400)
|
||||
return
|
||||
}
|
||||
if r.Form.Has("home_wallpaper_path") {
|
||||
var ok bool
|
||||
p.Path, ok = normalizePickerPath(r.FormValue("home_wallpaper_path"))
|
||||
if !ok {
|
||||
http.Error(w, "invalid Path", 400)
|
||||
return
|
||||
}
|
||||
if p.Path != "" && !s.requestCanReadPath(r, p.Path) {
|
||||
http.Error(w, "Path not readable", 403)
|
||||
return
|
||||
}
|
||||
}
|
||||
if r.Form.Has("home_wallpaper_opacity") {
|
||||
p.Opacity, err = strconv.Atoi(r.FormValue("home_wallpaper_opacity"))
|
||||
if err != nil || p.Opacity < 0 || p.Opacity > 100 {
|
||||
http.Error(w, "invalid opacity", 400)
|
||||
return
|
||||
}
|
||||
}
|
||||
p.Version = version + 1
|
||||
raw, _ := json.Marshal(p)
|
||||
result, err := s.store.DB.ExecContext(r.Context(), `INSERT INTO personal_appearance(domain_uuid,owner_uuid,version,data) SELECT ?,?,?,? WHERE ?=0 ON CONFLICT(domain_uuid,owner_uuid) DO NOTHING`, domain, actor, p.Version, string(raw), version)
|
||||
if err == nil {
|
||||
var n int64
|
||||
n, err = result.RowsAffected()
|
||||
if err == nil && n == 0 {
|
||||
result, err = s.store.DB.ExecContext(r.Context(), `UPDATE personal_appearance SET version=?,data=? WHERE domain_uuid=? AND owner_uuid=? AND version=?`, p.Version, string(raw), domain, actor, version)
|
||||
if err == nil {
|
||||
n, err = result.RowsAffected()
|
||||
if n == 0 {
|
||||
err = sql.ErrNoRows
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
http.Error(w, "Settings changed elsewhere; reload before saving.", 409)
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
http.Error(w, "Unable to save settings", 500)
|
||||
return
|
||||
}
|
||||
if r.Header.Get("Accept") == "application/json" {
|
||||
writeEventJSON(w, 200, map[string]any{"version": p.Version})
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/-/sys/config?panel=organizer#appearance", http.StatusSeeOther)
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPersonalAppearanceIsolationAndCAS(t *testing.T) {
|
||||
s, admin, domain := configFixture(t)
|
||||
p, err := s.store.CreatePasswordAccount(domain, "appearanceuser", "long test password", "Member", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
token, err := s.store.CreateAuthSession(domain, p.UUID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
endpoint := "/-/sys/config?panel=organizer§ion=appearance"
|
||||
form := url.Values{"version": {"0"}, "home_wallpaper_path": {""}, "home_wallpaper_opacity": {"50"}, "home_glass_transparency": {"71"}, "home_palette_mode": {"accent"}, "home_palette_strength": {"55"}, "home_palette_brightness": {"preserve"}}
|
||||
w := configRequest(s, token, "POST", endpoint, form)
|
||||
if w.Code != 303 || w.Header().Get("Location") != "/-/sys/config?panel=organizer#appearance" {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
if w = configRequest(s, token, "POST", endpoint, form); w.Code != 409 {
|
||||
t.Fatal("stale write", w.Code, w.Body)
|
||||
}
|
||||
w = configRequest(s, token, "GET", "/-/sys/config?panel=organizer", nil)
|
||||
if w.Code != 200 || !strings.Contains(w.Body.String(), `name="home_glass_transparency" type="number" min="0" max="85" value="71"`) {
|
||||
t.Fatal("personal value missing", w.Code, w.Body)
|
||||
}
|
||||
w = configRequest(s, admin, "GET", "/-/sys/config?panel=organizer", nil)
|
||||
if w.Code != 200 || strings.Contains(w.Body.String(), `max="85" value="71"`) {
|
||||
t.Fatal("owner leakage", w.Code)
|
||||
}
|
||||
raw, _ := s.store.GetConfigInDomain(domain, "home_glass_transparency")
|
||||
if raw == "71" {
|
||||
t.Fatal("changed domain settings")
|
||||
}
|
||||
if w = configRequest(s, "", "POST", endpoint, form); w.Code == 303 && w.Header().Get("Location") == "/-/sys/config?panel=organizer#appearance" {
|
||||
t.Fatal("anonymous write")
|
||||
}
|
||||
if err = s.store.SetPrincipalState(domain, p.UUID, "readonly"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
token, err = s.store.CreateAuthSession(domain, p.UUID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
form.Set("version", "1")
|
||||
if w = configRequest(s, token, "POST", endpoint, form); w.Code != 403 {
|
||||
t.Fatal("readonly write", w.Code)
|
||||
}
|
||||
}
|
||||
@@ -74,23 +74,27 @@ func (s *Server) renderWithContext(
|
||||
if r.URL.Path == "/" {
|
||||
data["IsHome"] = true
|
||||
data["BookmarkSections"] = s.bookmarkSections(r)
|
||||
canConfigureHome := s.canManageAssets(r)
|
||||
if controlled, err := s.store.DomainEntryControlled(domainUUID); err != nil || controlled {
|
||||
canConfigureHome = false
|
||||
_, canConfigureHome := s.calendarActor(r)
|
||||
if s.requestPrincipal(r) != nil {
|
||||
w.Header().Set("Cache-Control", "private, no-store")
|
||||
}
|
||||
data["CanManageBookmarks"] = s.canManageAssets(r)
|
||||
data["CanConfigureHome"] = canConfigureHome
|
||||
transparency := s.homeGlassTransparency(domainUUID)
|
||||
appearance := s.appearanceForRequest(r)
|
||||
for k, v := range s.appearanceData(r) {
|
||||
data[k] = v
|
||||
}
|
||||
transparency := appearance.Glass
|
||||
data["HomeGlassTransparency"] = transparency
|
||||
data["HomeGlassOpacity"] = 100 - transparency
|
||||
wallpaper := s.homeWallpaperForRequest(r)
|
||||
data["HomeWallpaperURL"] = wallpaper.URL
|
||||
data["HomeWallpaperOpacity"] = wallpaper.Opacity
|
||||
data["HomeWallpaperKey"] = wallpaper.Key
|
||||
data["HomePalette"] = s.homePalette(domainUUID)
|
||||
data["HomePalette"] = appearance.Palette
|
||||
data["HomePaletteDomain"] = domainUUID
|
||||
if wallpaper.URL != "" {
|
||||
w.Header().Set("Cache-Control", "private, no-cache")
|
||||
w.Header().Set("Cache-Control", "private, no-store")
|
||||
}
|
||||
if data["CanManageBookmarks"] == true {
|
||||
data["ManagedBookmarks"] = s.managedBookmarks(domainUUID)
|
||||
|
||||
@@ -50,6 +50,18 @@ func (s *Server) handleRevisionBrowser(
|
||||
}
|
||||
|
||||
next := ""
|
||||
heads := map[string]string{}
|
||||
canRestore := s.authorizeObjectForRequest(r, "write", objectUUID) == nil
|
||||
if canRestore {
|
||||
for _, revision := range page.Items {
|
||||
if _, ok := heads[revision.Language]; ok {
|
||||
continue
|
||||
}
|
||||
if head, e := s.store.GetRevisionMetadataForExactLanguage(objectUUID, revision.Language); e == nil {
|
||||
heads[revision.Language] = head.UUID
|
||||
}
|
||||
}
|
||||
}
|
||||
if page.Next != "" {
|
||||
next = revisionPageURL(r, page.Next)
|
||||
}
|
||||
@@ -62,12 +74,14 @@ func (s *Server) handleRevisionBrowser(
|
||||
s.getSystemNavItems(s.domainUUIDForRequest(r)),
|
||||
NavContext{},
|
||||
),
|
||||
"Title": "Revision History",
|
||||
"ObjectUUID": objectUUID,
|
||||
"Revisions": page.Items,
|
||||
"NextURL": next,
|
||||
"NewestURL": revisionPageURL(r, ""),
|
||||
"HasPrevious": before != "",
|
||||
"Title": "Revision History",
|
||||
"ObjectUUID": objectUUID,
|
||||
"CanRestore": canRestore,
|
||||
"RevisionHeads": heads,
|
||||
"Revisions": page.Items,
|
||||
"NextURL": next,
|
||||
"NewestURL": revisionPageURL(r, ""),
|
||||
"HasPrevious": before != "",
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -1,63 +1,61 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"pageswiki/internal/store"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (s *Server) handleRestoreRevisionAPI(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
) {
|
||||
func (s *Server) handleRestoreRevisionAPI(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost {
|
||||
w.Header().Set("Allow", "POST")
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
http.Error(w, "method not allowed", 405)
|
||||
return
|
||||
}
|
||||
|
||||
revisionUUID :=
|
||||
r.URL.Query().Get("revision")
|
||||
|
||||
metadata, err :=
|
||||
s.store.GetRevisionMetadata(
|
||||
revisionUUID,
|
||||
)
|
||||
|
||||
var input struct {
|
||||
Revision string `json:"revision_uuid"`
|
||||
Expected string `json:"base_revision_uuid"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
if !taskJSON(w, r, &input) {
|
||||
return
|
||||
}
|
||||
if input.Expected == "" {
|
||||
http.Error(w, "base revision required", 428)
|
||||
return
|
||||
}
|
||||
if len(input.Message) > 4096 {
|
||||
http.Error(w, "message too long", 422)
|
||||
return
|
||||
}
|
||||
metadata, err := s.store.GetRevisionMetadata(input.Revision)
|
||||
if err != nil {
|
||||
http.Error(
|
||||
w,
|
||||
err.Error(),
|
||||
500,
|
||||
)
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
if s.authorizeObjectForRequest(r, "write", metadata.ObjectUUID) != nil {
|
||||
http.Error(w, "forbidden", http.StatusForbidden)
|
||||
if s.authorizeObjectForRequest(r, "read", metadata.ObjectUUID) != nil || s.authorizeObjectForRequest(r, "write", metadata.ObjectUUID) != nil {
|
||||
http.Error(w, "forbidden", 403)
|
||||
return
|
||||
}
|
||||
// Authorize metadata before hydrating the potentially large source body.
|
||||
revision, err := s.store.GetRevision(revisionUUID)
|
||||
revision, err := s.store.GetRevision(input.Revision)
|
||||
if err != nil {
|
||||
http.Error(w, "revision unavailable", http.StatusInternalServerError)
|
||||
http.Error(w, "revision unavailable", 500)
|
||||
return
|
||||
}
|
||||
message := strings.TrimSpace(input.Message)
|
||||
if message == "" {
|
||||
message = "Restore revision " + revision.UUID
|
||||
}
|
||||
saved, err := s.store.SaveRevisionContentIfHead(revision.ObjectUUID, []byte(revision.Body), message, revision.Language, revision.ContentType, revision.Filename, input.Expected)
|
||||
if errors.Is(err, store.ErrRevisionConflict) {
|
||||
http.Error(w, "revision changed; reload history", 412)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = s.store.SaveRevisionContent(
|
||||
revision.ObjectUUID,
|
||||
[]byte(revision.Body),
|
||||
"restore revision",
|
||||
revision.Language,
|
||||
revision.ContentType,
|
||||
revision.Filename,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
http.Error(
|
||||
w,
|
||||
err.Error(),
|
||||
500,
|
||||
)
|
||||
http.Error(w, "restore failed", 500)
|
||||
return
|
||||
}
|
||||
|
||||
_, _ = w.Write([]byte("ok"))
|
||||
w.Header().Set("Cache-Control", "no-store")
|
||||
writeEventJSON(w, 200, map[string]string{"revision_uuid": saved.UUID, "object_uuid": revision.ObjectUUID})
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRevisionRestoreAppendAndConflict(t *testing.T) {
|
||||
s, token, domain := configFixture(t)
|
||||
object, err := s.store.CreatePageAtPathInDomain(domain, "/restore-ui")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
old, err := s.store.SaveRevisionContent(object, []byte("<p>Old</p>"), "first", "ja", "text/html", "note.html")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
head, err := s.store.SaveRevisionContent(object, []byte("<p>New</p>"), "second", "ja", "text/html", "note.html")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s.mux.HandleFunc("/_/api/v1/revisions/restore", s.handleRestoreRevisionAPI)
|
||||
s.mux.HandleFunc("/r/history/", s.handleRevisionBrowser)
|
||||
post := func(payload map[string]string) *httptest.ResponseRecorder {
|
||||
body, _ := json.Marshal(payload)
|
||||
r := httptest.NewRequest("POST", "http://localhost/_/api/v1/revisions/restore", bytes.NewReader(body))
|
||||
r.Header.Set("Authorization", "Bearer "+token)
|
||||
r.Header.Set("Content-Type", "application/json")
|
||||
w := httptest.NewRecorder()
|
||||
s.withAuthorization(s.mux).ServeHTTP(w, r)
|
||||
return w
|
||||
}
|
||||
page := configRequest(s, token, "GET", "/r/history/"+object, nil)
|
||||
if page.Code != 200 || !strings.Contains(page.Body.String(), `data-restore-revision="`+old.UUID+`"`) || !strings.Contains(page.Body.String(), "data-revision-time") {
|
||||
t.Fatal(page.Code, page.Body)
|
||||
}
|
||||
payload := map[string]string{"revision_uuid": old.UUID, "base_revision_uuid": head.UUID, "message": "元の内容へ復元"}
|
||||
w := post(payload)
|
||||
if w.Code != 200 {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
restored, err := s.store.GetRevisionForExactLanguage(object, "ja")
|
||||
if err != nil || restored.UUID == old.UUID || restored.UUID == head.UUID || restored.Body != old.Body || restored.Message != payload["message"] {
|
||||
t.Fatal(restored, err)
|
||||
}
|
||||
if _, err = s.store.GetRevision(head.UUID); err != nil {
|
||||
t.Fatal("previous head lost", err)
|
||||
}
|
||||
w = post(payload)
|
||||
if w.Code != 412 {
|
||||
t.Fatal("stale restore", w.Code, w.Body)
|
||||
}
|
||||
delete(payload, "base_revision_uuid")
|
||||
w = post(payload)
|
||||
if w.Code != 428 {
|
||||
t.Fatal("missing precondition", w.Code, w.Body)
|
||||
}
|
||||
}
|
||||
@@ -77,9 +77,14 @@ func TestBookmarkAndVimSettingsChromium(t *testing.T) {
|
||||
if len(items) != 2 || items[0].Kind != "section" || !items[0].Children || items[0].Href != "/docs" || items[1].Label != "Reference" {
|
||||
t.Fatalf("saved bookmarks: %#v", items)
|
||||
}
|
||||
if got := s.homeGlassTransparency(domain); got != 57 {
|
||||
r := httptest.NewRequest("GET", "http://localhost/", nil)
|
||||
r.Header.Set("Authorization", "Bearer "+token)
|
||||
if got := s.appearanceForRequest(r).Glass; got != 57 {
|
||||
t.Fatalf("saved glass transparency: %d", got)
|
||||
}
|
||||
if s.homeGlassTransparency(domain) == 57 {
|
||||
t.Fatal("personal appearance changed domain defaults")
|
||||
}
|
||||
vim := s.domainVimSettings(domain)
|
||||
if !vim.Enabled || vim.Vimrc != "set tabstop=3\n" || vim.ColorName != "uploaded.vim" || !strings.Contains(vim.Colorscheme, "Normal") {
|
||||
t.Fatalf("saved vim: %#v", vim)
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestTaskIndexChromium(t *testing.T) {
|
||||
if os.Getenv("PAGESWIKI_BROWSER_TEST") != "1" {
|
||||
t.Skip("opt-in Chromium")
|
||||
}
|
||||
for _, width := range []string{"1440", "390"} {
|
||||
t.Run(width, func(t *testing.T) {
|
||||
s, token, domain, actor := taskFixture(t)
|
||||
for i, title := range []string{"**Alpha**", "Beta", "Gamma"} {
|
||||
task := newTaskRecord("task", title)
|
||||
if i < 2 {
|
||||
project, err := s.store.SaveTask(context.Background(), domain, actor, newTaskRecord("project", "Project "+title), 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
task.ProjectUUID = project.UUID
|
||||
}
|
||||
if i == 1 {
|
||||
task.Status = "doing"
|
||||
}
|
||||
if _, err := s.store.SaveTask(context.Background(), domain, actor, task, 0); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
script, err := os.ReadFile("internal/server/testdata/task-index.js")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
r.Host = "localhost"
|
||||
r.Header.Set("Authorization", "Bearer "+token)
|
||||
if r.URL.Path == "/v/plan/tasks/index" {
|
||||
rec := httptest.NewRecorder()
|
||||
s.withAuthorization(s.mux).ServeHTTP(rec, r)
|
||||
for k, v := range rec.Header() {
|
||||
w.Header()[k] = v
|
||||
}
|
||||
w.WriteHeader(rec.Code)
|
||||
w.Write([]byte(strings.Replace(rec.Body.String(), "</body>", browserFixtureScript(rec.Header(), script)+"</body>", 1)))
|
||||
return
|
||||
}
|
||||
s.withAuthorization(s.mux).ServeHTTP(w, r)
|
||||
}))
|
||||
defer server.Close()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, "node", "internal/server/testdata/vim-browser-smoke.mjs", strings.Replace(server.URL, "127.0.0.1", "localhost", 1)+"/v/plan/tasks/index", t.TempDir(), "/tmp/pages-task-index-"+width+".png", width, "900")
|
||||
cmd.Env = append(os.Environ(), "PAGESWIKI_TASK_INDEX_BROWSER=1")
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("browser %v: %s", err, out)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"pageswiki/internal/store"
|
||||
)
|
||||
|
||||
func TestTaskIndexFilteringSortingPagination(t *testing.T) {
|
||||
s, token, domain, actor := taskFixture(t)
|
||||
today := time.Now().In(s.getLocation(domain)).Format("2006-01-02")
|
||||
project, err := s.store.SaveTask(context.Background(), domain, actor, newTaskRecord("project", "Index project"), 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
page, err := s.store.CreatePageAtPathInDomain(domain, "/index-related")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for i, title := range []string{"Alpha release", "Beta release", "Gamma", "Delta"} {
|
||||
task := newTaskRecord("task", title)
|
||||
task.DueOn = []string{"2020-01-01", "2020-01-01", "2099-01-01", ""}[i]
|
||||
if i == 0 {
|
||||
task.Status = "doing"
|
||||
task.Priority = 3
|
||||
task.References = []string{"/files/ref.pdf"}
|
||||
task.ProjectUUID = project.UUID
|
||||
task.PageUUID = page
|
||||
task.StartOn = "2019-01-01"
|
||||
task.PlannedOn = today
|
||||
task.ReviewOn = today
|
||||
}
|
||||
if i == 2 {
|
||||
task.Status = "done"
|
||||
}
|
||||
if i == 3 {
|
||||
task.Archived = true
|
||||
}
|
||||
if _, err = s.store.SaveTask(context.Background(), domain, actor, task, 0); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
type result struct {
|
||||
Items []store.TaskRecord
|
||||
Next string
|
||||
}
|
||||
get := func(filter, sort, order, project, before string, limit int) result {
|
||||
t.Helper()
|
||||
q := url.Values{"view": {"index"}, "filter": {filter}, "sort": {sort}, "order": {order}, "project": {project}, "before": {before}, "limit": {"1"}}
|
||||
if limit > 1 {
|
||||
q.Set("limit", "100")
|
||||
}
|
||||
w := taskRequest(s, token, "GET", "items?"+q.Encode(), nil, "")
|
||||
var d result
|
||||
if w.Code != 200 || json.Unmarshal(w.Body.Bytes(), &d) != nil {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
return d
|
||||
}
|
||||
first := get("~active", "title", "asc", "", "", 1)
|
||||
if len(first.Items) != 1 || first.Items[0].Title != "Alpha release" || first.Next == "" {
|
||||
t.Fatal(first)
|
||||
}
|
||||
second := get("~active", "title", "asc", "", first.Next, 1)
|
||||
if len(second.Items) != 1 || second.Items[0].Title != "Beta release" || second.Next != "" {
|
||||
t.Fatal(second)
|
||||
}
|
||||
reverse := get("~active", "title", "desc", "", "", 100)
|
||||
if len(reverse.Items) != 2 || reverse.Items[0].Title != "Beta release" {
|
||||
t.Fatal(reverse)
|
||||
}
|
||||
cases := map[string]string{`~s "Alpha release" ~doing ~overdue ~priority 3 ~attachment`: "Alpha release", `~due <=today !~doing ~active`: "Beta release", `~done !~overdue`: "Gamma", `~archived ~due none`: "Delta", `~s release ~due <` + today + ` ~doing`: "Alpha release"}
|
||||
for filter, title := range cases {
|
||||
r := get(filter, "due", "asc", "", "", 100)
|
||||
if len(r.Items) != 1 || r.Items[0].Title != title {
|
||||
t.Fatal(filter, r)
|
||||
}
|
||||
}
|
||||
for _, filter := range []string{"~wiki", "~start <=2020-01-01 ~planned today ~review =today"} {
|
||||
r := get(filter, "due", "asc", "", "", 100)
|
||||
if len(r.Items) != 1 || r.Items[0].Title != "Alpha release" {
|
||||
t.Fatal(filter, r)
|
||||
}
|
||||
}
|
||||
for _, key := range []string{"due", "planned", "title", "status", "priority", "created", "updated"} {
|
||||
a := get("~active", key, "asc", "", "", 1)
|
||||
b := get("~active", key, "asc", "", a.Next, 1)
|
||||
rev := get("~active", key, "desc", "", "", 100)
|
||||
if a.Next == "" || len(b.Items) != 1 || b.Items[0].UUID == a.Items[0].UUID || len(rev.Items) != 2 || rev.Items[0].UUID != b.Items[0].UUID {
|
||||
t.Fatal("unstable sort", key, a, b, rev)
|
||||
}
|
||||
}
|
||||
if r := get("~active", "due", "asc", "none", "", 100); len(r.Items) != 1 || r.Items[0].Title != "Beta release" {
|
||||
t.Fatal(r)
|
||||
}
|
||||
if r := get("", "due", "asc", project.UUID, "", 100); len(r.Items) != 1 || r.Items[0].Title != "Alpha release" {
|
||||
t.Fatal(r)
|
||||
}
|
||||
for _, filter := range []string{`~unknown`, `~s`, `~s "unfinished`, `~due 2026-02-30`, `~priority 8`, `~bucket whatever`} {
|
||||
w := taskRequest(s, token, "GET", "items?view=index&filter="+url.QueryEscape(filter), nil, "")
|
||||
if w.Code != 422 {
|
||||
t.Fatal("invalid accepted", filter, w.Code)
|
||||
}
|
||||
}
|
||||
if w := taskRequest(s, token, "GET", "items?view=index&sort=title%3BDROP+TABLE+organizer_items", nil, ""); w.Code != 422 {
|
||||
t.Fatal(w.Code)
|
||||
}
|
||||
if w := configRequest(s, token, "GET", "/v/plan/tasks/index", nil); w.Code != 200 {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
other, err := s.store.CreatePasswordAccount(domain, "indexother", "long test password", "Other", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
otherToken, err := s.store.CreateAuthSession(domain, other.UUID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
w := taskRequest(s, otherToken, "GET", "items?view=index&before="+first.Next, nil, "")
|
||||
var empty result
|
||||
if w.Code != 200 || json.Unmarshal(w.Body.Bytes(), &empty) != nil || len(empty.Items) != 0 {
|
||||
t.Fatal("cross-owner leakage", w.Code, w.Body)
|
||||
}
|
||||
if err = s.store.SetPrincipalState(domain, actor, "readonly"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
readonlyToken, err := s.store.CreateAuthSession(domain, actor)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if w = taskRequest(s, readonlyToken, "GET", "items?view=index", nil, ""); w.Code != 200 {
|
||||
t.Fatal("readonly read", w.Code)
|
||||
}
|
||||
item := first.Items[0]
|
||||
item.Status = "done"
|
||||
if w = taskRequest(s, readonlyToken, "PUT", "items/"+item.UUID, item, `"1"`); w.Code != 403 {
|
||||
t.Fatal("readonly mutation", w.Code)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Exercise the actual CLI executable boundary, full production router and
|
||||
// browser-session authentication. All mail, credentials and storage are synthetic.
|
||||
func TestNeoMuttMailViewerFlow(t *testing.T) {
|
||||
if _, err := exec.LookPath("python3"); err != nil {
|
||||
t.Skip("python3 not installed")
|
||||
}
|
||||
fixture, token, domain := configFixture(t)
|
||||
fixture.store.BackgroundJobsDisabled = true
|
||||
s := New(fixture.store)
|
||||
p, err := s.store.PrincipalForSession(domain, token)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
browser, err := s.store.CreateBrowserAuthSession(domain, p.UUID, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
handler := s.handler()
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
r.Host = "localhost"
|
||||
if r.URL.Path == "/fixture-browser-login" {
|
||||
s.setAuthCookie(w, r, browser)
|
||||
http.Redirect(w, r, r.URL.Query().Get("return"), http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
handler.ServeHTTP(w, r)
|
||||
}))
|
||||
defer server.Close()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
|
||||
defer cancel()
|
||||
input, _ := json.Marshal(map[string]any{"origin": server.URL, "browser": browser, "root": t.TempDir(), "chromium": os.Getenv("PAGESWIKI_BROWSER_TEST") == "1"})
|
||||
cmd := exec.CommandContext(ctx, "python3", "pages-cli/test_neomutt_viewer.py")
|
||||
cmd.Stdin = bytes.NewReader(input)
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("NeoMutt flow: %v\n%s", err, out)
|
||||
}
|
||||
if !strings.Contains(string(out), "MAIL_VIEWER_OK") {
|
||||
t.Fatalf("missing verification: %s", out)
|
||||
}
|
||||
t.Log(string(out))
|
||||
// Capture creates only the leaf document: prefix and date/list directories
|
||||
// remain virtual. Exercise the parent URLs under both documented settings.
|
||||
request := func(path string) *httptest.ResponseRecorder {
|
||||
r := httptest.NewRequest(http.MethodGet, "http://localhost"+strings.ReplaceAll(path, " ", "%20"), nil)
|
||||
r.AddCookie(&http.Cookie{Name: authCookieName, Value: browser})
|
||||
w := httptest.NewRecorder()
|
||||
handler.ServeHTTP(w, r)
|
||||
return w
|
||||
}
|
||||
for _, enabled := range []bool{false, true} {
|
||||
value, expected := "false", http.StatusNotFound
|
||||
if enabled {
|
||||
value, expected = "true", http.StatusOK
|
||||
}
|
||||
if err := s.store.SetConfigInDomain(domain, "virtual_folder_pages", value); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if w := request("/tasks/"); w.Code != http.StatusMovedPermanently || w.Header().Get("Location") != "/tasks" {
|
||||
t.Fatalf("tasks trailing slash: %d %s", w.Code, w.Header().Get("Location"))
|
||||
}
|
||||
for _, path := range []string{"/tasks", "/tasks/example.list", "/tasks/2026/01", "/mail", "/mail/example.list", "/private/mail", "/private/mail/2026", "/private/mail/2026/01", "/受信 メール", "/docs/mail", "/api/mail"} {
|
||||
w := request(path)
|
||||
if w.Code != expected || !strings.Contains(strings.ToLower(w.Body.String()), "<!doctype html>") {
|
||||
t.Fatalf("parent %s virtual=%t: %d %s", path, enabled, w.Code, w.Body.String())
|
||||
}
|
||||
if strings.Contains(w.Body.String(), `{"detail":"Not Found"}`) {
|
||||
t.Fatal("unexpected JSON error")
|
||||
}
|
||||
}
|
||||
t.Logf("parent prefix/list/year/month: virtual_folder_pages=%t status=%d HTML", enabled, expected)
|
||||
}
|
||||
if err := s.store.SetConfigInDomain(domain, "virtual_folder_pages", "false"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
id, err := s.store.CreatePageAtPathInDomain(domain, "/private/mail")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err = s.store.SaveRevisionContent(id, []byte("<h1>Synthetic mail portal</h1>{{children}}"), "", "und", "text/html", ""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if w := request("/private/mail"); w.Code != 200 || !strings.Contains(w.Body.String(), "Synthetic mail portal") {
|
||||
t.Fatalf("explicit parent document: %d", w.Code)
|
||||
}
|
||||
t.Log("explicit parent document: status=200 HTML with virtual folders disabled")
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTaskReferencesRoundTripAndLegacyUpdate(t *testing.T) {
|
||||
s, token, domain, actor := taskFixture(t)
|
||||
task := newTaskRecord("task", "**Bold** and `code`")
|
||||
task.References = []string{"https://example.test/doc", "/files/資料.pdf"}
|
||||
w := taskRequest(s, token, "POST", "items", task, "")
|
||||
if w.Code != 201 {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
task.References = nil
|
||||
task.Title = "Updated"
|
||||
w = taskRequest(s, token, "PUT", "items/"+task.UUID, task, `"1"`)
|
||||
if w.Code != 200 {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
got, err := s.store.GetTask(context.Background(), domain, actor, task.UUID)
|
||||
if err != nil || len(got.References) != 2 {
|
||||
t.Fatal(got, err)
|
||||
}
|
||||
raw, _ := json.Marshal(got)
|
||||
var body map[string]any
|
||||
json.Unmarshal(raw, &body)
|
||||
body["references"] = []string{}
|
||||
w = taskRequest(s, token, "PUT", "items/"+task.UUID, body, `"2"`)
|
||||
if w.Code != 200 {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
got, err = s.store.GetTask(context.Background(), domain, actor, task.UUID)
|
||||
if err != nil || len(got.References) != 0 {
|
||||
t.Fatal("references not cleared", got, err)
|
||||
}
|
||||
for _, ref := range []string{"javascript:alert(1)", "data:text/html,hi", "//evil.test/x", "/\\evil.test/x", "https://user:pass@example.test", "https://example.test/\nheader"} {
|
||||
bad := newTaskRecord("task", "bad")
|
||||
bad.References = []string{ref}
|
||||
if w = taskRequest(s, token, "POST", "items", bad, ""); w.Code != 422 {
|
||||
t.Fatal("unsafe reference accepted", ref, w.Code)
|
||||
}
|
||||
}
|
||||
widgets := []map[string]any{{"id": "tomorrow-schedule", "width": 6, "height": 4}, {"id": "commands", "width": 6, "height": 3}}
|
||||
if w = taskRequest(s, token, "PUT", "dashboard", map[string]any{"version": 0, "widgets": widgets}, ""); w.Code != 200 {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"pageswiki/internal/store"
|
||||
)
|
||||
|
||||
// No Python/Chromium dependency: the production route and authorization stack
|
||||
// must continue to serve /tasks as Wiki space, not the organizer task UI/API.
|
||||
func TestTaskWikiPrefixRouting(t *testing.T) {
|
||||
fixture, token, domain := configFixture(t)
|
||||
fixture.store.BackgroundJobsDisabled = true
|
||||
s := New(fixture.store)
|
||||
p, err := s.store.PrincipalForSession(domain, token)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cookie, err := s.store.CreateBrowserAuthSession(domain, p.UUID, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
handler := s.handler()
|
||||
request := func(method, target string, payload any, authenticated bool) *httptest.ResponseRecorder {
|
||||
body, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r := httptest.NewRequest(method, "http://localhost"+target, bytes.NewReader(body))
|
||||
if authenticated {
|
||||
if method == http.MethodGet {
|
||||
r.AddCookie(&http.Cookie{Name: authCookieName, Value: cookie})
|
||||
} else {
|
||||
r.Header.Set("Authorization", "Bearer "+token)
|
||||
}
|
||||
}
|
||||
r.Header.Set("Content-Type", "application/json")
|
||||
w := httptest.NewRecorder()
|
||||
handler.ServeHTTP(w, r)
|
||||
return w
|
||||
}
|
||||
prefs, err := s.store.TaskPreferences(t.Context(), domain, p.UUID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
prefs.WikiPrefix = "/tasks"
|
||||
if w := request("PUT", tasksAPI+"preferences", prefs, true); w.Code != 200 {
|
||||
t.Fatalf("preferences: %d %s", w.Code, w.Body)
|
||||
}
|
||||
for i, suffix := range []string{"example/123", "2026/11/" + uuid.NewString(), "2026/11/" + strings.Repeat("a", 64), ""} {
|
||||
input := map[string]any{"request_id": uuid.NewString(), "title": "合成メール", "wiki_body": "Synthetic routing test body"}
|
||||
if suffix != "" {
|
||||
input["wiki_suffix"] = suffix
|
||||
}
|
||||
w := request("POST", tasksAPI+"capture", input, true)
|
||||
if w.Code != 201 {
|
||||
t.Fatalf("capture: %d %s", w.Code, w.Body)
|
||||
}
|
||||
var result struct {
|
||||
Item store.TaskRecord `json:"item"`
|
||||
Path string `json:"page_path"`
|
||||
}
|
||||
if err := json.Unmarshal(w.Body.Bytes(), &result); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.HasPrefix(result.Path, "/tasks/") {
|
||||
t.Fatal(result.Path)
|
||||
}
|
||||
alias := "/prj/awesome"
|
||||
if i != 0 {
|
||||
alias += "/" + strconv.Itoa(i)
|
||||
}
|
||||
if err := s.store.AddPathLinkInDomain(domain, result.Item.PageUUID, alias); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, target := range []string{result.Path, alias} {
|
||||
if taskRoute(target) {
|
||||
t.Fatalf("Wiki path captured by organizer routing: %s", target)
|
||||
}
|
||||
id, err := s.store.ResolvePathInDomain(domain, target)
|
||||
if err != nil || id != result.Item.PageUUID {
|
||||
t.Fatalf("alias identity: %s %v", id, err)
|
||||
}
|
||||
w := request("GET", target, nil, true)
|
||||
if w.Code != 200 || !strings.Contains(w.Body.String(), "Synthetic routing test body") || !strings.Contains(strings.ToLower(w.Body.String()), "<!doctype html>") {
|
||||
t.Fatalf("viewer %s: %d %s", target, w.Code, w.Body)
|
||||
}
|
||||
if w := request("GET", target+"/", nil, true); w.Code != 301 || w.Header().Get("Location") != target {
|
||||
t.Fatalf("trailing slash %s: %d", target, w.Code)
|
||||
}
|
||||
if w := request("GET", target, nil, false); w.Code != 303 || strings.Contains(w.Body.String(), "Synthetic routing test body") {
|
||||
t.Fatalf("anonymous isolation %s: %d", target, w.Code)
|
||||
}
|
||||
}
|
||||
parent := result.Path[:strings.LastIndex(result.Path, "/")]
|
||||
if w := request("GET", "/v/browser"+parent, nil, true); w.Code != 200 || !strings.Contains(w.Body.String(), `data-path="`+result.Path+`"`) {
|
||||
t.Fatalf("listing: %d", w.Code)
|
||||
}
|
||||
}
|
||||
for _, enabled := range []string{"false", "true"} {
|
||||
if err := s.store.SetConfigInDomain(domain, "virtual_folder_pages", enabled); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
expected := http.StatusNotFound
|
||||
if enabled == "true" {
|
||||
expected = http.StatusOK
|
||||
}
|
||||
for _, target := range []string{"/tasks", "/tasks/example", "/tasks/2026", "/tasks/2026/11"} {
|
||||
w := request("GET", target, nil, true)
|
||||
if w.Code != expected || !strings.Contains(strings.ToLower(w.Body.String()), "<!doctype html>") {
|
||||
t.Fatalf("virtual parent %s enabled=%s: %d", target, enabled, w.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ func (s *Server) handleTaskPage(w http.ResponseWriter, r *http.Request) {
|
||||
selectedDate, view = d.Format("2006-01-02"), "day"
|
||||
}
|
||||
switch view {
|
||||
case "inbox", "backlog", "someday", "review", "done", "archived", "carryover", "day":
|
||||
case "inbox", "backlog", "someday", "review", "done", "archived", "carryover", "day", "index":
|
||||
case "tomorrow":
|
||||
selectedDate = time.Now().In(s.getLocation(domain)).AddDate(0, 0, 1).Format("2006-01-02")
|
||||
view = "day"
|
||||
@@ -315,7 +315,7 @@ func (s *Server) handleTasksAPI(w http.ResponseWriter, r *http.Request) {
|
||||
selected = q.Get("date")
|
||||
}
|
||||
hierarchy := q.Get("hierarchy") == "1"
|
||||
items, next, err := s.store.ListTasks(ctx, domain, actor, store.TaskQuery{Kind: kind, View: view, Project: q.Get("project"), Parent: q.Get("parent"), Search: q.Get("q"), Today: selected, Before: q.Get("before"), Limit: limit, Hierarchy: hierarchy})
|
||||
items, next, err := s.store.ListTasks(ctx, domain, actor, store.TaskQuery{Kind: kind, View: view, Project: q.Get("project"), Parent: q.Get("parent"), Search: q.Get("q"), Today: selected, Before: q.Get("before"), Limit: limit, Hierarchy: hierarchy, Filter: q.Get("filter"), Sort: q.Get("sort"), Order: q.Get("order")})
|
||||
if err != nil {
|
||||
taskError(w, err)
|
||||
return
|
||||
|
||||
Vendored
+1
-1
@@ -27,7 +27,7 @@
|
||||
d.querySelector('.feed-row').click();await wait(()=>d.querySelector('#feed-reader .feed-body'));
|
||||
d.querySelector('#feed-reader .feed-actions button:last-child').click();await wait(()=>d.querySelector('#feed-reader form'));
|
||||
assert(!['rgba(0, 0, 0, 0)','transparent'].includes(w.getComputedStyle(d.querySelector('.feed-capture')).backgroundColor),'Capture dialog background transparent');
|
||||
const form=d.querySelector('#feed-reader form'),inputs=form.querySelectorAll('input');assert(inputs[2].value==='/notes/{YYYY}/{MM}/{DD}/{Subject}','Wiki default not filled');assert(form.closest('dialog').open&&d.querySelector('#feed-reader .feed-body'),'Capture replaced article');assert(form.querySelector('a[href="/-/sys/config?panel=organizer"]'),'Default settings link missing');await wait(()=>form.querySelector('output').textContent.includes('/rss-'));assert(!form.querySelector('output').textContent.includes('{'),'Template not expanded');inputs[2].value='/notes/feed-ui';inputs[2].dispatchEvent(new w.Event('input'));await wait(()=>form.querySelector('output').textContent.startsWith('/notes/feed-ui/rss-'));inputs[5].checked=true;form.requestSubmit();await wait(()=>d.querySelector('#feed-reader a[href^="/v/uuid:"]'));d.querySelector('.feed-capture button').click();await wait(()=>!d.querySelector('.feed-capture'));assert(d.querySelector('#feed-reader .feed-body'),'Closing capture lost article');
|
||||
const form=d.querySelector('#feed-reader form'),inputs=form.querySelectorAll('input');assert(inputs[2].value==='/notes/{YYYY}/{MM}/{DD}/{Subject}','Wiki default not filled');assert(form.closest('dialog').open&&d.querySelector('#feed-reader .feed-body'),'Capture replaced article');assert(form.querySelector('a[href="/-/sys/config?panel=organizer"]'),'Default settings link missing');await wait(()=>form.querySelector('output').textContent.includes('/rss-'));assert(!form.querySelector('output').textContent.includes('{'),'Template not expanded');inputs[2].value='/notes/feed-ui';inputs[2].dispatchEvent(new w.Event('input'));await wait(()=>form.querySelector('output').textContent.startsWith('/notes/feed-ui/rss-'));inputs[5].checked=true;form.requestSubmit();await wait(()=>d.querySelector('#feed-reader a[href^="/o/uuid:"]'));d.querySelector('.feed-capture button').click();await wait(()=>!d.querySelector('.feed-capture'));assert(d.querySelector('#feed-reader .feed-body'),'Closing capture lost article');
|
||||
const search=d.querySelector('#feed-toolbar input');search.value='';search.dispatchEvent(new w.Event('input',{bubbles:true}));await wait(()=>d.querySelectorAll('.feed-row').length===100);d.querySelector('.feed-row').click();await wait(()=>d.querySelector('#feed-reader .feed-body'));
|
||||
assert(d.documentElement.scrollWidth<=w.innerWidth,'Reader overflow');
|
||||
d.getElementById('feed-opml').click();await wait(()=>d.getElementById('feed-opml-file'));
|
||||
|
||||
+23
-1
@@ -8,7 +8,8 @@ window.addEventListener('load',async()=>{const wait=async(fn)=>{for(let i=0;i<12
|
||||
const prefs=await fetch(api+'preferences').then(r=>r.json());const saved=await fetch(api+'preferences',{method:'PUT',headers:{'Content-Type':'application/json'},body:JSON.stringify({...prefs.preferences,notify_due:true,notify_planned:true,reminder_time:'10:35'})});if(!saved.ok)throw Error('Preferences save failed');
|
||||
document.querySelector('#tasks-new').click();await wait(()=>input('page_path'));
|
||||
if(input('notify_due').checked||input('notify_planned').checked)throw Error('Undated task enabled reminders');
|
||||
fill(input('title'),'タスク編集のレイアウト確認');fill(input('notes'),'主要項目を左右に整理。日付と通知をまとめて設定します。');
|
||||
fill(input('title'),'**タスク編集のレイアウト確認**');fill(input('notes'),'主要項目を左右に整理。日付と通知をまとめて設定します。');
|
||||
fill(input('references'),'https://example.test/doc\n/files/資料.pdf');
|
||||
fill(input('planned_on'),'2030-01-01');fill(input('due_on'),'2030-01-02');
|
||||
if(!input('notify_due').checked||!input('notify_planned').checked||input('reminder_time').value!=='10:35')throw Error('Dated defaults missing');
|
||||
input('notify_due').click();fill(input('due_on'),'2030-01-03');if(input('notify_due').checked)throw Error('Explicit reminder choice overwritten');
|
||||
@@ -18,6 +19,9 @@ window.addEventListener('load',async()=>{const wait=async(fn)=>{for(let i=0;i<12
|
||||
if(task.status!=='doing'||task.bucket!=='backlog'||task.complexity!==4||!task.notify_planned||task.notify_due||task.reminder_time!=='10:35')throw Error('Editor fields not persisted');
|
||||
await wait(()=>document.querySelector('[data-task-id="'+task.uuid+'"] [data-action=detail]'));document.querySelector('[data-task-id="'+task.uuid+'"] [data-action=detail]').click();await wait(()=>input('page_path'));
|
||||
if(input('notify_due').checked)throw Error('Defaults changed existing task');
|
||||
if(task.references?.length!==2||input('references').value!=='https://example.test/doc\n/files/資料.pdf')throw Error('Task references lost');
|
||||
const preview=document.querySelector('.task-title-preview');if(!preview?.querySelector('strong')||getComputedStyle(preview).display==='none'||preview.getBoundingClientRect().height<10)throw Error('Markdown title preview missing');
|
||||
const safe=document.createElement('div');PagesTaskPresentation.render(safe,'<img src=x onerror=alert(1)> [bad](javascript:alert) **safe**');if(safe.querySelector('img,a')||!safe.querySelector('strong'))throw Error('Unsafe task Markdown');
|
||||
if(form.querySelector('.task-editor-advanced').open)throw Error('Advanced section should start collapsed');
|
||||
const fields=document.querySelector('#tasks-fields'),rect=dialog.getBoundingClientRect();
|
||||
if(rect.width>innerWidth+1||rect.height>innerHeight+1||fields.scrollWidth>fields.clientWidth+1)throw Error('Editor overflow');
|
||||
@@ -46,6 +50,24 @@ window.addEventListener('load',async()=>{const wait=async(fn)=>{for(let i=0;i<12
|
||||
document.querySelector('#dashboard-controls button[aria-pressed]').click();const width=document.querySelector('[data-widget=tasks] [data-size=width]');width.value='6';width.dispatchEvent(new Event('change'));const height=document.querySelector('[data-widget=tasks] [data-size=height]');height.value='5';height.dispatchEvent(new Event('change'));
|
||||
document.querySelector('[data-widget=tasks] .widget-arrange button').click();document.querySelector('#dashboard-controls button:last-child').click();await wait(()=>document.querySelector('#dashboard-status').textContent.includes('保存しました'));const layout=await fetch('/_/api/v1/extension/organizer.tasks/dashboard').then(r=>r.json());if(layout.widgets[2].id!=='tasks'||layout.widgets[2].width!==6||layout.widgets[2].height!==5||layout.widgets[2].tab!=='done')throw Error('Layout did not persist');
|
||||
if(!document.querySelector('.organizer-nav a[href="/v/plan/contacts"]')||!document.querySelector('.organizer-nav a[aria-current="page"]'))throw Error('Shared navigation missing');
|
||||
const add=document.querySelector('#dashboard-controls select');
|
||||
for(const id of ['commands','tomorrow-schedule']){add.value=id;add.dispatchEvent(new Event('change'));}
|
||||
await wait(()=>document.querySelector('.dashboard-command'));
|
||||
const command=document.querySelector('.dashboard-command'),commandInput=command.querySelector('input'),api='/_/api/v1/extension/organizer.tasks/';
|
||||
const run=async text=>{fill(commandInput,text);command.requestSubmit();await wait(()=>!command.querySelector('button').disabled);if(commandInput.value)throw Error('Command failed: '+command.parentElement.textContent);};
|
||||
await run('add task **Command fixture**');
|
||||
let items=await fetch(api+'items?q=Command%20fixture').then(r=>r.json());const id=items.items[0].uuid;
|
||||
fill(commandInput,'today Command');await wait(()=>document.querySelector('#dashboard-command-tasks option'));if(!document.querySelector('#dashboard-command-tasks option').value.includes(id))throw Error('Command task suggestions missing');
|
||||
await run('today '+id);let item=await fetch(api+'items/'+id).then(r=>r.json());if(item.item.planned_on!==document.querySelector('#organizer-dashboard').dataset.today)throw Error('Today command failed');
|
||||
await run('tomorrow '+id);await run('due '+id+' 2030-12-31');item=await fetch(api+'items/'+id).then(r=>r.json());if(item.item.due_on!=='2030-12-31')throw Error('Due command failed');
|
||||
await wait(()=>document.querySelector('[data-widget=tomorrow] strong'));
|
||||
window.confirm=()=>false;fill(commandInput,'delete '+id);command.requestSubmit();await wait(()=>!command.querySelector('button').disabled);if(!(await fetch(api+'items/'+id)).ok)throw Error('Unconfirmed deletion');
|
||||
window.confirm=()=>true;await run('delete '+id);if((await fetch(api+'items/'+id)).status!==404)throw Error('Deletion failed');
|
||||
const date=new Date(document.querySelector('#organizer-dashboard').dataset.today+'T12:00:00Z');date.setUTCDate(date.getUTCDate()+1);const day=date.toISOString().slice(0,10),calAPI='/_/api/v1/extension/organizer.calendar/';
|
||||
const calendars=await fetch(calAPI+'calendars').then(r=>r.json());const calendar=(calendars.calendars||calendars.items)[0];
|
||||
const response=await fetch(calAPI+'calendars/'+calendar.id+'/events',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({summary:'Tomorrow visual fixture',start:day+'T03:00:00Z',end:day+'T04:00:00Z'})});if(!response.ok)throw Error('Event fixture failed');
|
||||
document.querySelector('#dashboard-controls button').click();await wait(()=>document.querySelector('[data-widget=tomorrow-schedule] .agenda-event'));
|
||||
if(!document.querySelector('[data-widget=tomorrow-schedule]').textContent.includes('Tomorrow visual fixture'))throw Error('Tomorrow schedule missing');
|
||||
}else if(path==='/v/plan/tasks'){
|
||||
const prefs=await fetch('/_/api/v1/extension/organizer.tasks/preferences').then(r=>r.json());await fetch('/_/api/v1/extension/organizer.tasks/preferences',{method:'PUT',headers:{'Content-Type':'application/json'},body:JSON.stringify({...prefs.preferences,due_days:2,estimate_minutes:60})});
|
||||
await wait(()=>document.querySelector('#tasks-quick-title'));fill(document.querySelector('#tasks-quick-title'),'Recording task');document.querySelector('#tasks-capture').requestSubmit();await wait(()=>document.querySelector('[data-action=work]'));document.querySelector('[data-action=work]').click();await wait(()=>document.querySelector('.task-work-bar a').textContent.includes('Recording task'));document.querySelector('.task-work-bar button').click();await wait(()=>document.querySelector('.task-work-bar').hidden);
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
window.addEventListener('load',async()=>{
|
||||
const wait=async fn=>{for(let n=0;n<120;n++){if(fn())return;await new Promise(r=>setTimeout(r,50));}throw Error('Timed out: '+fn);};
|
||||
const assert=(ok,msg)=>{if(!ok)throw Error(msg);},key=(k,ctrl=false)=>document.activeElement.dispatchEvent(new KeyboardEvent('keydown',{key:k,ctrlKey:ctrl,bubbles:true,cancelable:true}));
|
||||
const rows=()=>[...document.querySelectorAll('.task-index-grid tbody tr')],selected=()=>document.querySelector('.task-index-grid tr[aria-selected=true]'),api='/_/api/v1/extension/organizer.tasks/';
|
||||
try{
|
||||
const grid=document.querySelector('.task-index-grid'),form=document.querySelector('.task-index-filter'),filter=form.querySelector('input'),sort=form.querySelector('select');
|
||||
const ready=()=>grid.getAttribute('aria-busy')!=='true';
|
||||
await wait(()=>ready()&&rows().length===3&&document.querySelectorAll('.task-index-projects button').length===4);
|
||||
grid.focus();key('o');assert(document.activeElement===sort,'o did not focus sort');sort.value='title';sort.dispatchEvent(new Event('change'));await wait(ready);key('Escape');
|
||||
rows()[0].click();const first=selected().dataset.task;key('j');assert(selected().dataset.task!==first,'j failed');key('k');assert(selected().dataset.task===first,'k failed');assert(rows()[0].querySelector('strong'),'Markdown subject lost');
|
||||
key('l');assert(document.activeElement===filter,'l did not focus limit');filter.value='~s Beta ~doing';form.requestSubmit();await wait(()=>ready()&&rows().length===1);const beta=selected().dataset.task;
|
||||
filter.focus();key('d');let item=await fetch(api+'items/'+beta).then(r=>r.json());assert(item.item.status==='doing','Shortcut fired while typing');
|
||||
const changed=await fetch(api+'items/'+beta,{method:'PUT',headers:{'Content-Type':'application/json','If-Match':'"'+item.item.version+'"'},body:JSON.stringify({...item.item,notes:'Changed in another client'})});assert(changed.ok,'Concurrent update fixture failed');
|
||||
key('Escape');key('d');await wait(()=>document.querySelector('#tasks-status').textContent.includes('別の画面で更新'));
|
||||
item=await fetch(api+'items/'+beta).then(r=>r.json());assert(item.item.status==='doing'&&item.item.notes==='Changed in another client','Stale completion overwrote another client');
|
||||
form.requestSubmit();await wait(ready);key('d');await wait(()=>ready()&&rows().length===0);item=await fetch(api+'items/'+beta).then(r=>r.json());assert(item.item.status==='done'&&item.item.notes==='Changed in another client','d did not preserve full task data');
|
||||
filter.value='~unknown';form.requestSubmit();await wait(()=>ready()&&document.querySelector('#tasks-status').textContent.includes('不正'));assert(form.querySelector('input').value==='~unknown','Invalid filter lost');
|
||||
filter.value='~active';form.requestSubmit();await wait(()=>ready()&&rows().length===2);grid.focus();key('j',true);await wait(()=>ready()&&rows().length===1);assert(document.querySelector('.task-index-projects [aria-current=true]').dataset.project==='none','Ctrl+j did not switch project');
|
||||
key('k',true);await wait(()=>ready()&&rows().length===2);key('O');await wait(ready);assert(rows()[0].textContent.includes('Gamma'),'Reverse sort failed');
|
||||
grid.focus();key('?');const help=document.querySelector('.task-index-help');assert(help.open,'Help missing');const previous=selected().dataset.task;key('j');assert(selected().dataset.task===previous,'Shortcut fired through modal');help.querySelector('button').click();
|
||||
key('m');await wait(()=>document.querySelector('#tasks-dialog').open&&document.querySelector('#tasks-form [name=page_path]'));key('j');assert(selected().dataset.task===previous,'Shortcut fired through editor');document.querySelector('#tasks-close').click();
|
||||
const projectButton=[...document.querySelectorAll('.task-index-projects button')].find(b=>b.dataset.project&&b.dataset.project!=='none');projectButton.click();await wait(ready);const project=projectButton.dataset.project;grid.focus();key('c');
|
||||
await wait(()=>document.querySelector('#tasks-dialog').open&&document.querySelector('#tasks-form [name=project_uuid]')?.value===project);const title=document.querySelector('#tasks-form [name=title]');title.value='Created from index';title.dispatchEvent(new Event('input',{bubbles:true}));document.querySelector('#tasks-form').requestSubmit();await wait(()=>!document.querySelector('#tasks-dialog').open&&ready()&&rows().some(row=>row.textContent.includes('Created from index')));
|
||||
rows().find(row=>row.textContent.includes('Created from index')).click();const created=selected().dataset.task;key('w');await wait(()=>document.querySelector('#tasks-status').textContent.includes('関連Wikiページはありません'));
|
||||
key('s');await wait(()=>document.querySelector('#tasks-focus').dataset.state==='running');const session=await fetch(api+'focus').then(r=>r.json());assert(session.item.task_uuid===created,'Pomodoro attached to wrong task');
|
||||
assert(document.documentElement.scrollWidth<=innerWidth+2,'Page overflow');assert(!document.querySelector('#tasks-list input'),'Index must not be an inline form');
|
||||
document.body.dataset.vimReady='true';
|
||||
}catch(e){const p=document.createElement('pre');p.id='error';p.textContent=e.stack;document.body.append(p);}
|
||||
});
|
||||
@@ -44,6 +44,15 @@ try {
|
||||
if (state.ready) { ready = true; break; }
|
||||
await delay(200);
|
||||
}
|
||||
if(ready && process.env.PAGESWIKI_TASK_INDEX_BROWSER==='1'){
|
||||
const evaluate=async expression=>{const r=await call('Runtime.evaluate',{expression,returnByValue:true,awaitPromise:true});if(r.exceptionDetails)throw Error(JSON.stringify(r.exceptionDetails));return r.result.value;};
|
||||
const key=async(key,modifiers=0)=>{await call('Input.dispatchKeyEvent',{type:'keyDown',key,code:'Key'+key.toUpperCase(),modifiers});await call('Input.dispatchKeyEvent',{type:'keyUp',key,code:'Key'+key.toUpperCase(),modifiers});};
|
||||
await evaluate(`document.querySelector('.task-index-projects button').click();new Promise((resolve,reject)=>{let n=0;const id=setInterval(()=>{if(document.querySelector('.task-index-grid').getAttribute('aria-busy')!=='true'){clearInterval(id);document.querySelector('.task-index-grid tbody tr').click();resolve();}else if(++n>100){clearInterval(id);reject(Error('index loading'));}},30);})`);
|
||||
const selected=()=>evaluate(`document.querySelector('.task-index-grid tr[aria-selected=true]').dataset.task`);
|
||||
const before=await selected();await key('j');if(await selected()===before)throw Error('Native j did not move');await key('k');if(await selected()!==before)throw Error('Native k did not move');
|
||||
await key('j',2);if(await evaluate(`document.querySelector('.task-index-projects [aria-current=true]').dataset.project`)!=='none')throw Error('Native Ctrl+j did not switch project');await key('k',2);
|
||||
await evaluate(`new Promise(resolve=>{const id=setInterval(()=>{if(document.querySelector('.task-index-grid').getAttribute('aria-busy')!=='true'){clearInterval(id);resolve();}},30)})`);
|
||||
}
|
||||
if(ready && process.env.PAGESWIKI_DASHBOARD_DRAG==='1'){
|
||||
const evaluate=async expression=>{const r=await call('Runtime.evaluate',{expression,returnByValue:true,awaitPromise:true});if(r.exceptionDetails)throw Error(JSON.stringify(r.exceptionDetails));return r.result.value;};
|
||||
const rect=async selector=>evaluate(`(()=>{const n=document.querySelector(${JSON.stringify(selector)});n.scrollIntoView({block:'center',behavior:'instant'});const r=n.getBoundingClientRect();return {x:r.x+r.width/2,y:r.y+r.height/2};})()`);
|
||||
|
||||
@@ -3,6 +3,11 @@ package store
|
||||
import "database/sql"
|
||||
|
||||
func (s *Store) EnsureConfigTable() error {
|
||||
if _, err := s.DB.Exec(`CREATE TABLE IF NOT EXISTS personal_appearance (
|
||||
domain_uuid TEXT NOT NULL, owner_uuid TEXT NOT NULL, version INTEGER NOT NULL,
|
||||
data TEXT NOT NULL, PRIMARY KEY(domain_uuid,owner_uuid))`); err != nil {
|
||||
return err
|
||||
}
|
||||
domain, err := s.GetDefaultDomain()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -21,13 +21,13 @@ func DefaultDashboard() []DashboardWidget {
|
||||
}
|
||||
|
||||
func ValidateDashboard(items []DashboardWidget) error {
|
||||
if len(items) > 7 {
|
||||
if len(items) > 9 {
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
for _, item := range items {
|
||||
switch item.ID {
|
||||
case "progress", "today", "tomorrow", "tasks", "schedule", "activity", "feeds":
|
||||
case "progress", "today", "tomorrow", "tasks", "schedule", "tomorrow-schedule", "commands", "activity", "feeds":
|
||||
default:
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
@@ -53,6 +53,33 @@ type DashboardLayout struct {
|
||||
Widgets []DashboardWidget `json:"widgets"`
|
||||
}
|
||||
|
||||
func normalizeDashboard(items []DashboardWidget) ([]DashboardWidget, error) {
|
||||
if len(items) > 100 {
|
||||
return nil, ErrTaskInvalid
|
||||
}
|
||||
out := make([]DashboardWidget, 0, len(items))
|
||||
seen := map[string]bool{}
|
||||
for _, item := range items {
|
||||
if seen[item.ID] {
|
||||
continue
|
||||
}
|
||||
seen[item.ID] = true
|
||||
item.Width = max(3, min(12, item.Width))
|
||||
item.Height = max(2, min(10, item.Height))
|
||||
if item.ID == "tasks" {
|
||||
switch item.Tab {
|
||||
case "inbox", "backlog", "someday", "review", "all", "done":
|
||||
default:
|
||||
item.Tab = "inbox"
|
||||
}
|
||||
} else {
|
||||
item.Tab = ""
|
||||
}
|
||||
out = append(out, item)
|
||||
}
|
||||
return out, ValidateDashboard(out)
|
||||
}
|
||||
|
||||
func (s *Store) Dashboard(ctx context.Context, domain, actor string) (DashboardLayout, error) {
|
||||
p := DashboardLayout{Widgets: DefaultDashboard()}
|
||||
if err := taskActor(ctx, s.DB, domain, actor, false); err != nil {
|
||||
@@ -79,9 +106,11 @@ func (s *Store) SaveDashboard(ctx context.Context, domain, actor string, version
|
||||
if version < 0 {
|
||||
return p, ErrTaskInvalid
|
||||
}
|
||||
if err := ValidateDashboard(widgets); err != nil {
|
||||
normalized, err := normalizeDashboard(widgets)
|
||||
if err != nil {
|
||||
return p, err
|
||||
}
|
||||
widgets = normalized
|
||||
tx, err := s.DB.BeginTx(ctx, nil)
|
||||
if err != nil {
|
||||
return p, err
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
// A small AND-only query language. Values are always bound parameters; neither
|
||||
// filter text nor sort names can become SQL identifiers or expressions.
|
||||
func taskIndexFilter(source, today string) (string, []any, error) {
|
||||
if len(source) > 1000 {
|
||||
return "", nil, ErrTaskInvalid
|
||||
}
|
||||
tokens, err := taskFilterTokens(source)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
parts := []string{}
|
||||
args := []any{}
|
||||
archived := false
|
||||
for i := 0; i < len(tokens); i++ {
|
||||
token := tokens[i]
|
||||
neg := strings.HasPrefix(token, "!")
|
||||
if neg {
|
||||
token = strings.TrimPrefix(token, "!")
|
||||
}
|
||||
clause := ""
|
||||
value := func() (string, error) {
|
||||
i++
|
||||
if i >= len(tokens) || tokens[i] == "" {
|
||||
return "", ErrTaskInvalid
|
||||
}
|
||||
return tokens[i], nil
|
||||
}
|
||||
switch token {
|
||||
case "~active":
|
||||
clause = `status NOT IN ('done','cancelled')`
|
||||
case "~todo", "~doing", "~done", "~cancelled":
|
||||
clause = `status=?`
|
||||
args = append(args, strings.TrimPrefix(token, "~"))
|
||||
case "~overdue":
|
||||
clause = `due_on!='' AND due_on<? AND status NOT IN ('done','cancelled')`
|
||||
args = append(args, today)
|
||||
case "~wiki":
|
||||
clause = `COALESCE(json_extract(data,'$.page_uuid'),'')!=''`
|
||||
case "~attachment":
|
||||
clause = `COALESCE(json_array_length(data,'$.references'),0)>0`
|
||||
case "~archived":
|
||||
clause = `archived=1`
|
||||
if !neg {
|
||||
archived = true
|
||||
}
|
||||
case "~s":
|
||||
v, e := value()
|
||||
if e != nil {
|
||||
return "", nil, e
|
||||
}
|
||||
clause = `instr(lower(title),lower(?))>0`
|
||||
args = append(args, v)
|
||||
case "~bucket":
|
||||
v, e := value()
|
||||
if e != nil || (v != "inbox" && v != "backlog" && v != "someday") {
|
||||
return "", nil, ErrTaskInvalid
|
||||
}
|
||||
clause = `bucket=?`
|
||||
args = append(args, v)
|
||||
case "~priority":
|
||||
v, e := value()
|
||||
n, e2 := strconv.Atoi(v)
|
||||
if e != nil || e2 != nil || n < 0 || n > 3 {
|
||||
return "", nil, ErrTaskInvalid
|
||||
}
|
||||
clause = `COALESCE(json_extract(data,'$.priority'),0)=?`
|
||||
args = append(args, n)
|
||||
case "~due", "~planned", "~start", "~review":
|
||||
v, e := value()
|
||||
if e != nil {
|
||||
return "", nil, e
|
||||
}
|
||||
op := "="
|
||||
for _, prefix := range []string{"<=", ">=", "<", ">", "="} {
|
||||
if strings.HasPrefix(v, prefix) {
|
||||
op = prefix
|
||||
v = strings.TrimPrefix(v, prefix)
|
||||
break
|
||||
}
|
||||
}
|
||||
column := map[string]string{"~due": "due_on", "~planned": "planned_on", "~start": "COALESCE(json_extract(data,'$.start_on'),'')", "~review": "review_on"}[token]
|
||||
if v == "none" {
|
||||
if op != "=" {
|
||||
return "", nil, ErrTaskInvalid
|
||||
}
|
||||
clause = column + "=''"
|
||||
break
|
||||
}
|
||||
if v == "today" {
|
||||
v = today
|
||||
}
|
||||
if v == "tomorrow" {
|
||||
day, _ := time.Parse("2006-01-02", today)
|
||||
v = day.AddDate(0, 0, 1).Format("2006-01-02")
|
||||
}
|
||||
if v == "" || !validTaskDate(v) {
|
||||
return "", nil, ErrTaskInvalid
|
||||
}
|
||||
clause = column + "!='' AND " + column + op + "?"
|
||||
args = append(args, v)
|
||||
default:
|
||||
if strings.HasPrefix(token, "~") || token == "" {
|
||||
return "", nil, ErrTaskInvalid
|
||||
}
|
||||
clause = `instr(lower(title),lower(?))>0`
|
||||
args = append(args, token)
|
||||
}
|
||||
if neg {
|
||||
clause = "NOT (" + clause + ")"
|
||||
}
|
||||
parts = append(parts, "("+clause+")")
|
||||
}
|
||||
if !archived {
|
||||
parts = append(parts, "archived=0")
|
||||
}
|
||||
return strings.Join(parts, " AND "), args, nil
|
||||
}
|
||||
|
||||
func taskFilterTokens(source string) ([]string, error) {
|
||||
var tokens []string
|
||||
var word strings.Builder
|
||||
var quote rune
|
||||
escaped, started := false, false
|
||||
for _, r := range source {
|
||||
if unicode.IsControl(r) && !unicode.IsSpace(r) {
|
||||
return nil, ErrTaskInvalid
|
||||
}
|
||||
if escaped {
|
||||
word.WriteRune(r)
|
||||
escaped = false
|
||||
started = true
|
||||
continue
|
||||
}
|
||||
if r == '\\' {
|
||||
escaped = true
|
||||
started = true
|
||||
continue
|
||||
}
|
||||
if quote != 0 {
|
||||
if r == quote {
|
||||
quote = 0
|
||||
} else {
|
||||
word.WriteRune(r)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if r == '\'' || r == '"' {
|
||||
quote = r
|
||||
started = true
|
||||
continue
|
||||
}
|
||||
if unicode.IsSpace(r) {
|
||||
if started {
|
||||
tokens = append(tokens, word.String())
|
||||
word.Reset()
|
||||
started = false
|
||||
}
|
||||
continue
|
||||
}
|
||||
word.WriteRune(r)
|
||||
started = true
|
||||
}
|
||||
if quote != 0 || escaped {
|
||||
return nil, ErrTaskInvalid
|
||||
}
|
||||
if started {
|
||||
tokens = append(tokens, word.String())
|
||||
}
|
||||
if len(tokens) > 64 {
|
||||
return nil, ErrTaskInvalid
|
||||
}
|
||||
return tokens, nil
|
||||
}
|
||||
|
||||
func taskIndexOrder(key string) string {
|
||||
return map[string]string{"": "COALESCE(NULLIF(due_on,''),'9999-99-99')", "due": "COALESCE(NULLIF(due_on,''),'9999-99-99')", "planned": "COALESCE(NULLIF(planned_on,''),'9999-99-99')", "title": "lower(title)", "status": "status", "priority": "COALESCE(json_extract(data,'$.priority'),0)", "created": "created_at_ms", "updated": "updated_at_ms"}[key]
|
||||
}
|
||||
+61
-5
@@ -5,6 +5,7 @@ import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
@@ -24,6 +25,7 @@ type TaskRecord struct {
|
||||
Kind string `json:"kind"`
|
||||
Title string `json:"title"`
|
||||
Notes string `json:"notes"`
|
||||
References []string `json:"references,omitempty"`
|
||||
NotesSubpath string `json:"notes_subpath,omitempty"`
|
||||
ProjectUUID string `json:"project_uuid"`
|
||||
ParentUUID string `json:"parent_uuid,omitempty"`
|
||||
@@ -51,6 +53,7 @@ type TaskRecord struct {
|
||||
}
|
||||
|
||||
type TaskQuery struct {
|
||||
Filter, Sort, Order string
|
||||
Kind, View, Project, Search, Today, Before string
|
||||
Parent string
|
||||
Hierarchy bool
|
||||
@@ -117,6 +120,22 @@ func validTaskDate(v string) bool {
|
||||
}
|
||||
|
||||
func validateTask(item *TaskRecord) error {
|
||||
if len(item.References) > 20 {
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
for _, ref := range item.References {
|
||||
u, err := url.Parse(ref)
|
||||
if err != nil || len(ref) > 4096 || strings.ContainsAny(ref, "\\\r\n\x00\t ") || u.User != nil || !utf8.ValidString(ref) {
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
if u.Scheme == "http" || u.Scheme == "https" {
|
||||
if u.Hostname() == "" {
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
} else if u.Scheme != "" || u.Host != "" || !strings.HasPrefix(ref, "/") || strings.HasPrefix(ref, "//") {
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
}
|
||||
if item.Complexity < 0 || item.Complexity > 5 {
|
||||
return ErrTaskInvalid
|
||||
}
|
||||
@@ -262,6 +281,11 @@ func (s *Store) saveTask(ctx context.Context, domain, actor string, item TaskRec
|
||||
if err = json.Unmarshal([]byte(oldJSON), &old); err != nil {
|
||||
return TaskRecord{}, err
|
||||
}
|
||||
// Older CLI/DAV clients omit this optional field. An explicit [] clears
|
||||
// references; omission must not erase attachments during unrelated edits.
|
||||
if expected > 0 && item.References == nil {
|
||||
item.References = old.References
|
||||
}
|
||||
if expected == 0 { // Safe retry of a create with the same client-generated UUID.
|
||||
candidate := item
|
||||
candidate.Version, candidate.CreatedMS, candidate.UpdatedMS, candidate.CompletedMS = old.Version, old.CreatedMS, old.UpdatedMS, old.CompletedMS
|
||||
@@ -408,6 +432,13 @@ func (s *Store) ListTasks(ctx context.Context, domain, actor string, query TaskQ
|
||||
if query.Limit < 1 || query.Limit > 100 {
|
||||
query.Limit = 60
|
||||
}
|
||||
index := query.View == "index"
|
||||
if index && (query.Kind != "task" || query.Hierarchy || taskIndexOrder(query.Sort) == "" || (query.Order != "" && query.Order != "asc" && query.Order != "desc")) {
|
||||
return nil, "", ErrTaskInvalid
|
||||
}
|
||||
if !index && (query.Filter != "" || query.Sort != "" || query.Order != "") {
|
||||
return nil, "", ErrTaskInvalid
|
||||
}
|
||||
q := `SELECT data FROM organizer_items WHERE domain_uuid=? AND owner_uuid=? AND kind=?`
|
||||
args := []any{domain, actor, query.Kind}
|
||||
hierarchy := query.Hierarchy && query.Kind == "task" && query.View != "family"
|
||||
@@ -420,7 +451,14 @@ func (s *Store) ListTasks(ctx context.Context, domain, actor string, query TaskQ
|
||||
WHERE i.domain_uuid=? AND i.owner_uuid=?
|
||||
) SELECT data FROM task_rows WHERE kind=?`
|
||||
}
|
||||
if query.View == "family" {
|
||||
if index {
|
||||
filter, values, err := taskIndexFilter(query.Filter, query.Today)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
q += " AND " + filter
|
||||
args = append(args, values...)
|
||||
} else if query.View == "family" {
|
||||
if query.Parent == "" || query.Kind != "task" {
|
||||
return nil, "", ErrTaskInvalid
|
||||
}
|
||||
@@ -438,7 +476,11 @@ func (s *Store) ListTasks(ctx context.Context, domain, actor string, query TaskQ
|
||||
}
|
||||
if query.Project != "" {
|
||||
q += ` AND project_uuid=?`
|
||||
args = append(args, query.Project)
|
||||
project := query.Project
|
||||
if index && project == "none" {
|
||||
project = ""
|
||||
}
|
||||
args = append(args, project)
|
||||
}
|
||||
if query.Kind == "task" {
|
||||
switch query.View {
|
||||
@@ -462,7 +504,7 @@ func (s *Store) ListTasks(ctx context.Context, domain, actor string, query TaskQ
|
||||
case "all":
|
||||
q += ` AND status NOT IN ('done','cancelled')`
|
||||
case "archived":
|
||||
case "family":
|
||||
case "family", "index":
|
||||
default:
|
||||
return nil, "", ErrTaskInvalid
|
||||
}
|
||||
@@ -472,7 +514,15 @@ func (s *Store) ListTasks(ctx context.Context, domain, actor string, query TaskQ
|
||||
args = append(args, query.Search)
|
||||
}
|
||||
if query.Before != "" {
|
||||
if hierarchy {
|
||||
if index {
|
||||
comparison := ">"
|
||||
if query.Order == "desc" {
|
||||
comparison = "<"
|
||||
}
|
||||
key := taskIndexOrder(query.Sort)
|
||||
q += " AND (" + key + ",uuid)" + comparison + "(SELECT " + key + ",uuid FROM organizer_items WHERE domain_uuid=? AND owner_uuid=? AND kind='task' AND uuid=?)"
|
||||
args = append(args, domain, actor, query.Before)
|
||||
} else if hierarchy {
|
||||
// A separate indexed cursor lookup keeps the wide task_rows CTE
|
||||
// single-use, avoiding materialization of every private JSON body.
|
||||
var familyCreated, created int64
|
||||
@@ -494,7 +544,13 @@ func (s *Store) ListTasks(ctx context.Context, domain, actor string, query TaskQ
|
||||
args = append(args, domain, actor, query.Before)
|
||||
}
|
||||
}
|
||||
if hierarchy {
|
||||
if index {
|
||||
direction := "ASC"
|
||||
if query.Order == "desc" {
|
||||
direction = "DESC"
|
||||
}
|
||||
q += " ORDER BY " + taskIndexOrder(query.Sort) + " " + direction + ",uuid " + direction + " LIMIT ?"
|
||||
} else if hierarchy {
|
||||
q += ` ORDER BY family_created DESC,family_uuid DESC,family_head DESC,created_at_ms DESC,uuid DESC LIMIT ?`
|
||||
} else {
|
||||
q += ` ORDER BY created_at_ms DESC,uuid DESC LIMIT ?`
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
"""Synthetic NeoMutt pipe -> real CLI -> full HTTP router -> browser viewer.
|
||||
|
||||
Run by TestNeoMuttMailViewerFlow; never reads a real mail or CLI profile.
|
||||
"""
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
from email.header import Header
|
||||
from html.parser import HTMLParser
|
||||
from urllib.parse import quote, unquote, urlencode, urlsplit
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
|
||||
class Links(HTMLParser):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.links = []
|
||||
|
||||
def handle_starttag(self, tag, attrs):
|
||||
attrs = dict(attrs)
|
||||
if 'browser-row' in attrs.get('class', '').split():
|
||||
self.links.append(attrs.get('data-path', ''))
|
||||
if tag == 'a':
|
||||
self.links.append(attrs.get('href', ''))
|
||||
|
||||
|
||||
def main():
|
||||
fixture = json.load(sys.stdin)
|
||||
root = Path(fixture['root'])
|
||||
env = {**os.environ, 'HOME': str(root), 'XDG_CONFIG_HOME': str(root / 'config')}
|
||||
executable = str(Path(__file__).with_name('pages').resolve())
|
||||
binary = os.environ.get('PAGES_CLI_TEST_BINARY')
|
||||
command = [str(Path(binary).resolve())] if binary else [sys.executable, executable]
|
||||
|
||||
def cli(*args, data=b''):
|
||||
run = subprocess.run([*command, *args], input=data,
|
||||
capture_output=True, env=env, timeout=15)
|
||||
assert run.returncode == 0, (args, run.stderr.decode())
|
||||
return run.stdout
|
||||
|
||||
def get(path):
|
||||
request = Request(fixture['origin'] + quote(path, safe='/:?=&%'),
|
||||
headers={'Cookie': 'pageswiki_session=' + fixture['browser'],
|
||||
'Accept-Language': 'ja,en;q=0.8'})
|
||||
with urlopen(request, timeout=10) as response:
|
||||
body = response.read().decode()
|
||||
assert response.status == 200, (path, response.status)
|
||||
assert response.headers.get_content_type() == 'text/html', (path, body[:100])
|
||||
assert unquote(urlsplit(response.url).path) == unquote(urlsplit(path).path).rstrip('/'), response.url
|
||||
return body
|
||||
|
||||
cli('configure', '--origin', fixture['origin'], '--username', 'admin')
|
||||
cli('login', data=b'a long test password\n')
|
||||
paths = []
|
||||
for parent in ['/tasks', '/mail', '/private/mail', '/受信 メール', '/u/admin/mail', '/docs/mail', '/api/mail']:
|
||||
cli('task', 'preferences', '--wiki-prefix', parent)
|
||||
for charset in ['utf-8', 'iso-2022-jp']:
|
||||
for kind in ['ml', 'message-id', 'hash']:
|
||||
number = len(paths) + 1
|
||||
title = '日本語の依頼'
|
||||
subject = (f'[example.list {number:05d}] ' if kind == 'ml' else '') + title
|
||||
# pipe_decode=no / pipe_split=yes: exactly one un-decoded RFC mail
|
||||
# is delivered to the CLI's stdin, as in the published NeoMutt macro.
|
||||
raw = ('From: Test <test@example.invalid>\r\n'
|
||||
'Date: Sat, 31 Jan 2026 23:30:00 -0800\r\n'
|
||||
'Subject: ' + Header(subject, charset).encode() + '\r\n'
|
||||
+ (f'Message-ID: <synthetic-{number}@example.invalid>\r\n' if kind != 'hash' else '')
|
||||
+ 'MIME-Version: 1.0\r\nContent-Type: text/plain; charset=utf-8\r\n'
|
||||
'Content-Transfer-Encoding: 8bit\r\n\r\n'
|
||||
f'Synthetic mail body {number}. {{' + '{children}}\r\n').encode()
|
||||
result = json.loads(cli('task', 'from-mail', data=raw))
|
||||
path = result['page_path']
|
||||
suffix = ('example.list/' + str(number) if kind == 'ml' else '2026/01/' +
|
||||
(result['item']['uuid'] if kind == 'message-id' else hashlib.sha256(raw).hexdigest()))
|
||||
assert path == parent + '/' + suffix, path
|
||||
assert result['item']['title'] == title
|
||||
# Confirm browser listing actually links to the same semantic URL.
|
||||
listing = get('/v/browser' + path.rsplit('/', 1)[0])
|
||||
links = Links(); links.feed(listing)
|
||||
linked = next((href for href in links.links if unquote(urlsplit(href).path) == path), None)
|
||||
assert linked is not None, ('missing listing link', path, links.links, listing[:600])
|
||||
page = get(path)
|
||||
assert f'Synthetic mail body {number}.' in page, path
|
||||
assert title in page, path
|
||||
assert '{"detail":"Not Found"}' not in page
|
||||
assert f'Synthetic mail body {number}.' in get(linked)
|
||||
assert f'Synthetic mail body {number}.' in get(path + '/')
|
||||
assert f'Synthetic mail body {number}.' in get(path + '?lang=ja')
|
||||
paths.append(path)
|
||||
if fixture['chromium']:
|
||||
# Real browser session, normal navigation and scripts, without injecting
|
||||
# page HTML or bypassing the production handler.
|
||||
for i, path in enumerate([paths[0], paths[14], paths[-1]]):
|
||||
target = fixture['origin'] + '/fixture-browser-login?' + urlencode({'return': path})
|
||||
run = subprocess.run(['chromium', '--headless', '--no-sandbox', '--disable-gpu',
|
||||
'--disable-background-networking', '--no-proxy-server',
|
||||
'--user-data-dir=' + str(root / ('chromium-' + str(i))),
|
||||
'--dump-dom', '--virtual-time-budget=2000', target],
|
||||
capture_output=True, timeout=20)
|
||||
assert run.returncode == 0, run.stderr.decode()[-1000:]
|
||||
assert 'Synthetic mail body' in run.stdout.decode(), (path, run.stdout.decode()[:500])
|
||||
print('MAIL_VIEWER_OK cases=' + str(len(paths)) + ' chromium=' + str(fixture['chromium']))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -5,3 +5,6 @@ body.mode-editor .page-html {
|
||||
body.mode-view textarea.editor {
|
||||
display: none;
|
||||
}
|
||||
.editor-change-message { display:flex; align-items:center; gap:.35rem; min-width:0; font-size:.8rem; }
|
||||
.editor-change-message input { width:clamp(8rem,16vw,16rem); min-width:0; padding:.3rem .5rem; color:var(--fg); background:var(--bg); border:1px solid var(--border); border-radius:.3rem; }
|
||||
@media(max-width:760px) { .editor-change-message span { display:none; } .editor-change-message input { width:8rem; } }
|
||||
@@ -6,7 +6,9 @@
|
||||
.organizer-nav-icons{display:flex;align-items:center;gap:.15rem}.organizer-launch{display:inline-flex;align-items:center;justify-content:center;color:var(--fg);width:2.1rem;height:2.1rem;box-sizing:border-box;padding:.35rem;border-radius:50%}
|
||||
.organizer-launch svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.organizer-launch:hover{color:var(--accent)}
|
||||
.organizer-page .topbar{flex-wrap:wrap;gap:.2rem}.organizer-settings-content{min-width:0;padding:.75rem 1rem}.organizer-settings-content #task-productivity{margin:0;padding:0}.organizer-calendar-options{display:grid;gap:.4rem}.organizer-calendar-options label{display:flex;align-items:center;gap:.5rem;min-height:2rem}
|
||||
#organizer-dashboard{max-width:1800px;margin:auto;padding:1rem;box-sizing:border-box;color:var(--fg)}
|
||||
#organizer-dashboard{width:100%;max-width:none;margin:auto;padding:.65rem;box-sizing:border-box;color:var(--fg)}
|
||||
.personal-appearance fieldset{display:grid;gap:.6rem;border:0;padding:0;max-width:48rem}.personal-appearance label{display:flex;align-items:center;justify-content:space-between;gap:1rem}.personal-appearance input,.personal-appearance select{min-width:0;max-width:65%;color:var(--fg);background:var(--input-bg,var(--bg));border:1px solid var(--border);padding:.35rem}.personal-appearance .home-palette-controls{display:grid;gap:.6rem}
|
||||
.dashboard-agenda li{align-items:stretch;gap:.65rem;padding:.45rem 0}.dashboard-agenda time{width:6.4rem;flex-shrink:0;padding-top:.35rem;font-variant-numeric:tabular-nums}.agenda-event{min-width:0;flex:1;border-left:3px solid var(--accent);border-radius:.3rem;background:color-mix(in srgb,var(--accent) 9%,var(--bg));padding:.35rem .55rem}.agenda-event a{display:block;white-space:normal;overflow-wrap:anywhere}.agenda-event small{display:block;opacity:.65;font-size:.72rem}.dashboard-agenda .is-current .agenda-event{background:color-mix(in srgb,var(--accent) 23%,var(--bg));box-shadow:0 0 0 1px var(--accent)}.dashboard-list a.dashboard-note{flex:0 0 auto}.dashboard-command{display:flex;gap:.25rem}.dashboard-command input{min-width:0;flex:1;font:inherit;color:var(--fg);background:var(--input-bg,var(--bg));border:1px solid var(--border);padding:.5rem}.widget-body pre{white-space:pre-wrap;overflow-wrap:anywhere}
|
||||
.dashboard-toolbar{display:flex;justify-content:space-between;align-items:center;gap:.75rem;flex-wrap:wrap}.dashboard-toolbar h1{margin:0;font-size:1.5rem}#dashboard-controls{display:flex;gap:.35rem;align-items:center;flex-wrap:wrap}
|
||||
#organizer-dashboard button,#organizer-dashboard select,#organizer-calendar-defaults button{font:inherit;color:var(--fg);background:var(--input-bg,var(--bg));border:1px solid var(--border,#8885);border-radius:.35rem;padding:.3rem .5rem;cursor:pointer}
|
||||
#organizer-dashboard button:disabled{opacity:.5;cursor:default}#organizer-dashboard a{color:var(--link,var(--accent))}#dashboard-status{min-height:1.3em;margin:.4rem 0;font-size:.85rem}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#tasks-app[data-view=index]{max-width:none;grid-template-columns:13rem minmax(0,1fr);padding:.65rem;gap:.75rem}
|
||||
[data-view=index] .task-inline-header,[data-view=index] #tasks-help,[data-view=index] #tasks-capture,[data-view=index] .tasks-search{display:none!important}
|
||||
[data-view=index] .tasks-workspace{min-width:0}
|
||||
[data-view=index] #tasks-focus{padding:.35rem .5rem;gap:.35rem;border-radius:.3rem;margin-bottom:.35rem;font-size:.85rem}
|
||||
[data-view=index] #tasks-nav{min-width:0;max-height:80dvh;overflow:auto}
|
||||
[data-view=index] #tasks-nav h2{font-size:1rem;margin:.25rem 0}
|
||||
[data-view=index] #tasks-nav input{width:100%;box-sizing:border-box;min-width:0}
|
||||
.task-index-projects{display:flex;flex-direction:column;gap:1px}.task-index-projects button{text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:0!important;border-radius:0!important;font-size:.85rem!important}
|
||||
.task-index-projects [aria-current=true]{color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 18%,var(--bg))!important}
|
||||
.task-index-filter{display:flex;align-items:center;gap:.35rem;margin:.3rem 0}.task-index-filter input{flex:1;min-width:0;font-family:monospace}.task-index-filter select{max-width:9rem}
|
||||
.task-index-actions{display:flex;gap:.25rem;margin:.25rem 0}.task-index-actions button{min-width:2rem}
|
||||
[data-view=index] #tasks-status{margin:.25rem 0;min-height:1.3em;font-size:.8rem}
|
||||
[data-view=index] .tasks-list-scroll{max-height:65dvh;overflow:auto;scrollbar-gutter:stable;overscroll-behavior:contain}
|
||||
.task-index-grid{width:100%;border-collapse:collapse;table-layout:fixed;font-size:.85rem;outline-offset:-2px}
|
||||
.task-index-grid th,.task-index-grid td{padding:.3rem .4rem;border-bottom:1px solid var(--border);text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.task-index-grid th{position:sticky;top:0;background:var(--bg);z-index:1;font-size:.75rem;color:var(--muted,var(--fg))}
|
||||
.task-index-grid th:first-child{width:5.5rem}.task-index-grid th:nth-child(3),.task-index-grid th:nth-child(4){width:6rem}.task-index-grid th:nth-child(5){width:3.5rem}.task-index-grid th:last-child{width:2rem}
|
||||
.task-index-grid tr[aria-selected=true]{background:color-mix(in srgb,var(--accent) 20%,var(--bg));box-shadow:inset 3px 0 var(--accent)}
|
||||
.task-index-grid tr{cursor:default}.task-index-grid tbody tr:hover{background:color-mix(in srgb,var(--accent) 10%,var(--bg))}.task-index-grid td.task-index-overdue{color:var(--danger,#ff8a80)}
|
||||
.task-index-help{color:var(--fg);background:var(--bg);border:1px solid var(--border);border-radius:.6rem;width:min(40rem,90vw);max-height:85dvh;overflow:auto}.task-index-help::backdrop{background:#0008}.task-index-help>button{float:right}.task-index-help dl{display:grid;grid-template-columns:auto 1fr;gap:.35rem 1rem}.task-index-help dd{margin:0}.task-index-help pre{white-space:pre-wrap;font-size:.85rem}
|
||||
@media(max-width:760px){#tasks-app[data-view=index]{grid-template-columns:minmax(0,1fr)}[data-view=index] #tasks-nav{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.3rem;max-height:none;overflow:visible}[data-view=index] #tasks-nav h2{display:none}[data-view=index] #tasks-nav>input{grid-row:1;grid-column:1}[data-view=index] #tasks-nav>a{grid-row:1;grid-column:2;font-size:.8rem}.task-index-projects{grid-column:1/-1;grid-row:2;flex-direction:row;overflow:auto;max-width:100%}.task-index-projects button{flex-shrink:0;min-height:40px}.task-index-filter{flex-wrap:wrap}.task-index-filter input{flex-basis:70%}.task-index-grid th:nth-child(4),.task-index-grid td:nth-child(4),.task-index-grid th:nth-child(5),.task-index-grid td:nth-child(5){display:none}.task-index-grid td{padding:.7rem .3rem}.task-index-grid th:first-child{width:3.7rem}.task-index-grid th:last-child{width:1.2rem}.task-index-actions button{min-width:44px;min-height:44px}}
|
||||
@@ -99,6 +99,13 @@ body:has(#tasks-dialog[open]){overflow:hidden}
|
||||
.task-child-capture{display:flex;min-width:0;gap:.25rem}
|
||||
.task-inline-row>a{color:var(--accent);font-size:.75rem}
|
||||
.task-inline-title{position:relative}
|
||||
.task-inline-title input:not(:focus){color:transparent!important;caret-color:var(--fg)}
|
||||
.task-title-preview{position:absolute;inset:0;display:block;align-content:center;white-space:pre;overflow:hidden;text-overflow:ellipsis;pointer-events:none;padding:0 .3rem;color:var(--fg);font-size:.8rem}
|
||||
.task-is-child .task-title-preview{padding-left:1.3rem}
|
||||
.task-inline-row[data-done=true] .task-title-preview{text-decoration:line-through;opacity:.7}
|
||||
@media(max-width:1023px){.task-title-preview{top:1.3rem;font-size:1rem}}
|
||||
.task-inline-title input:focus+.task-title-preview{display:none}
|
||||
.tasks-actions .has-wiki-note{color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 15%,var(--bg))!important}
|
||||
.task-context-badge{position:absolute;right:.3rem;bottom:.65rem;font-size:.65rem;color:var(--muted,var(--fg));pointer-events:none}
|
||||
#tasks-app .task-inline-row[data-context=true]>.task-inline-main input[name=title]{padding-right:2.5rem}
|
||||
.task-date-nav,.task-date-nav>label{display:flex;align-items:center;gap:.35rem;flex-wrap:wrap}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
// Commands address exact UUIDs, never ambiguous titles. Mutations reuse the
|
||||
// task API's ownership checks and revision CAS; this is not a shell.
|
||||
window.PagesDashboardCommands=(body,{request,api,t,today,refresh,writable,signal})=>{
|
||||
const form=document.createElement('form'),input=document.createElement('input'),submit=document.createElement('button'),help=document.createElement('details'),summary=document.createElement('summary'),examples=document.createElement('pre'),status=document.createElement('p');
|
||||
form.className='dashboard-command';input.ariaLabel=t('Task command','タスクコマンド');input.placeholder='add task … / today UUID / tomorrow UUID';input.required=true;input.maxLength=500;submit.textContent='↵';submit.title=submit.ariaLabel=t('Run','実行');submit.disabled=input.disabled=!writable;status.role='status';summary.textContent='?';examples.textContent='add task 件名\ntoday UUID\ntomorrow UUID\ndue UUID YYYY-MM-DD\ndue UUID clear\ndone UUID\ndelete UUID';help.append(summary,examples);form.append(input,submit);body.replaceChildren(form,status,help);
|
||||
const suggestions=document.createElement('datalist');suggestions.id='dashboard-command-tasks';input.setAttribute('list',suggestions.id);input.autocomplete='off';body.append(suggestions);
|
||||
let pending=null,timer,lookup;
|
||||
signal?.addEventListener('abort',()=>{clearTimeout(timer);lookup?.abort();},{once:true});
|
||||
input.addEventListener('input',()=>{
|
||||
clearTimeout(timer);lookup?.abort();suggestions.replaceChildren();
|
||||
const match=/^(today|tomorrow|due|done|delete) (.*)$/.exec(input.value);
|
||||
if(!match||/^[0-9a-f]{8}-/.test(match[2]))return;
|
||||
const command=input.value;lookup=new AbortController();const requestSignal=lookup.signal;
|
||||
timer=setTimeout(async()=>{
|
||||
try {const data=await request(api+'items?'+new URLSearchParams({kind:'task',view:'all',limit:'10',q:match[2]}),{signal:AbortSignal.any([requestSignal,AbortSignal.timeout(10000)])});
|
||||
if(input.value!==command||requestSignal.aborted||!body.isConnected)return;
|
||||
for(const item of data.items){const option=document.createElement('option');option.value=match[1]+' '+item.uuid+(match[1]==='due'?' '+today:'');option.label=match[1]+' '+item.title;suggestions.append(option);}
|
||||
}catch{/* Suggestions must never prevent command entry. */}
|
||||
},250);
|
||||
});
|
||||
form.onsubmit=async e=>{
|
||||
e.preventDefault();if(submit.disabled)return;
|
||||
const command=input.value.trim(),tomorrow=new Date(today+'T12:00:00Z');tomorrow.setUTCDate(tomorrow.getUTCDate()+1);
|
||||
submit.disabled=true;input.disabled=true;status.textContent='';
|
||||
try{
|
||||
let saved;
|
||||
if(command.startsWith('add task ')){
|
||||
const title=command.slice(9).trim();if(!title)throw Error(t('Enter a title.','件名を入力してください。'));
|
||||
if(!pending||pending.command!==command){const preferences=await request(api+'preferences');pending={command,item:{...preferences.defaults,uuid:crypto.randomUUID(),kind:'task',title,notes:'',status:'todo',bucket:'inbox',priority:1,archived:false,version:0}};}
|
||||
saved=await request(api+'items',{method:'POST',body:JSON.stringify(pending.item)});
|
||||
}else{
|
||||
const match=/^(today|tomorrow|due|done|delete) ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?: (\d{4}-\d{2}-\d{2}|clear))?$/.exec(command);
|
||||
if(!match||(match[1]==='due')!==!!match[3])throw Error(t('Unknown command. See ?.','コマンドを確認してください(?)。'));
|
||||
const [,action,id,date]=match,{item}=await request(api+'items/'+id);
|
||||
if(item.kind!=='task')throw Error(t('Select a task, not a project.','プロジェクトではなくタスクを指定してください。'));
|
||||
if(action==='delete'){
|
||||
if(!confirm(item.title+'\n'+t('Permanently delete this task?','このタスクを完全に削除しますか?')))return;
|
||||
await request(api+'items/'+id,{method:'DELETE',headers:{'If-Match':'"'+item.version+'"'}});
|
||||
}else{
|
||||
if(action==='due'){item.due_on=date==='clear'?'':date;if(!item.due_on)item.notify_due=false;}
|
||||
if(action==='today'||action==='tomorrow')item.planned_on=action==='today'?today:tomorrow.toISOString().slice(0,10);
|
||||
if(action==='done')item.status='done';
|
||||
saved=await request(api+'items/'+id,{method:'PUT',headers:{'If-Match':'"'+item.version+'"'},body:JSON.stringify(item)});
|
||||
}
|
||||
}
|
||||
pending=null;input.value='';status.textContent=t('Saved','保存しました');
|
||||
if(saved?.item){const a=document.createElement('a');a.href='/v/plan/task/'+saved.item.uuid;a.textContent=' '+saved.item.title;status.append(a);}
|
||||
refresh();
|
||||
}catch(error){status.textContent=error.message;}finally{submit.disabled=input.disabled=!writable;input.focus();}
|
||||
};
|
||||
};
|
||||
})();
|
||||
+6
-1
@@ -252,6 +252,10 @@ window.PagesEditor = {
|
||||
if (this.saving) return false
|
||||
if (!this.dirty) return !this.paused
|
||||
if (!manual && this.paused) return false
|
||||
const messageField=document.getElementById('revision-message')
|
||||
const changeMessage=messageField?.value.trim()||''
|
||||
// A supplied message belongs to the next explicit save, not autosave.
|
||||
if (!manual && changeMessage) return false
|
||||
if (manual) this.mergeAttempts=0
|
||||
this.persist()
|
||||
this.saving = true
|
||||
@@ -261,11 +265,12 @@ window.PagesEditor = {
|
||||
try {
|
||||
body = await this.canonical(text,format)
|
||||
const data = await this.post('/_/api/v1/revisions/save',{
|
||||
object_uuid:this.value('object-uuid'),body,message:manual?'manual-save':'autosave',
|
||||
object_uuid:this.value('object-uuid'),body,message:manual?(changeMessage||'manual-save'):'autosave',
|
||||
lang:this.value('page-language')||'und',content_type:this.value('page-content-type'),filename:this.value('page-filename'),
|
||||
base_revision_uuid:this.baseRevision,editor_principal_uuid:this.owner,
|
||||
})
|
||||
if (!data.revision_uuid) throw {kind:'failed'}
|
||||
if (manual && messageField?.value.trim()===changeMessage) messageField.value=''
|
||||
this.baseRevision = data.revision_uuid
|
||||
this.baseBody = typeof data.body==='string' ? data.body : body
|
||||
this.initialText = text; this.initialFormat = format
|
||||
|
||||
+1
-1
@@ -273,7 +273,7 @@
|
||||
form.onsubmit=async event=>{event.preventDefault();if(busy||resolved===null||!form.reportValidity())return;const body='Source: '+item.url+'\nFeed: '+item.feed+'\n\n'+notes.value+(copy.checked?'\n\n'+item.body:'');const spec={title:title.value,notes:notes.value,prefix:resolved,body,task:task.checked};const fingerprint=JSON.stringify(spec);if(!pending||pending.fingerprint!==fingerprint)pending={fingerprint,request_id:requestID};busy=true;save.disabled=true;
|
||||
try{let data;if(task.checked){const input={request_id:pending.request_id,title:title.value,notes:(notes.value+'\nSource: '+item.url).trim()};if(spec.prefix){input.wiki_prefix=spec.prefix;input.wiki_body=body;}const res=await fetch('/_/api/v1/extension/organizer.tasks/capture',{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json'},body:JSON.stringify(input)});data=await res.json().catch(()=>({}));if(!res.ok||res.redirected)throw Error(t('Capture failed: ','作成に失敗: ')+(data.error||res.status));}
|
||||
else data=await post('note',{request_id:pending.request_id,source:item.source,id:item.id,path:spec.prefix.replace(/\/$/,'')+'/rss-'+pending.request_id,title:title.value,body,confirm_publication:confirm.checked});
|
||||
dialog.replaceChildren(el('h2',t('Created','作成しました')));if(data.item){const a=el('a',t('Open task','タスクを開く'));a.href='/v/plan/task/'+encodeURIComponent(data.item.uuid);dialog.append(a);}const page=data.page_uuid||data.item?.page_uuid;if(page){const a=el('a',t('Open Wiki','Wikiを開く'));a.href='/v/uuid:'+encodeURIComponent(page);dialog.append(el('p'),a);}const done=button(t('Close','閉じる'),'',close);dialog.append(el('p'),done);done.focus();
|
||||
dialog.replaceChildren(el('h2',t('Created','作成しました')));if(data.item){const a=el('a',t('Open task','タスクを開く'));a.href='/v/plan/task/'+encodeURIComponent(data.item.uuid);dialog.append(a);}const page=data.page_uuid||data.item?.page_uuid;if(page){const a=el('a',t('Open Wiki','Wikiを開く'));a.href='/o/uuid:'+encodeURIComponent(page);dialog.append(el('p'),a);}const done=button(t('Close','閉じる'),'',close);dialog.append(el('p'),done);done.focus();
|
||||
}catch(e){notice.textContent=e.message;}finally{busy=false;save.disabled=resolved===null;}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
let saved = Number(input.value);
|
||||
const paletteNames = ['home_palette_mode','home_palette_strength','home_palette_brightness'];
|
||||
let savedPalette = paletteNames.map(name => form.elements[name]?.value);
|
||||
let savedWallpaper = ['home_wallpaper_path','home_wallpaper_opacity'].map(name=>form.elements[name]?.value);
|
||||
const palettePreview = () => {
|
||||
const strength = Number(form.elements.home_palette_strength?.value ?? 35);
|
||||
const label = form.querySelector('[data-palette-strength]');
|
||||
@@ -24,6 +25,7 @@
|
||||
palettePreview();
|
||||
};
|
||||
const restore = () => {
|
||||
['home_wallpaper_path','home_wallpaper_opacity'].forEach((name,i)=>{if(form.elements[name])form.elements[name].value=savedWallpaper[i];});
|
||||
input.value = String(saved);
|
||||
paletteNames.forEach((name,i) => { if (form.elements[name]) form.elements[name].value=savedPalette[i]; });
|
||||
preview(saved);
|
||||
@@ -71,11 +73,14 @@
|
||||
signal: AbortSignal.timeout(15000),
|
||||
});
|
||||
if (!response.ok) throw new Error((await response.text()).trim());
|
||||
await response.json();
|
||||
const result=await response.json();form.elements.version.value=String(result.version);
|
||||
const wallpaper=['home_wallpaper_path','home_wallpaper_opacity'].map(name=>submitted.get(name));
|
||||
const wallpaperChanged=wallpaper.some((value,i)=>value!==savedWallpaper[i]);savedWallpaper=wallpaper;
|
||||
saved = Number(submitted.get('home_glass_transparency'));
|
||||
savedPalette = paletteNames.map(name => submitted.get(name));
|
||||
preview(saved);
|
||||
status.textContent = form.dataset.saved;
|
||||
if(wallpaperChanged){location.reload();return;}
|
||||
window.setTimeout(() => dialog.open && dialog.close(), 350);
|
||||
} catch (error) {
|
||||
status.textContent = error.message;
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
const names={progress:t('Today’s completion','本日の達成率'),today:t('Today’s tasks','本日のタスク'),tomorrow:t('Tomorrow’s tasks','明日のタスク'),tasks:t('Tasks','タスク'),schedule:t('Today’s schedule','本日のスケジュール'),activity:t('Activity report','達成度・作業レポート')};
|
||||
const defaults=[['progress',4,3],['today',4,3],['tomorrow',4,3],['tasks',8,4],['schedule',4,4],['activity',12,5]].map(([id,width,height])=>({id,width,height,...(id==='tasks'?{tab:'inbox'}:{})}));
|
||||
names.feeds=t('RSS · latest cached articles','RSS · 最近の取得記事');
|
||||
const available=[...defaults,{id:'feeds',width:6,height:4}];
|
||||
names['tomorrow-schedule']=t('Tomorrow’s schedule','明日のスケジュール');names.commands=t('Task commands','タスクコマンド');
|
||||
const available=[...defaults,{id:'feeds',width:6,height:4},{id:'tomorrow-schedule',width:6,height:4},{id:'commands',width:6,height:3}];
|
||||
const tabs={inbox:'Inbox',backlog:'Backlog',someday:'Someday',review:'Review',all:'Incomplete',done:'Done'};
|
||||
const el=(tag,text,cls)=>{const n=document.createElement(tag);if(text!==undefined)n.textContent=text;if(cls)n.className=cls;return n;};
|
||||
function button(text,label,fn){const b=el('button',text);b.type='button';b.title=b.ariaLabel=label;b.onclick=fn;return b;}
|
||||
@@ -28,7 +29,7 @@
|
||||
}
|
||||
const save=button(t('Save layout','配置を保存'),t('Save layout','配置を保存'),async()=>{
|
||||
if(saving||!loaded)return;saving=true;updateControls();
|
||||
try{const data=await request(api+'dashboard',{method:'PUT',signal:AbortSignal.timeout(15000),body:JSON.stringify({version,widgets})});version=data.version;dirty=false;status.textContent=t('Layout saved','配置を保存しました');}
|
||||
try{const data=await request(api+'dashboard',{method:'PUT',signal:AbortSignal.timeout(15000),body:JSON.stringify({version,widgets:widgets.map(({id,width,height,tab})=>({id,width,height,...(id==='tasks'?{tab:tab||'inbox'}:{})}))})});version=data.version;widgets=data.widgets;dirty=false;render();status.textContent=t('Layout saved','配置を保存しました');}
|
||||
catch(e){status.textContent=e.message;}finally{saving=false;updateControls();}
|
||||
});
|
||||
const edit=button('⚙',t('Arrange widgets','ウィジェットを配置'),()=>{editing=!editing;root.classList.toggle('is-arranging',editing);edit.setAttribute('aria-pressed',String(editing));});edit.setAttribute('aria-pressed','false');
|
||||
@@ -36,7 +37,7 @@
|
||||
const add=el('select');add.ariaLabel=t('Add widget','ウィジェットを追加');add.onchange=()=>{const item=available.find(w=>w.id===add.value);if(item){widgets.push({...item});render();changed();}};
|
||||
const reset=button(t('Reset layout','初期配置'),t('Reset layout','初期配置'),()=>{if(confirm(t('Replace this layout with the default layout? Save to apply.','初期配置に戻しますか? 保存するまでは確定しません。'))){widgets=defaults.map(x=>({...x}));render();changed();}});
|
||||
controls.append(refresh);if(writable)controls.append(edit,add,reset,save);
|
||||
function updateControls(){save.disabled=!dirty||saving||!loaded;edit.disabled=add.disabled=reset.disabled=saving||!loaded;refresh.disabled=!loaded;root.classList.toggle('dashboard-saving',saving);for(const card of cards.values())card.querySelectorAll('.widget-arrange button,.widget-arrange select,.widget-drag,.widget-resize').forEach(n=>n.disabled=saving);add.replaceChildren();const option=el('option',t('+ Add widget','+ ウィジェットを追加'));option.value='';add.append(option);for(const [id,name] of Object.entries(names)){if(widgets.some(w=>w.id===id)||id==='schedule'&&root.dataset.calendar!=='true')continue;const o=el('option',name);o.value=id;add.append(o);}}
|
||||
function updateControls(){save.disabled=!dirty||saving||!loaded;edit.disabled=add.disabled=reset.disabled=saving||!loaded;refresh.disabled=!loaded;root.classList.toggle('dashboard-saving',saving);for(const card of cards.values())card.querySelectorAll('.widget-arrange button,.widget-arrange select,.widget-drag,.widget-resize').forEach(n=>n.disabled=saving);add.replaceChildren();const option=el('option',t('+ Add widget','+ ウィジェットを追加'));option.value='';add.append(option);for(const [id,name] of Object.entries(names)){if(widgets.some(w=>w.id===id)||['schedule','tomorrow-schedule'].includes(id)&&root.dataset.calendar!=='true')continue;const o=el('option',name);o.value=id;add.append(o);}}
|
||||
function changed(){dirty=true;status.textContent=t('Unsaved layout changes','配置は未保存です');updateControls();}
|
||||
window.addEventListener('beforeunload',event=>{if(dirty){event.preventDefault();event.returnValue='';}});
|
||||
function applySize(item,card){card.style.setProperty('--widget-width',String(item.width));card.style.setProperty('--widget-height',String(item.height));}
|
||||
@@ -47,7 +48,7 @@
|
||||
const card=el('section',undefined,'dashboard-widget');card.id=item.id;card.dataset.widget=item.id;applySize(item,card);
|
||||
const header=el('header',undefined,'widget-header'),heading=el('h2',names[item.id]);heading.id='widget-title-'+item.id;card.setAttribute('aria-labelledby',heading.id);
|
||||
header.append(heading);const destinations={progress:'/v/plan/today',today:'/v/plan/today',tomorrow:'/v/plan/tasks/tomorrow',tasks:'/v/plan/tasks',schedule:'/v/plan',activity:'/v/plan/dashboard#activity'};
|
||||
destinations.feeds='/v/feeds';
|
||||
destinations.feeds='/v/feeds';destinations['tomorrow-schedule']='/v/plan';destinations.commands='/v/plan/tasks';
|
||||
const open=link('↗',destinations[item.id]);open.title=open.ariaLabel=t('Open ','開く: ')+names[item.id];header.append(open);
|
||||
const arrange=el('div',undefined,'widget-arrange');
|
||||
if(writable){
|
||||
@@ -81,6 +82,7 @@
|
||||
if(controller.signal.aborted||!card.isConnected)return;
|
||||
const signal=AbortSignal.any([controller.signal,AbortSignal.timeout(15000)]);
|
||||
try{
|
||||
if(item.id==='commands'){window.PagesDashboardCommands(body,{request,api,t,today,writable,signal:controller.signal,refresh:()=>{for(const w of widgets){if(w.id!=='commands')loadWidget(w,cards.get(w.id));}}});return;}
|
||||
if(item.id==='feeds'){
|
||||
const data=await request('/_/api/v1/extension/organizer.feeds/items',{signal});if(controller.signal.aborted)return;
|
||||
const list=el('ul',undefined,'dashboard-list');for(const item of data.items.slice(0,12)){const row=el('li');row.append(el('span',item.read?'○':'●'),link(item.title||t('(Untitled)','(無題)'),'/v/feeds?'+new URLSearchParams({source:item.source,id:item.id})));list.append(row);}
|
||||
@@ -94,12 +96,13 @@
|
||||
const ring=el('div',percentage===null?'—':percentage+'%','dashboard-progress');ring.style.setProperty('--progress',(percentage||0)+'%');
|
||||
body.append(ring,el('p',data.done+' / '+data.total));return;
|
||||
}
|
||||
if(item.id==='schedule'){
|
||||
if(item.id==='schedule'||item.id==='tomorrow-schedule'){
|
||||
if(root.dataset.calendar!=='true'){body.replaceChildren(el('p',t('Calendar extension is disabled.','カレンダー拡張は無効です。')));return;}
|
||||
const data=await request(calendarAPI+'upcoming?period=day',{signal});if(controller.signal.aborted)return;
|
||||
const list=el('ul',undefined,'dashboard-list'),format=new Intl.DateTimeFormat(ja?'ja-JP':'en-GB',{hour:'2-digit',minute:'2-digit',timeZone:zone});
|
||||
for(const event of data.events){const row=el('li'),a=link(event.summary||t('(Untitled)','(無題)'),event.href);row.append(el('time',event.all_day?t('All day','終日'):format.format(new Date(event.start))),a);list.append(row);}
|
||||
body.replaceChildren(list);if(!data.events.length)body.append(el('p',t('No events today.','本日の予定はありません。')));body.append(link(t('Open calendar →','カレンダーで確認 →'),'/v/plan'));return;
|
||||
const date=new Date(today+'T12:00:00Z');if(item.id==='tomorrow-schedule')date.setUTCDate(date.getUTCDate()+1);const day=date.toISOString().slice(0,10);
|
||||
const data=await request(calendarAPI+'upcoming?period=day&date='+day,{signal});if(controller.signal.aborted)return;const dayURL='/v/plan/cal/'+day.replaceAll('-','/');card.querySelector('.widget-header a').href=dayURL;
|
||||
const list=el('ul',undefined,'dashboard-list dashboard-agenda'),format=new Intl.DateTimeFormat(ja?'ja-JP':'en-GB',{hour:'2-digit',minute:'2-digit',timeZone:zone});
|
||||
for(const event of data.events){const row=el('li'),a=link(event.summary||t('(Untitled)','(無題)'),event.href);const time=el('time',event.all_day?t('All day','終日'):format.format(new Date(event.start))+'–'+format.format(new Date(event.end)));time.dateTime=event.start;const detail=el('div',undefined,'agenda-event');detail.append(a,el('small',event.calendar));row.append(time,detail);row.dataset.allDay=String(!!event.all_day);if(Date.parse(event.start)<=Date.now()&&Date.parse(event.end)>Date.now())row.classList.add('is-current');list.append(row);}
|
||||
body.replaceChildren(list);if(!data.events.length)body.append(el('p',t('No events.','予定はありません。')));body.append(link(t('Open calendar →','カレンダーで確認 →'),dayURL));return;
|
||||
}
|
||||
const tabbar=el('div',undefined,'widget-tabs');tabbar.setAttribute('role','tablist');tabbar.ariaLabel=names.tasks;
|
||||
const list=el('div');list.id='widget-panel-'+item.id;list.setAttribute('role','tabpanel');list.tabIndex=0;
|
||||
@@ -117,9 +120,9 @@
|
||||
if(!append)list.replaceChildren();panel.querySelector('[data-more]')?.remove();
|
||||
const ul=el('ul',undefined,'dashboard-list');
|
||||
for(const task of data.items){const row=el('li');row.dataset.task=task.uuid;
|
||||
const title=link(task.title,'/v/plan/task/'+encodeURIComponent(task.uuid));title.title=task.title;
|
||||
const title=link(task.title,'/v/plan/task/'+encodeURIComponent(task.uuid));title.title=task.title;window.PagesTaskPresentation?.render(title,task.title,false);
|
||||
row.append(el('span',task.status==='done'?'✓':task.status==='cancelled'?'−':task.status==='doing'?'◐':'○'),title);
|
||||
if(task.due_on)row.append(el('time',task.due_on));ul.append(row);
|
||||
if(task.page_uuid){const note=link('▣','/o/uuid:'+encodeURIComponent(task.page_uuid));note.title=note.ariaLabel=t('Open linked Wiki page','関連Wikiページを開く');note.className='dashboard-note';row.append(note);}if(task.due_on)row.append(el('time',task.due_on));ul.append(row);
|
||||
}
|
||||
list.append(ul);if(!data.items.length&&!append)list.append(el('p',t('No matching tasks.','該当するタスクはありません。')));
|
||||
if(data.next){const more=button(t('Load more','続きを表示'),t('Load more','続きを表示'),()=>{more.disabled=true;tasks(tab,true,data.next).finally(()=>{more.disabled=false;});});more.dataset.more='true';panel.append(more);}
|
||||
|
||||
+20
-44
@@ -1,44 +1,20 @@
|
||||
console.log("revisions.js loaded")
|
||||
|
||||
async function restoreRevision(
|
||||
revisionUUID,
|
||||
) {
|
||||
|
||||
if (
|
||||
!confirm(
|
||||
"restore revision?"
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const res = await fetch(
|
||||
"/_/api/v1/revisions/restore",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type":
|
||||
"application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
revision_uuid:
|
||||
revisionUUID,
|
||||
}),
|
||||
},
|
||||
)
|
||||
|
||||
if (!res.ok) {
|
||||
|
||||
alert(
|
||||
"restore failed",
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
alert(
|
||||
"revision restored",
|
||||
)
|
||||
|
||||
location.reload()
|
||||
}
|
||||
(() => {
|
||||
'use strict';
|
||||
const ja=document.documentElement.lang.startsWith('ja'),t=(en,jp)=>ja?jp:en;
|
||||
for(const node of document.querySelectorAll('[data-revision-time]')){
|
||||
const date=new Date(Number(node.dataset.revisionTime)*1000);
|
||||
if(!Number.isNaN(date.valueOf())){node.dateTime=date.toISOString();node.textContent=date.toLocaleString(undefined,{year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',second:'2-digit',timeZoneName:'short'});node.title=date.toISOString();}
|
||||
}
|
||||
let busy=false;
|
||||
document.addEventListener('click',async event=>{
|
||||
const button=event.target.closest('[data-restore-revision]');if(!button||busy)return;
|
||||
const message=prompt(t('Restore as a new revision. Enter a change message:','新しいリビジョンとして復元します。更新メッセージを入力してください。'),t('Restore revision ','リビジョンを復元: ')+button.dataset.restoreRevision);
|
||||
if(message===null)return;
|
||||
busy=true;button.disabled=true;
|
||||
try{
|
||||
const response=await fetch('/_/api/v1/revisions/restore',{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json'},body:JSON.stringify({revision_uuid:button.dataset.restoreRevision,base_revision_uuid:button.dataset.baseRevision,message}),signal:AbortSignal.timeout(30000)});
|
||||
if(response.redirected||!response.ok)throw Error(response.status===412?t('Changed elsewhere. Reload history before restoring.','別の画面で更新されました。履歴を再読み込みしてから復元してください。'):t('Restore failed. Check your login and permissions.','復元できませんでした。ログイン状態と権限を確認してください。'));
|
||||
location.reload();
|
||||
}catch(error){alert(error.message);}finally{busy=false;button.disabled=false;}
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,92 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
window.PagesTaskIndex={mount({app,open,setProject}){
|
||||
const ja=document.documentElement.lang.startsWith('ja'),t=(en,jp)=>ja?jp:en;
|
||||
const el=(tag,text,cls)=>{const n=document.createElement(tag);if(text!==undefined)n.textContent=text;if(cls)n.className=cls;return n;};
|
||||
const $=id=>document.getElementById('tasks-'+id),api='/_/api/v1/extension/organizer.tasks/items',writable=app.dataset.writable==='true';
|
||||
const list=$('list'),status=$('status'),sidebar=$('nav');
|
||||
let items=[],selected='',project='',projects=[],next='',projectNext='',loading=false,mutating=false,generation=0,projectGeneration=0,controller,projectController;
|
||||
let applied='~active',sortKey='due',order='asc',validResult=false;
|
||||
const initial=new URLSearchParams(location.search);if(initial.has('filter'))applied=initial.get('filter');if(initial.has('project'))project=initial.get('project');
|
||||
const sorts={due:t('Due date','期限'),planned:t('Planned date','取り組む日'),title:t('Subject','件名'),status:t('Status','状態'),priority:t('Priority','優先度'),created:t('Created','作成日時'),updated:t('Updated','更新日時')};
|
||||
if(initial.has('sort')&&sorts[initial.get('sort')])sortKey=initial.get('sort');if(initial.get('order')==='desc')order='desc';
|
||||
const states={todo:t('To do','未着手'),doing:t('Doing','着手中'),done:t('Done','完了'),cancelled:t('Cancelled','取りやめ')};
|
||||
const marks={todo:'○',doing:'◐',done:'✓',cancelled:'−'};
|
||||
function button(label,text,fn){const b=el('button',text);b.type='button';b.title=b.ariaLabel=label;b.onclick=fn;return b;}
|
||||
async function request(url,options={}){
|
||||
const r=await fetch(url,{credentials:'same-origin',signal:AbortSignal.timeout(15000),...options,headers:{'Content-Type':'application/json',...options.headers}}),data=await r.json().catch(()=>({}));
|
||||
if(r.redirected||r.status===401)throw Error(t('Sign in again.','再度ログインしてください。'));
|
||||
if(!r.ok)throw Error(r.status===412?t('Changed elsewhere. Refresh before retrying.','別の画面で更新されました。再読込してから操作してください。'):r.status===422?t('Invalid filter or sort. See ? for syntax.','絞り込み式またはソートが不正です。? で書式を確認してください。'):t('Request failed. Check permissions and try again.','操作に失敗しました。権限を確認して再度お試しください。'));
|
||||
return data;
|
||||
}
|
||||
$('heading').textContent=t('Task index','タスク一覧');$('help').hidden=$('capture').hidden=true;$('search').closest('label').hidden=true;
|
||||
const filterForm=el('form',undefined,'task-index-filter'),filter=el('input'),sort=el('select'),reverse=button(t('Reverse sort (O)','逆ソート (O)'),'↑',()=>{order=order==='asc'?'desc':'asc';reload();});
|
||||
filter.name='filter';filter.value=applied;filter.maxLength=1000;filter.autocomplete='off';filter.ariaLabel=t('Limit tasks (l)','タスクを絞り込む (l)');filter.placeholder='~s "release" ~overdue';
|
||||
const apply=el('button',t('Apply','適用'));apply.type='submit';
|
||||
for(const[key,label]of Object.entries(sorts)){const o=el('option',label);o.value=key;sort.append(o);}sort.value=sortKey;sort.ariaLabel=t('Sort (o)','ソート (o)');sort.onchange=()=>{sortKey=sort.value;reload();};
|
||||
filterForm.append(filter,apply,sort,reverse);$('status').before(filterForm);
|
||||
filterForm.onsubmit=e=>{e.preventDefault();applied=filter.value;reload().then(()=>grid.focus());};
|
||||
const actions=el('div',undefined,'task-index-actions'),help=el('dialog',undefined,'task-index-help');
|
||||
help.ariaLabel=t('Task index shortcuts','タスク一覧のショートカット');
|
||||
const helpTitle=el('h2',help.ariaLabel),helpClose=button(t('Close','閉じる'),'×',()=>help.close()),helpTable=el('dl');
|
||||
for(const[key,label]of [['j / k / ↓ / ↑',t('Select next / previous task','次/前のタスクを選択')],['Ctrl+j / Ctrl+k',t('Next / previous project','次/前のプロジェクト')],['o / O',t('Choose sort / reverse order','ソート選択/順序反転')],['l / Esc',t('Focus filter / return to list','絞り込みへ/一覧へ戻る')],['d',t('Mark done (not delete)','完了にする(削除ではありません)')],['s',t('Start Pomodoro (25 minutes)','Pomodoro開始(25分)')],['c',t('Create in current project','現在のプロジェクトに新規作成')],['m / Enter',t('Edit selected task','選択タスクを編集')],['w',t('Open linked Wiki page','関連Wikiページを開く')],['?',t('Show this help','このヘルプを表示')]]){helpTable.append(el('dt',key),el('dd',label));}
|
||||
help.append(helpClose,helpTitle,helpTable,el('h3',t('Filters (AND; ! negates)','絞り込み(AND結合、! で否定)')),el('pre','~s "release notes"\n~active / ~todo / ~doing / ~done / ~cancelled\n~overdue / ~archived / ~wiki / ~attachment\n~due <=today / ~planned tomorrow / ~start >=2026-01-01\n~review <today / ~due none\n~bucket inbox / ~bucket backlog / ~bucket someday\n~priority 3 / !~done\n\n~s "release" ~doing !~overdue'));
|
||||
app.append(help);const showHelp=()=>help.showModal();help.addEventListener('close',()=>grid.focus());
|
||||
const done=button(t('Done (d)','完了 (d)'),'✓',()=>act('done')),focus=button(t('Pomodoro (s)','Pomodoro (s)'),'◷',()=>act('focus')),edit=button(t('Edit (m)','編集 (m)'),'✎',()=>act('edit')),wiki=button(t('Wiki (w)','Wiki (w)'),'▣',()=>act('wiki'));
|
||||
actions.append(done,focus,edit,wiki,button(t('Shortcuts (?)','ショートカット (?)'),'? ',showHelp));filterForm.after(actions);
|
||||
const grid=el('table',undefined,'task-index-grid'),head=el('thead'),header=el('tr'),body=el('tbody');grid.tabIndex=0;grid.setAttribute('role','grid');grid.ariaLabel=t('Tasks','タスク');
|
||||
for(const text of [t('Status','状態'),t('Subject','件名'),t('Due','期限'),t('Planned','取り組む日'),t('Priority','優先度'),'▣']){const th=el('th',text);th.scope='col';if(text==='▣')th.ariaLabel=t('Linked Wiki','関連Wiki');header.append(th);}head.append(header);grid.append(head,body);list.replaceChildren(grid);list.removeAttribute('role');
|
||||
$('dialog').addEventListener('close',()=>grid.focus());
|
||||
const projectTitle=el('h2',t('Projects','プロジェクト')),projectSearch=el('input'),projectList=el('div',undefined,'task-index-projects'),projectMore=button(t('More projects','続きのプロジェクト'),'…',()=>loadProjects(true));
|
||||
projectSearch.type='search';projectSearch.ariaLabel=projectSearch.placeholder=t('Find project','プロジェクト検索');
|
||||
sidebar.replaceChildren(projectTitle,projectSearch,projectList,projectMore);const inline=el('a',t('Inline editing ↗','インライン編集 ↗'));inline.href='/v/plan/tasks';sidebar.append(inline);
|
||||
let projectTimer;projectSearch.oninput=()=>{clearTimeout(projectTimer);projectTimer=setTimeout(()=>loadProjects(),200);};
|
||||
function projectChoices(){return [{uuid:'',title:t('All projects','すべて')},{uuid:'none',title:t('No project','プロジェクトなし')},...projects];}
|
||||
function paintProjects(){projectList.replaceChildren();for(const p of projectChoices()){const b=button(p.title,p.title,()=>chooseProject(p.uuid));window.PagesTaskPresentation.render(b,p.title,false);b.dataset.project=p.uuid;b.setAttribute('aria-current',p.uuid===project?'true':'false');projectList.append(b);}projectMore.hidden=!projectNext;}
|
||||
async function loadProjects(append=false){const ticket=++projectGeneration;projectController?.abort();projectController=new AbortController();projectMore.disabled=true;
|
||||
try{const q=new URLSearchParams({kind:'project',view:'all',q:projectSearch.value,limit:'50'});if(append&&projectNext)q.set('before',projectNext);const data=await request(api+'?'+q,{signal:AbortSignal.any([projectController.signal,AbortSignal.timeout(15000)])});if(ticket!==projectGeneration)return;if(!append)projects=[];for(const p of data.items)if(!projects.some(x=>x.uuid===p.uuid))projects.push(p);projectNext=data.next;paintProjects();}
|
||||
catch(e){if(e.name!=='AbortError')status.textContent=e.message;}finally{if(ticket===projectGeneration)projectMore.disabled=false;}
|
||||
}
|
||||
function chooseProject(id){project=id;setProject(project);selected='';paintProjects();reload();}
|
||||
async function moveProject(delta){let choices=projectChoices(),index=choices.findIndex(x=>x.uuid===project);if(index<0)index=0;if(delta>0&&index===choices.length-1&&projectNext&&!projectMore.disabled){await loadProjects(true);choices=projectChoices();}const p=choices[Math.max(0,Math.min(choices.length-1,index+delta))];if(p)chooseProject(p.uuid);}
|
||||
function syncURL(){const q=new URLSearchParams();if(project)q.set('project',project);if(applied!=='~active')q.set('filter',applied);if(sortKey!=='due')q.set('sort',sortKey);if(order!=='asc')q.set('order',order);history.replaceState(history.state,'',location.pathname+(q.size?'?'+q:''));}
|
||||
function paint(){body.replaceChildren();for(const item of items){const row=el('tr');row.id='task-index-'+item.uuid;row.dataset.task=item.uuid;row.setAttribute('aria-selected',String(item.uuid===selected));row.onclick=()=>select(item.uuid);row.ondblclick=()=>act('edit');
|
||||
const state=el('td',marks[item.status]+' '+states[item.status]),subject=el('td',undefined,'task-index-subject'),due=el('td',item.due_on||'—'),planned=el('td',item.planned_on||'—'),priority=el('td',['↓','·','!','!!'][item.priority]||'·'),note=el('td',item.page_uuid?'▣':'');
|
||||
window.PagesTaskPresentation.render(subject,item.title,false);subject.title=item.title;if(item.parent_uuid)subject.prepend(el('span','↳ '));state.title=states[item.status];note.title=item.page_uuid?t('Linked Wiki page (w)','関連Wikiページ (w)'):'';
|
||||
if(item.due_on&&item.due_on<app.dataset.today&&!['done','cancelled'].includes(item.status))due.className='task-index-overdue';row.append(state,subject,due,planned,priority,note);body.append(row);
|
||||
}selection();}
|
||||
function selection(scroll=false){for(const row of body.children)row.setAttribute('aria-selected',String(row.dataset.task===selected));if(selected){grid.setAttribute('aria-activedescendant','task-index-'+selected);if(scroll)document.getElementById('task-index-'+selected)?.scrollIntoView({block:'nearest'});}else grid.removeAttribute('aria-activedescendant');const item=items.find(x=>x.uuid===selected);done.disabled=focus.disabled=!writable||!item||loading||mutating||!validResult||item.archived;done.disabled||=item?.status==='done';focus.disabled||=['done','cancelled'].includes(item?.status);edit.disabled=wiki.disabled=!selected||loading||mutating||!validResult;}
|
||||
function select(id){selected=id;selection(true);grid.focus({preventScroll:true});}
|
||||
async function move(delta){if(loading)return;let i=items.findIndex(x=>x.uuid===selected);if(delta>0&&i===items.length-1&&next){const keep=i;await reload(true);if(items[keep+1])select(items[keep+1].uuid);return;}i=Math.max(0,Math.min(items.length-1,i+delta));if(items[i])select(items[i].uuid);}
|
||||
async function reload(append=false){
|
||||
const ticket=++generation;controller?.abort();controller=new AbortController();loading=true;validResult=false;selection();$('more').disabled=true;status.textContent=t('Loading…','読み込み中…');grid.setAttribute('aria-busy','true');const oldIndex=Math.max(0,items.findIndex(x=>x.uuid===selected));
|
||||
try{const q=new URLSearchParams({kind:'task',view:'index',filter:applied,sort:sortKey,order,project,limit:'100'});if(append&&next)q.set('before',next);const data=await request(api+'?'+q,{signal:AbortSignal.any([controller.signal,AbortSignal.timeout(15000)])});if(ticket!==generation)return;
|
||||
if(!append)items=[];for(const item of data.items)if(!items.some(x=>x.uuid===item.uuid))items.push(item);next=data.next;app.dataset.today=data.today;validResult=true;
|
||||
if(!items.some(x=>x.uuid===selected))selected=items[Math.min(oldIndex,items.length-1)]?.uuid||'';paint();reverse.textContent=order==='asc'?'↑':'↓';sort.value=sortKey;syncURL();status.textContent=items.length?`${items.length}${next?'+':''}`:t('No matching tasks.','該当するタスクはありません。');$('more').hidden=!next;
|
||||
}catch(e){if(e.name!=='AbortError'&&ticket===generation)status.textContent=e.message;}finally{if(ticket===generation){loading=false;selection();$('more').disabled=!validResult;grid.removeAttribute('aria-busy');}}
|
||||
}
|
||||
async function act(action){const item=items.find(x=>x.uuid===selected);if(!item||loading||mutating||!validResult)return;
|
||||
if(action==='edit'){open(item.uuid);return;}
|
||||
if(action==='focus'){if(writable&&!item.archived&&!['done','cancelled'].includes(item.status))app.dispatchEvent(new CustomEvent('task-focus',{detail:item}));return;}
|
||||
if(action==='wiki'&&!item.page_uuid){status.textContent=t('No linked Wiki page. Use task details to link one.','関連Wikiページはありません。タスク詳細から関連付けてください。');return;}
|
||||
if(action==='done'&&(!writable||item.archived||item.status==='done'))return;
|
||||
mutating=true;selection();try{
|
||||
if(action==='wiki'){const note=await request(api+'/'+item.uuid+'/note');if(note.linked)location.assign(note.url);else status.textContent=t('No linked Wiki page. Use task details to link or create one.','関連Wikiページはありません。タスク詳細から関連付けてください。');}
|
||||
else{const fresh=await request(api+'/'+item.uuid);await request(api+'/'+item.uuid,{method:'PUT',headers:{'If-Match':'"'+item.version+'"'},body:JSON.stringify({...fresh.item,status:'done'})});app.dispatchEvent(new Event('task-today-refresh'));await reload();}
|
||||
}catch(e){status.textContent=e.message;}finally{mutating=false;selection();}
|
||||
}
|
||||
document.addEventListener('keydown',e=>{
|
||||
if(e.defaultPrevented||e.isComposing||e.keyCode===229||e.altKey||e.metaKey||document.querySelector('dialog[open]'))return;
|
||||
if(e.key==='Escape'&&(filterForm.contains(e.target)||e.target===projectSearch)){e.preventDefault();filter.value=applied;grid.focus();return;}
|
||||
if(e.target.closest?.('input,textarea,select,[contenteditable=true]'))return;
|
||||
if(e.ctrlKey){if(e.key==='j'||e.key==='k'){e.preventDefault();moveProject(e.key==='j'?1:-1);}return;}
|
||||
if(['j','k','ArrowDown','ArrowUp'].includes(e.key)){e.preventDefault();move(['j','ArrowDown'].includes(e.key)?1:-1);return;}
|
||||
if(e.repeat)return;
|
||||
if(e.key==='Enter'&&e.target!==grid&&e.target!==document.body)return;
|
||||
const commands={o:()=>sort.focus(),O:()=>reverse.click(),l:()=>{filter.focus();filter.select();},d:()=>act('done'),s:()=>act('focus'),c:()=>{if(writable&&!mutating)open('');},m:()=>act('edit'),Enter:()=>{if(e.target===grid||e.target===document.body)act('edit');},w:()=>act('wiki'),'?':showHelp};
|
||||
if(commands[e.key]){e.preventDefault();commands[e.key]();}
|
||||
});
|
||||
setProject(project);paintProjects();loadProjects();reload();grid.focus();
|
||||
return {reload};
|
||||
}};
|
||||
})();
|
||||
@@ -19,7 +19,7 @@
|
||||
function field(key,type,container){const label=el('label'),n=el(type==='select'?'select':'input');label.append(el('span',labels[key]));if(type!=='select')n.type=type;else ['todo','doing','done','cancelled'].forEach((v,i)=>{const o=el('option',[t('To do','未着手'),t('Doing','進行中'),t('Done','完了'),t('Cancelled','取りやめ')][i]);o.value=v;n.append(o);});n.name=key;n.value=item[key]||'';n.disabled=!writable;n.ariaLabel=labels[key];if(key==='title'){n.required=true;n.maxLength=300;label.className='task-inline-title';}inputs[key]=n;label.append(n);container.append(label);
|
||||
n.addEventListener('input',()=>{draft[key]=n.value;dirtyRows.add(row);});n.addEventListener('change',()=>{draft[key]=n.value;dirtyRows.add(row);flush();});
|
||||
n.addEventListener('keydown',e=>{if(e.key==='Enter'){e.preventDefault();n.blur();}if(e.key==='Escape'){e.preventDefault();n.value=item[key]||'';draft[key]=n.value;flush();}});}
|
||||
field('title','text',line);field('status','select',line);['planned_on','due_on','review_on','start_on','end_on'].forEach(k=>field(k,'date',dates));
|
||||
field('title','text',line);const titlePreview=el('div',undefined,'task-title-preview');titlePreview.setAttribute('aria-hidden','true');inputs.title.after(titlePreview);inputs.title.addEventListener('input',()=>window.PagesTaskPresentation?.render(titlePreview,inputs.title.value,false));field('status','select',line);['planned_on','due_on','review_on','start_on','end_on'].forEach(k=>field(k,'date',dates));
|
||||
const complete=el('button','○');complete.type='button';complete.title=complete.ariaLabel=t('Toggle completion','完了を切り替え');complete.disabled=!writable;complete.dataset.action='complete';complete.addEventListener('click',()=>{draft.status=item.status==='done'?'todo':'done';inputs.status.value=draft.status;dirtyRows.add(row);flush();});line.prepend(complete);
|
||||
const parent=el('a','↳');parent.title=parent.ariaLabel=t('Parent task','親タスク');parent.hidden=!item.parent_uuid;if(item.parent_uuid){row.classList.add('task-is-child');parent.href='/v/plan/task/'+encodeURIComponent(item.parent_uuid);}row.append(parent,line,dates,actions,status);
|
||||
function button(label,icon,fn){const b=el('button',icon);b.type='button';b.title=b.ariaLabel=label;b.addEventListener('click',fn);actions.append(b);return b;}
|
||||
@@ -60,11 +60,11 @@
|
||||
}
|
||||
if(edit&&!data.writable){message(t('This Wiki note is read-only.','このWikiメモは読み取り専用です。'));return;}location.assign(edit?data.edit_url:data.url);
|
||||
}catch(e){message(e.message);}}
|
||||
button(t('View Wiki note (create if missing)','Wikiメモを表示(未作成なら新規作成)'),'▤',()=>openNote(false)).dataset.action='note-view';
|
||||
const noteView=button(t('View Wiki note (create if missing)','Wikiメモを表示(未作成なら新規作成)'),'▤',()=>openNote(false));noteView.dataset.action='note-view';
|
||||
const editNote=button(t('Edit / create Wiki note','Wikiメモを編集・新規作成'),'✎',()=>openNote(true));editNote.dataset.action='note-edit';editNote.disabled=!writable;
|
||||
if(options.planDate&&writable){button(t('Schedule for ','取り組む日を変更:')+options.planDate,'→',()=>{if(blocked())return;draft.planned_on=options.planDate;inputs.planned_on.value=draft.planned_on;dirtyRows.add(row);flush();}).dataset.action='schedule-day';}
|
||||
const estimate=el('small',undefined,'task-inline-estimate');actions.prepend(estimate);
|
||||
function paint(){row.dataset.done=String(['done','cancelled'].includes(item.status));complete.textContent=item.status==='done'?'✓':'○';row.dataset.archived=String(item.archived);estimate.textContent=item.estimate_minutes?item.estimate_minutes+' min':'';}
|
||||
function paint(){window.PagesTaskPresentation?.render(titlePreview,item.title,false);noteView.classList.toggle('has-wiki-note',!!item.page_uuid);noteView.textContent=item.page_uuid?'▣':'▤';noteView.title=noteView.ariaLabel=item.page_uuid?t('Open linked Wiki page','関連Wikiページを開く'):t('Create Wiki note','Wikiメモを作成');row.dataset.done=String(['done','cancelled'].includes(item.status));complete.textContent=item.status==='done'?'✓':'○';row.dataset.archived=String(item.archived);estimate.textContent=item.estimate_minutes?item.estimate_minutes+' min':'';}
|
||||
async function flush(){if(saving||!writable||!Object.keys(draft).length)return;if(!inputs.title.reportValidity())return;saving=true;row.setAttribute('aria-busy','true');message(t('Saving…','保存中…'),'saving');try{while(Object.keys(draft).length){const patch={...draft};const fresh=await request(api+'/'+item.uuid);const saved=await request(api+'/'+item.uuid,{method:'PUT',headers:{'If-Match':'"'+item.version+'"'},body:JSON.stringify({...fresh.item,...patch})});item=saved.item;for(const [k,v]of Object.entries(patch)){if(draft[k]===v)delete draft[k];}paint();}dirtyRows.delete(row);message(t('Saved','保存しました'),'saved');document.getElementById('tasks-app')?.dispatchEvent(new Event('task-today-refresh'));options.onChanged?.(item,row);}catch(e){message(e.message);}finally{saving=false;row.removeAttribute('aria-busy');}}
|
||||
const restoreExpanded=expandedRows.has(item.uuid);
|
||||
if(options.initialChildren?.length){options.initialChildren.forEach(c=>children.append(create(c,{...options,initialChildren:[],context:false,nested:true})));showChildren(true);}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
(() => {
|
||||
'use strict';
|
||||
// Small inline-only dialect: no HTML, images, macros or remote rendering.
|
||||
function render(node, source, links = true, depth = 0) {
|
||||
node.replaceChildren();
|
||||
if (depth > 8) { node.textContent=source; return; }
|
||||
const pattern=/\\([\\`*_\[\]~])|(`+)([^`]+)\2|\*\*(.+?)\*\*|__(.+?)__|~~(.+?)~~|\*([^*]+)\*|_([^_]+)_|\[([^\]]+)\]\(([^\s)]+)\)/g;
|
||||
let offset=0;
|
||||
for(const m of source.matchAll(pattern)) {
|
||||
node.append(document.createTextNode(source.slice(offset,m.index)));
|
||||
if(m[1]){node.append(document.createTextNode(m[1]));offset=m.index+m[0].length;continue;}
|
||||
let tag,text;
|
||||
if(m[2]) {tag='code';text=m[3];} else if(m[4]||m[5]) {tag='strong';text=m[4]||m[5];}
|
||||
else if(m[6]) {tag='del';text=m[6];} else if(m[7]||m[8]) {tag='em';text=m[7]||m[8];}
|
||||
else {tag='span';text=m[9];if(links&&safeReference(m[10]))tag='a';}
|
||||
const child=document.createElement(tag);
|
||||
if(tag==='a') {child.href=m[10];child.rel='noopener noreferrer';}
|
||||
if(tag==='code')child.textContent=text;else render(child,text,false,depth+1);
|
||||
node.append(child);offset=m.index+m[0].length;
|
||||
}
|
||||
node.append(document.createTextNode(source.slice(offset)));
|
||||
}
|
||||
function safeReference(ref) {
|
||||
if(!ref||/[\\\s\x00-\x1f]/.test(ref))return false;
|
||||
if(ref.startsWith('/')&&!ref.startsWith('//'))return true;
|
||||
try {const u=new URL(ref);return ['http:','https:'].includes(u.protocol)&&!u.username&&!u.password;}catch{return false;}
|
||||
}
|
||||
window.PagesTaskPresentation={render,safeReference};
|
||||
})();
|
||||
+10
-5
@@ -3,6 +3,7 @@
|
||||
const app = document.getElementById('tasks-app'); if (!app) return;
|
||||
const ja = document.documentElement.lang.startsWith('ja');
|
||||
const words = {
|
||||
index:['Keyboard task index','キーボード一覧'],
|
||||
delete:['Delete','削除'],deleted:['This task has been deleted.','このタスクは削除されています。'],has_children:['Move or delete the subtasks first, including archived subtasks.','先にサブタスクを移動または削除してください(アーカイブ済みも含みます)。'],working:['Stop the running work timer or focus session before deleting this task.','作業時間の記録・集中セッションを停止してから削除してください。'],deleteConfirm:['Delete this task? This cannot be undone. Wiki notes, calendar events and recorded work time will remain. Unsaved changes will be discarded.','このタスクを削除しますか?復元できません。Wikiメモ、カレンダーの予定、記録済みの作業時間は残ります。未保存の変更は破棄されます。'],
|
||||
carryover:['Carryover','持ち越し'],tomorrow:['Tomorrow','明日'],day:['Daily plan','日別の計画'],notes_subpath:['Wiki note subfolder (relative to the project Wiki page)','Wikiメモのサブ階層(プロジェクトの関連Wiki配下)'],
|
||||
start_on:['Work starts','工程開始'],end_on:['Work ends','工程終了'],schedule:['Day schedule','日割り工程表'],
|
||||
@@ -17,6 +18,7 @@
|
||||
const view = app.dataset.view, projectID = view === 'project' ? app.dataset.id : '';
|
||||
const writable = app.dataset.writable === 'true';
|
||||
let today = app.dataset.today;
|
||||
let indexBrowser, indexProject=null;
|
||||
let selectedDate=app.dataset.selectedDate||today;
|
||||
const loadedItems=new Map(),contextParents=new Map();
|
||||
const nextDay=date=>{const d=new Date(date+'T12:00:00Z');d.setUTCDate(d.getUTCDate()+1);return d.toISOString().slice(0,10);};
|
||||
@@ -32,7 +34,7 @@
|
||||
}
|
||||
const href = item => '/v/plan/' + item.kind + '/' + encodeURIComponent(item.uuid);
|
||||
const routes = {today:'/v/plan/today',all:'/v/plan/tasks',projects:'/v/plan/projects'};
|
||||
const icons = {carryover:'↶',today:'☀',tomorrow:'⇢',inbox:'↓',backlog:'≡',someday:'◇',review:'↻',all:'☷',projects:'▱',done:'✓',archived:'▣'};
|
||||
const icons = {index:'⌨',carryover:'↶',today:'☀',tomorrow:'⇢',inbox:'↓',backlog:'≡',someday:'◇',review:'↻',all:'☷',projects:'▱',done:'✓',archived:'▣'};
|
||||
Object.keys(icons).forEach(key => { const a = el('a'); a.href = routes[key] || '/v/plan/tasks/' + key; a.append(el('span',icons[key]),el('span',t(key))); if(view===key||(key==='tomorrow'&&view==='day'&&selectedDate===nextDay(today)))a.setAttribute('aria-current','page'); $('nav').append(a); });
|
||||
const schedule=el('a','▦ '+t('schedule'));schedule.href='/v/plan/tasks/schedule'+(projectID?'?project='+projectID:'');$('nav').append(schedule);const workHistory=el('a',ja?'◷ 作業記録':'◷ Work history');workHistory.href='/v/plan/tasks/work';$('nav').append(workHistory);
|
||||
$('date').textContent = view==='day'?selectedDate:today; $('heading').textContent = t(view === 'project' ? 'project' : view === 'detail' || view === 'new' ? 'all' : view);
|
||||
@@ -56,9 +58,10 @@
|
||||
if(!writable)$('help').textContent+=' '+t('readonly');
|
||||
let taskDefaults={},reminderDefaults={};
|
||||
async function refreshDefaults(){const data=await request('/_/api/v1/extension/organizer.tasks/preferences');taskDefaults=data.defaults;reminderDefaults=data.preferences;}
|
||||
function blank(kind='task') { const defaults=kind==='task'?taskDefaults:{};const item={ ...defaults,uuid:crypto.randomUUID(),kind,title:'',notes:'',status:'todo',bucket:['inbox','backlog','someday'].includes(view)?view:'inbox',priority:1,estimate_minutes:defaults.estimate_minutes||0,project_uuid:kind==='task'?(projectID||defaults.project_uuid||''):'',page_uuid:'',due_on:defaults.due_on||'',planned_on:['today','day'].includes(view)&&kind==='task'?(view==='day'?selectedDate:today):(defaults.planned_on||''),review_on:defaults.review_on||'',archived:false,version:0 };if(kind==='task'){item.notify_due=!!(reminderDefaults.notify_due&&item.due_on);item.notify_planned=!!(reminderDefaults.notify_planned&&item.planned_on);}return item; }
|
||||
function blank(kind='task') { const defaults=kind==='task'?taskDefaults:{};const item={ ...defaults,uuid:crypto.randomUUID(),kind,title:'',notes:'',status:'todo',bucket:['inbox','backlog','someday'].includes(view)?view:'inbox',priority:1,estimate_minutes:defaults.estimate_minutes||0,project_uuid:kind==='task'?(view==='index'&&indexProject!==null?indexProject:(projectID||defaults.project_uuid||'')):'',page_uuid:'',due_on:defaults.due_on||'',planned_on:['today','day'].includes(view)&&kind==='task'?(view==='day'?selectedDate:today):(defaults.planned_on||''),review_on:defaults.review_on||'',archived:false,version:0 };if(kind==='task'){item.notify_due=!!(reminderDefaults.notify_due&&item.due_on);item.notify_planned=!!(reminderDefaults.notify_planned&&item.planned_on);}return item; }
|
||||
function listView(){return ['project','detail','new'].includes(view)?'all':view;}
|
||||
async function load(append=false) {
|
||||
if(indexBrowser)return indexBrowser.reload(append);
|
||||
if(window.PagesWikiTaskRows?.hasDirty()){$('status').textContent=ja?'編集中の行を保存または再読込してください。':'Save or reload edited rows first.';return;}
|
||||
const ticket=++generation; listController?.abort();listController=new AbortController();$('status').textContent=t('loading');$('more').disabled=true;
|
||||
const q=new URLSearchParams({kind:view==='projects'?'project':view==='archived'?$('kind').value:'task',view:listView(),q:$('search').value,project:projectID,hierarchy:'1'});if(view==='day')q.set('date',selectedDate);if(append&&next)q.set('before',next);
|
||||
@@ -86,7 +89,7 @@
|
||||
if(item.kind==='task'&&window.PagesWikiTaskRows){$('list').append(window.PagesWikiTaskRows.create(item,rowOptions()));return;}
|
||||
const row=el('div',undefined,'task-row');row.role='listitem';row.dataset.done=String(item.status==='done'||item.status==='cancelled');
|
||||
if(item.kind==='task'&&writable){const b=el('button',item.status==='done'?'✓':'○');b.type='button';b.title=b.ariaLabel=t(item.status==='done'?'reopen':'complete');b.addEventListener('click',async()=>{b.disabled=true;try{const {item:fresh}=await request(api+'/'+item.uuid);fresh.status=fresh.status==='done'?'todo':'done';await saveItem(fresh);await load();}catch(e){$('status').textContent=e.message;}finally{b.disabled=false;}});row.append(b);}
|
||||
const main=el('div',undefined,'task-row-main'), a=el('a',item.title);a.href=href(item);if(item.kind==='task')a.addEventListener('click',e=>{if(e.button||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;e.preventDefault();open(item.uuid);});main.append(a);
|
||||
const main=el('div',undefined,'task-row-main'), a=el('a',item.title);window.PagesTaskPresentation?.render(a,item.title,false);a.href=href(item);if(item.kind==='task')a.addEventListener('click',e=>{if(e.button||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;e.preventDefault();open(item.uuid);});main.append(a);
|
||||
const meta=el('div',undefined,'task-row-meta');meta.append(el('span',t(item.status)));if(item.kind==='task'){if(item.due_on)meta.append(el('span',t('due_on')+' '+item.due_on,item.due_on<today?'task-overdue':''));if(item.planned_on)meta.append(el('span',t('planned_on')+' '+item.planned_on));if(item.priority>=2)meta.append(el('span',t(item.priority===3?'urgent':'high')));if(item.estimate_minutes)meta.append(el('span',item.estimate_minutes+' min'));}main.append(meta);row.append(main);$('list').append(row);
|
||||
}
|
||||
const fields={};
|
||||
@@ -147,6 +150,8 @@
|
||||
if(!id)for(const [date,key] of [['due_on','notify_due'],['planned_on','notify_planned']]){let touched=false;fields[key].addEventListener('change',()=>{touched=true;});fields[date].addEventListener('input',()=>{if(!touched){fields[key].checked=!!(fields[date].value&&reminderDefaults[key]);requirements();}});}
|
||||
}
|
||||
if(editing.kind==='project'){const folder=field('notes_subpath',t('notes_subpath'),'text',editing.notes_subpath||'tasks',true);folder.maxLength=500;folder.placeholder='tasks';$('fields').append(el('small',ja?'例:関連Wikiが /projects/app、サブ階層が tasks → /projects/app/tasks/件名。Wikiの公開範囲に従います。':'Example: project Wiki /projects/app + subfolder tasks → /projects/app/tasks/title. Wiki permissions apply.','task-full'));}
|
||||
const refs=field('references',ja?'URL / 添付Path(1行に1件)':'URLs / attachment Paths (one per line)','textarea',(editing.references||[]).join('\n'),true);refs.maxLength=81920;
|
||||
const referenceLinks=el('div',undefined,'task-full');for(const ref of editing.references||[]){if(!window.PagesTaskPresentation.safeReference(ref))continue;const a=el('a',ref);a.href=ref;a.target='_blank';a.rel='noopener noreferrer';referenceLinks.append(a,el('br'));}$('fields').append(referenceLinks);
|
||||
field('page_path',t('page'),'text',data.page_path,true).placeholder='/lab/project';
|
||||
const updatePageLink=()=>{const a=$('page-open');a.hidden=!data.page_path||!editing.page_uuid||fields.page_path.value!==data.page_path;a.removeAttribute('href');if(!a.hidden)a.href='/'+data.page_path.replace(/^\/+/, '').split('/').map(encodeURIComponent).join('/');};
|
||||
$('page-open').textContent=t('linked')+' ↗';$('page-open').title=ja?'関連ページを新しいタブで開く':'Open related page in a new tab';updatePageLink();
|
||||
@@ -168,7 +173,7 @@
|
||||
$('close').addEventListener('click',()=>closeDialog());$('dialog').addEventListener('cancel',e=>{e.preventDefault();closeDialog();});
|
||||
$('form').addEventListener('input',()=>{dirty=true;});
|
||||
$('form').addEventListener('invalid',event=>{const details=event.target.closest('details');if(details)details.open=true;},true);
|
||||
function readForm(){const item={...editing};['title','notes','notes_subpath','status','bucket','project_uuid','assignee_uuid','due_on','planned_on','review_on','start_on','end_on','reminder_time'].forEach(k=>{if(fields[k])item[k]=fields[k].value;});['notify_due','notify_planned'].forEach(k=>{if(fields[k])item[k]=fields[k].checked;});['priority','estimate_minutes','complexity'].forEach(k=>{if(fields[k])item[k]=Number(fields[k].value);});if(fields.page_path?.dataset.changed||(!item.page_uuid&&fields.page_path?.value))item.page_path=fields.page_path.value;return item;}
|
||||
function readForm(){const item={...editing};if(fields.references)item.references=fields.references.value.split('\n').map(x=>x.trim()).filter(Boolean);['title','notes','notes_subpath','status','bucket','project_uuid','assignee_uuid','due_on','planned_on','review_on','start_on','end_on','reminder_time'].forEach(k=>{if(fields[k])item[k]=fields[k].value;});['notify_due','notify_planned'].forEach(k=>{if(fields[k])item[k]=fields[k].checked;});['priority','estimate_minutes','complexity'].forEach(k=>{if(fields[k])item[k]=Number(fields[k].value);});if(fields.page_path?.dataset.changed||(!item.page_uuid&&fields.page_path?.value))item.page_path=fields.page_path.value;return item;}
|
||||
async function saveItem(item){const data=await request(api+(item.version?'/'+item.uuid:''),{method:item.version?'PUT':'POST',headers:item.version?{'If-Match':'"'+item.version+'"'}:{},body:JSON.stringify(item)});app.dispatchEvent(new Event('task-today-refresh'));return data;}
|
||||
async function submit(archive=false){if(!editing||saving||!writable)return;if(!$('form').reportValidity())return;const item=readForm();if(archive)item.archived=!item.archived;saving=true;Object.values(fields).forEach(f=>f.disabled=true);$('save').disabled=$('archive').disabled=$('delete').disabled=true;$('error').textContent='';try{await saveItem(item);saving=false;closeDialog(true);await load();if(projectID)await loadProject();}catch(e){$('error').textContent=e.message;}finally{saving=false;Object.values(fields).forEach(f=>f.disabled=!writable);$('save').disabled=$('archive').disabled=$('delete').disabled=false;}}
|
||||
$('delete').addEventListener('click',async()=>{
|
||||
@@ -194,5 +199,5 @@
|
||||
$('project-edit').addEventListener('click',()=>open(projectID));
|
||||
window.addEventListener('beforeunload',e=>{if(dirty){e.preventDefault();e.returnValue='';}});
|
||||
document.addEventListener('visibilitychange',()=>{if(!document.hidden&&!$('dialog').open&&!capturing)load();});
|
||||
load();if(projectID)loadProject();if(view==='detail')open(app.dataset.id);if(view==='new')open('');
|
||||
if(view==='index')indexBrowser=window.PagesTaskIndex.mount({app,open,setProject:id=>{indexProject=id==='none'?'':id||null;}});else load();if(projectID)loadProject();if(view==='detail')open(app.dataset.id);if(view==='new')open('');
|
||||
})();
|
||||
@@ -102,6 +102,7 @@
|
||||
<option value="blog" {{ if eq .HomeLayout "blog" }}selected{{ end }}>{{ T "periodical.blog" }}</option>
|
||||
</select></label>
|
||||
<label>{{ T "config.home_path" }}<input name="home_path" value="{{ .HomePath }}" placeholder="/home"></label>
|
||||
<h3 class="wide">{{ T "home.domain_appearance_defaults" }} · <a href="/-/sys/config?panel=organizer#appearance">{{ T "organizer.settings" }} ↗</a></h3>
|
||||
<label class="wide">{{ T "home.wallpaper_path" }}<span class="config-path-control"><input id="home-wallpaper-path" name="home_wallpaper_path" value="{{ .HomeWallpaperPath }}" placeholder="/wallpapers"><button type="button" data-path-picker data-picker-target="home-wallpaper-path" data-picker-mode="image-or-folder" aria-label="{{ T "picker.open" }}" title="{{ T "picker.open" }}">⌕</button></span></label>
|
||||
<label class="wide">{{ T "home.wallpaper_opacity" }}<span class="config-range-control"><input name="home_wallpaper_opacity" type="range" min="0" max="100" step="1" value="{{ .HomeWallpaperOpacity }}" data-range-output="home-wallpaper-opacity-output"><output id="home-wallpaper-opacity-output">{{ .HomeWallpaperOpacity }}%</output></span></label>
|
||||
<p class="muted wide">{{ T "home.wallpaper_help" }}</p>
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
|
||||
<div class="editor-head-left">
|
||||
|
||||
<label class="editor-change-message"><span>{{ T "history.message" }}</span><input id="revision-message" type="text" maxlength="1000" placeholder="{{ T "history.message_optional" }}"></label>
|
||||
<button type="button" class="editor-action-icon" data-editor-action="tools" title="{{ T "editor.tools" }}" aria-label="{{ T "editor.tools" }}">+</button>
|
||||
<button type="button" class="editor-action-icon" data-editor-action="language" title="{{ T "editor.language" }}" aria-label="{{ T "editor.language" }}">文</button>
|
||||
<button type="button" class="editor-action-icon" data-editor-action="restore" title="{{ T "editor.restore" }}" aria-label="{{ T "editor.restore" }}">↶</button>
|
||||
@@ -277,7 +278,7 @@ Ln 1, Col 1
|
||||
|
||||
<script src="/static/js/editor-core.js?v=priority-ux-1"></script>
|
||||
{{ if .CSVEditor }}<script>window.PagesCSVSource = {{ .Body }};</script><script src="/static/js/csv-core.js?v=2"></script><script src="/static/js/csv-editor.js?v=2"></script>{{ end }}
|
||||
<script src="/static/js/editor.js?v=slides-1"></script>
|
||||
<script src="/static/js/editor.js?v=revision-message-1"></script>
|
||||
<script src="/static/js/path-actions.js"></script>
|
||||
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
<main id="feeds-app" data-timezone="{{ .FeedTimezone }}" data-writable="{{ .FeedWritable }}" data-tasks="{{ .TasksEnabled }}" data-wiki-prefix="{{ .FeedWikiPrefix }}" data-share-x="{{ .FeedShareX }}" data-link-mode="{{ .FeedLinkMode }}">
|
||||
<div id="feed-toolbar"></div><p id="feed-status" role="status" aria-live="polite"></p>
|
||||
<div class="feed-layout"><aside id="feed-sources" aria-label="{{ T "feeds.title" }}"></aside><section class="feed-index"><div id="feed-columns" aria-hidden="true"></div><div id="feed-rows" tabindex="0" role="listbox" aria-label="{{ T "feeds.title" }}"></div><button type="button" id="feed-more" hidden>↓</button></section><article id="feed-reader" tabindex="0"></article></div>
|
||||
</main><script src="/static/js/feeds.js?v=11" defer></script></body></html>{{ end }}
|
||||
</main><script src="/static/js/feeds.js?v=12" defer></script></body></html>{{ end }}
|
||||
@@ -1,7 +1,7 @@
|
||||
{{ define "organizer_dashboard.gohtml" }}<!doctype html>
|
||||
<html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ T "organizer.dashboard" }} · {{ .WikiName }}</title><link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"><link rel="stylesheet" href="/static/css/task-productivity.css?v=3"><link rel="stylesheet" href="/static/css/organizer.css?v=1"></head>
|
||||
<html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ T "organizer.dashboard" }} · {{ .WikiName }}</title><link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"><link rel="stylesheet" href="/static/css/task-productivity.css?v=3"><link rel="stylesheet" href="/static/css/organizer.css?v=3"></head>
|
||||
<body class="mode-view organizer-page"><header class="topbar"><div class="brand"><a href="/">{{ .WikiName }}</a></div>{{ template "auth-menu" . }}</header>
|
||||
{{ template "organizer-nav" . }}
|
||||
<main id="organizer-dashboard" data-writable="{{ .TaskWritable }}" data-calendar="{{ .CalendarEnabled }}" data-today="{{ .Today }}" data-timezone="{{ .Timezone }}">
|
||||
<header class="dashboard-toolbar"><div><h1>{{ T "organizer.dashboard" }}</h1><small>{{ .Today }} · {{ .Timezone }}</small></div><div id="dashboard-controls"></div></header><p id="dashboard-status" role="status" aria-live="polite"></p><div id="dashboard-grid"></div>
|
||||
</main><script src="/static/js/organizer-dashboard.js?v=2" defer></script><script src="/static/js/task-productivity.js?v=8" defer></script></body></html>{{ end }}
|
||||
</main><script src="/static/js/task-presentation.js?v=1" defer></script><script src="/static/js/dashboard-commands.js?v=1" defer></script><script src="/static/js/organizer-dashboard.js?v=5" defer></script><script src="/static/js/task-productivity.js?v=8" defer></script></body></html>{{ end }}
|
||||
@@ -1,8 +1,9 @@
|
||||
{{ define "organizer_settings.gohtml" }}<!doctype html>
|
||||
<html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ T "organizer.settings" }} · {{ .WikiName }}</title><link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"><link rel="stylesheet" href="/static/css/config.css"><link rel="stylesheet" href="/static/css/task-productivity.css?v=3"><link rel="stylesheet" href="/static/css/organizer.css?v=1"></head>
|
||||
<html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ T "organizer.settings" }} · {{ .WikiName }}</title><link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"><link rel="stylesheet" href="/static/css/config.css"><link rel="stylesheet" href="/static/css/task-productivity.css?v=3"><link rel="stylesheet" href="/static/css/organizer.css?v=3"></head>
|
||||
<body class="mode-config organizer-page"><header class="topbar"><div class="brand"><a href="/">{{ .WikiName }}</a></div>{{ template "auth-menu" . }}</header>{{ template "organizer-nav" . }}
|
||||
<main class="config-main"><div class="config-layout"><aside class="config-sidebar"><nav class="sidebar-nav"><a href="/-/sys/config?panel=organizer" aria-current="page">{{ T "organizer.settings" }}</a>{{ if .TasksEnabled }}<a href="#task-productivity">{{ T "tasks.title" }}</a>{{ end }}{{ if .CalendarEnabled }}<a href="#organizer-calendar-defaults">{{ T "organizer.calendar_defaults" }}</a>{{ end }}{{ if .ContactsEnabled }}<a href="/v/plan/contacts">{{ T "organizer.contacts" }} ↗</a>{{ end }}{{ if .AuthIsAdmin }}<a href="/-/sys/config">{{ T "config.title" }} ↗</a>{{ end }}</nav></aside>
|
||||
<section class="organizer-settings-content"><h1>{{ T "organizer.settings" }}</h1><p>{{ T "organizer.private" }}</p>
|
||||
<section id="appearance"><h2>{{ T "home.appearance" }}</h2><form class="personal-appearance" method="post" action="/-/sys/config?panel=organizer&section=appearance"><fieldset {{ if not .TaskWritable }}disabled{{ end }}><input type="hidden" name="version" value="{{ .AppearanceVersion }}">{{ template "personal-wallpaper-controls" . }}<label>{{ T "home.glass_transparency" }}<input name="home_glass_transparency" type="number" min="0" max="85" value="{{ .HomeGlassTransparency }}"></label>{{ template "home-palette-controls" . }}<button type="submit">{{ T "config.save" }}</button></fieldset></form></section>
|
||||
{{ if .FeedsEnabled }}<section><h2>{{ T "feeds.title" }}</h2><p>{{ T "feeds.help" }}</p><a href="/v/feeds?settings=1">⚙ {{ T "feeds.title" }}</a></section>{{ end }}
|
||||
{{ if .TasksEnabled }}<section id="task-productivity" data-view="settings" data-writable="{{ .TaskWritable }}"><h2></h2><p id="productivity-status" role="status" aria-live="polite"></p><div id="productivity-content"></div></section><section id="task-digest-history" data-writable="{{ .TaskWritable }}"></section>{{ end }}
|
||||
{{ if .CalendarEnabled }}<section id="organizer-calendar-defaults" data-writable="{{ .TaskWritable }}"><h2>{{ T "organizer.calendar_defaults" }}</h2><p role="status"></p><div data-calendar-defaults></div></section>{{ end }}
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
</div>
|
||||
|
||||
{{ if .ObjectUUID }}
|
||||
<a class="breadcrumb-action-icon" href="/r/history/{{ .ObjectUUID }}" title="{{ T "history.title" }}" aria-label="{{ T "history.title" }}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5v5h5M5.5 9a8 8 0 1 1-.5 6M12 7v5l3 2"/></svg></a>
|
||||
{{ if and .SlidesEnabled (eq .ContentView.Kind "html") }}<a class="breadcrumb-action-icon" href="/v/slides{{ .Path }}" title="{{ T "slides.title" }}" aria-label="{{ T "slides.title" }}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 4h18v12H3zM12 16v5m-5 0 5-5 5 5M8 8h8m-8 4h5"/></svg></a>{{ end }}
|
||||
<a class="breadcrumb-action-icon" href="/_/view/print/uuid:{{ .ObjectUUID }}" title="{{ T "viewer.print" }}" aria-label="{{ T "viewer.print" }}">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 9V4h10v5M7 17H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2M7 14h10v6H7z"></path></svg>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<a
|
||||
href="/r/history/{{ .Revision.ObjectUUID }}"
|
||||
>
|
||||
History
|
||||
{{ T "history.title" }}
|
||||
</a>
|
||||
|
||||
</nav>
|
||||
@@ -52,6 +52,8 @@ History
|
||||
<h1>Revision View</h1>
|
||||
|
||||
<div class="revision-meta">
|
||||
<div><time data-revision-time="{{ .Revision.CreatedAt }}">{{ .Revision.CreatedAt }}</time> · {{ .Revision.Language }}</div>
|
||||
<div>{{ T "history.message" }}: {{ if .Revision.Message }}{{ .Revision.Message }}{{ else }}—{{ end }}</div>
|
||||
|
||||
<div>
|
||||
Revision UUID:
|
||||
@@ -166,6 +168,7 @@ Raw HTML Source
|
||||
|
||||
</main>
|
||||
|
||||
<script src="/static/js/revisions.js?v=2" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
||||
@@ -66,17 +66,20 @@ Object UUID:
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ $r.CreatedAt }}
|
||||
<time data-revision-time="{{ $r.CreatedAt }}">{{ $r.CreatedAt }}</time>
|
||||
· {{ $r.Language }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="revision-message">
|
||||
{{ $r.Message }}
|
||||
{{ if $r.Message }}{{ $r.Message }}{{ else }}—{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="revision-actions">
|
||||
{{ if $.CanRestore }}{{ $head := index $.RevisionHeads $r.Language }}{{ if $head }}{{ if ne $head $r.UUID }}
|
||||
<button type="button" data-restore-revision="{{ $r.UUID }}" data-base-revision="{{ $head }}">{{ T "editor.restore" }}</button>
|
||||
{{ end }}{{ end }}{{ end }}
|
||||
|
||||
<a
|
||||
class="button"
|
||||
@@ -112,6 +115,7 @@ Object UUID:
|
||||
</nav>
|
||||
</main>
|
||||
|
||||
<script src="/static/js/revisions.js?v=2" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ define "task_work_history.gohtml" }}<!doctype html>
|
||||
<html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ T "task.work_history" }} · {{ .WikiName }}</title><link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"><link rel="stylesheet" href="/static/css/organizer.css?v=1"><link rel="stylesheet" href="/static/css/task-work-history.css?v=1"></head>
|
||||
<html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ T "task.work_history" }} · {{ .WikiName }}</title><link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"><link rel="stylesheet" href="/static/css/organizer.css?v=3"><link rel="stylesheet" href="/static/css/task-work-history.css?v=1"></head>
|
||||
<body class="mode-view organizer-page"><header class="topbar"><div class="brand"><a href="/">{{ .WikiName }}</a></div>{{ template "auth-menu" . }}</header>{{ template "organizer-nav" . }}
|
||||
<main id="task-work-history" data-writable="{{ .TaskWritable }}" data-timezone="{{ .Timezone }}"><header><h1>{{ T "task.work_history" }}</h1><a href="/v/plan/dashboard#activity">{{ T "organizer.dashboard" }}</a></header><p id="work-history-status" role="status" aria-live="polite"></p><div id="work-history-controls"></div><div id="work-history-list"></div><div id="work-history-paging"></div></main>
|
||||
<script src="/static/js/task-work-history.js?v=1" defer></script></body></html>{{ end }}
|
||||
@@ -1,6 +1,6 @@
|
||||
{{ define "tasks.gohtml" }}<!doctype html>
|
||||
<html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ T "tasks.title" }} · {{ .WikiName }}</title>
|
||||
<link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"><link rel="stylesheet" href="/static/css/tasks.css?v=11"></head>
|
||||
<link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"><link rel="stylesheet" href="/static/css/tasks.css?v=12">{{ if eq .TaskView "index" }}<link rel="stylesheet" href="/static/css/task-index.css?v=1">{{ end }}</head>
|
||||
<body class="mode-view organizer-page"><header class="topbar"><div class="brand"><a href="/">{{ .WikiName }}</a></div>{{ template "auth-menu" . }}</header>{{ template "organizer-nav" . }}
|
||||
<main id="tasks-app" data-view="{{ .TaskView }}" data-id="{{ .TaskID }}" data-today="{{ .TaskToday }}" data-selected-date="{{ .TaskSelectedDate }}" data-timezone="{{ .TaskTimezone }}" data-writable="{{ .TaskWritable }}">
|
||||
<nav id="tasks-nav" aria-label="Tasks"></nav><section class="tasks-workspace">
|
||||
@@ -11,4 +11,4 @@
|
||||
<p id="tasks-status" role="status" aria-live="polite"></p><div class="tasks-list-scroll"><div id="tasks-list" role="list"></div></div><button type="button" id="tasks-more" hidden></button>
|
||||
</section>
|
||||
<dialog id="tasks-dialog" aria-labelledby="tasks-dialog-title"><form id="tasks-form"><header class="tasks-toolbar"><h2 id="tasks-dialog-title"></h2><button type="button" id="tasks-close">×</button></header><div id="tasks-fields"></div><p id="tasks-error" role="alert"></p><details id="tasks-history"><summary></summary><ol></ol></details><footer class="tasks-actions"><button type="button" id="tasks-archive"></button><button type="button" id="tasks-delete" class="danger" hidden></button><a id="tasks-page-open" class="task-footer-link" target="_blank" rel="noopener noreferrer" hidden></a><a id="tasks-project-open" class="task-footer-link" hidden></a><button type="submit" id="tasks-save"></button></footer></form></dialog>
|
||||
</main><link rel="stylesheet" href="/static/css/dav-settings.css?v=3"><script src="/static/js/task-inline.js?v=4" defer></script><script src="/static/js/task-today.js?v=1" defer></script><script src="/static/js/task-planning.js?v=3" defer></script><script src="/static/js/task-focus.js?v=2" defer></script><script src="/static/js/task-work.js?v=1" defer></script><script src="/static/js/tasks.js?v=11" defer></script><script src="/static/js/task-dav-settings.js?v=4" defer></script></body></html>{{ end }}
|
||||
</main><link rel="stylesheet" href="/static/css/dav-settings.css?v=3"><script src="/static/js/task-presentation.js?v=1" defer></script><script src="/static/js/task-inline.js?v=5" defer></script><script src="/static/js/task-today.js?v=1" defer></script><script src="/static/js/task-planning.js?v=3" defer></script><script src="/static/js/task-focus.js?v=2" defer></script><script src="/static/js/task-work.js?v=1" defer></script>{{ if eq .TaskView "index" }}<script src="/static/js/task-index.js?v=1" defer></script>{{ end }}<script src="/static/js/tasks.js?v=13" defer></script><script src="/static/js/task-dav-settings.js?v=4" defer></script></body></html>{{ end }}
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="/static/css/notifications.css?v=3">
|
||||
<link rel="stylesheet" href="/static/css/notification-active.css?v=1">
|
||||
<link rel="stylesheet" href="/static/css/nav-modals.css?v=3">
|
||||
<link rel="stylesheet" href="/static/css/organizer.css?v=1">
|
||||
<link rel="stylesheet" href="/static/css/organizer.css?v=3">
|
||||
<button type="button" class="city-map-launch" data-city-map-launch aria-label="{{ T "city.map" }}" title="{{ T "city.map" }}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m3 6 5-3 8 3 5-3v15l-5 3-8-3-5 3V6Zm5-1v11m8-8v11M5 7.2v10.3l3-1.8 8 3 3-1.8V6.5l-3 1.8-8-3L5 7.2Z"/></svg></button>
|
||||
<dialog class="city-map-dialog" data-city-map-dialog aria-label="{{ T "city.map" }}"><div class="city-map-dialog-head"><strong>{{ T "city.map" }}</strong><a href="/v/city">↗</a><button type="button" data-city-map-close aria-label="Close">×</button></div><iframe title="{{ T "city.map" }}" data-city-map-frame data-src="/v/city?popup=1"></iframe></dialog>
|
||||
{{ if .AuthUser }}<button type="button" class="notification-launch" data-notification-launch aria-label="{{ T "notification.title" }}" title="{{ T "notification.title" }}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M18 9a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9M10 21h4"/></svg><span class="notification-badge" data-notification-badge hidden></span></button><dialog class="notification-dialog" data-notification-dialog data-owner="{{ .AuthUser.UUID }}" data-domain="{{ .Context.Domain.UUID }}" aria-label="{{ T "notification.title" }}"><form method="dialog"><header><h2>{{ T "notification.title" }}</h2><button type="button" data-notification-close aria-label="Close">×</button></header><div class="notifications-list" data-notifications-list></div><footer><a href="/v/notification">{{ T "notification.all" }}</a></footer></form></dialog>{{ end }}
|
||||
|
||||
@@ -11,19 +11,24 @@
|
||||
{{ if .CanConfigureHome }}
|
||||
<button type="button" class="home-appearance-launch" data-home-appearance-open aria-label="{{ T "home.appearance" }}" title="{{ T "home.appearance" }}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9 3-.5 3-2 .9L4 6l-2 4 2.5 1.8v2.4L2 16l2 4 2.5-.9 2 .9.5 3h6l.5-3 2-.9L20 20l2-4-2.5-1.8v-2.4L22 10l-2-4-2.5.9-2-.9-.5-3z"/><circle cx="12" cy="13" r="3"/></svg></button>
|
||||
<dialog class="home-appearance-dialog" data-home-appearance-dialog aria-labelledby="home-appearance-title">
|
||||
<form method="post" action="/-/sys/config" data-home-appearance-form data-saved="{{ T "config.saved" }}">
|
||||
<input type="hidden" name="section" value="home-appearance">
|
||||
<form method="post" action="/-/sys/config?panel=organizer&section=appearance" data-home-appearance-form data-saved="{{ T "config.saved" }}">
|
||||
<input type="hidden" name="version" value="{{ .AppearanceVersion }}">
|
||||
<header><h2 id="home-appearance-title">{{ T "home.appearance" }}</h2><button type="button" data-home-appearance-close aria-label="{{ T "picker.cancel" }}">×</button></header>
|
||||
{{ template "personal-wallpaper-controls" . }}
|
||||
<label>{{ T "home.glass_transparency" }}<span class="home-appearance-range"><input name="home_glass_transparency" type="range" min="0" max="85" step="1" value="{{ .HomeGlassTransparency }}"><output>{{ .HomeGlassTransparency }}%</output></span></label>
|
||||
<p class="muted">{{ T "home.glass_help" }}</p>
|
||||
{{ template "home-palette-controls" . }}
|
||||
<footer><span data-home-appearance-status role="status"></span><button type="button" data-home-appearance-cancel>{{ T "picker.cancel" }}</button><button type="submit">{{ T "config.save" }}</button></footer>
|
||||
</form>
|
||||
</dialog>
|
||||
<script defer src="/static/js/home-appearance.js?v=2"></script>
|
||||
<script defer src="/static/js/home-appearance.js?v=3"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ define "personal-wallpaper-controls" }}
|
||||
<label>{{ T "home.personal_wallpaper" }}<input type="text" name="home_wallpaper_path" value="{{ .HomeWallpaperPath }}" placeholder="/wallpapers" maxlength="4096"></label>
|
||||
<label>{{ T "home.personal_opacity" }}<input type="number" name="home_wallpaper_opacity" value="{{ .HomeWallpaperPercent }}" min="0" max="100"></label>
|
||||
{{ end }}
|
||||
{{ define "home-palette" }}
|
||||
{{ if and .IsHome .HomeWallpaperURL }}
|
||||
<div hidden data-home-palette data-mode="{{ .HomePalette.Mode }}" data-strength="{{ .HomePalette.Strength }}" data-brightness="{{ .HomePalette.Brightness }}" data-key="{{ .HomeWallpaperKey }}" data-domain="{{ .HomePaletteDomain }}"></div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ define "organizer-nav" }}
|
||||
<link rel="stylesheet" href="/static/css/organizer.css?v=2">
|
||||
<link rel="stylesheet" href="/static/css/organizer.css?v=3">
|
||||
<nav class="organizer-nav" aria-label="{{ T "organizer.title" }}">
|
||||
{{ if .FeedsEnabled }}<a href="/v/feeds" title="{{ T "feeds.title" }}" aria-label="{{ T "feeds.title" }}" {{ if eq .OrganizerSection "feeds" }}aria-current="page"{{ end }}>◉ <span>{{ T "feeds.title" }}</span></a>{{ end }}
|
||||
{{ if .TasksEnabled }}<a href="/v/plan/dashboard" title="{{ T "organizer.dashboard" }}" aria-label="{{ T "organizer.dashboard" }}" {{ if eq .OrganizerSection "dashboard" }}aria-current="page"{{ end }}>▦ <span>{{ T "organizer.dashboard" }}</span></a><a href="/v/plan/tasks" title="{{ T "tasks.title" }}" aria-label="{{ T "tasks.title" }}" {{ if eq .OrganizerSection "tasks" }}aria-current="page"{{ end }}>✓ <span>{{ T "tasks.title" }}</span></a>{{ end }}
|
||||
|
||||
Reference in new issue
Block a user