9001 / 9001/copyparty

allow triggering indexing from xau hook based on absolute path

オープン
#1,515 コメント 2 件 リアクション 0 件 担当者 1 名 @9001 が担当を希望しています GitHub で見る
enhancement
主要言語
Python
スター
46.7k
フォーク
1.9k
平均マージ
9日 2時間
マージ済み PR(30日)
4

説明

**is your feature request related to a problem? Please describe.**
currently, `xau` hooks that create new files can trigger indexing by printing (e.g.) `json.dumps({"idx":{"vp":["/foo/1.txt","/foo/bar/2.txt"]}})`
in this syntax, absolute paths are relative to the root of the volume, relative paths are relative to the file that triggered the hook. however, sometimes it is more convenient to use the absolute path (for example, because the hook just passed it to an external tool that needed the absolute path anyway)

**Describe the idea / solution you'd like**
support the following syntax: `"idx": {"ap": ["/home/me/copyparty/cool-files/new-file.txt"]}`, which then should cause copyparty to index that file the same as if it were triggered via a volume path
this should probably also support `reloc` and maybe `del` (making sure that this doesn't cause copyparty to delete files outside any volume), but I don't have a specific use for these

**Describe any alternatives you've considered**
i just let the normal indexer deal with it

**Additional Context**
I think this behaviour is handled here: https://github.com/9001/copyparty/blob/27031f73be12071625c93ab231eb0235b74b2c04/copyparty/up2k.py#L5646-L5650

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

issue では、xau hooks の現在のインデックス作成ロジックが処理されている copyparty/up2k.py の 5646-5650 行が示されています。まずそのセクションを読んで、'vp'(volume path)がどのように処理されているかを理解してください。次に、インデックス作成で 'ap'(absolute path)も受け付けるようにロジックを拡張し、安全性のためにパスがボリューム内にあることを保証してください。言及されているように、'reloc' と 'del' にも同様の処理が必要か確認してください。新しい構文を出力する hook を作成し、ファイルがインデックスに追加されることを確認してテストしてください。

索引モデルが issue の本文から書いたものです。

評価

領域
backend
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。