Commit b0e2c25
Use /fs/ JSON 'writable' flag, cache it, drop DELETE-method check
The previous readOnly() heuristic checked whether DELETE was advertised in
the OPTIONS Access-Control-Allow-Methods response. On CircuitPython 10.0.3
(observed on a LilyGo T-Display S3) DELETE was advertised even when USB
had claimed the filesystem and PUT requests were rejected with a free-form
'USB ACTIVE, try resetting board' body that the editor never surfaced --
so saves silently failed instead of being skipped up front.
Switch to the same source of truth circup uses: the 'writable' field in
the /fs/ JSON response. Cache the value on the FileTransferClient so
readOnly() doesn't fire an extra GET on every call, and let listDir()
populate the cache when it runs (which already happens at connect time
via web.js, so the typical hot path costs no extra round-trip).
The cache resets naturally because FileTransferClient is reconstructed
on every (re)connect.
Co-authored-by: tyeth <tyethgundry@googlemail.com>1 parent c6d118c commit b0e2c25
1 file changed
Lines changed: 21 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
15 | 25 | | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
19 | 29 | | |
20 | 30 | | |
21 | 31 | | |
22 | | - | |
23 | 32 | | |
24 | 33 | | |
25 | 34 | | |
| |||
136 | 145 | | |
137 | 146 | | |
138 | 147 | | |
139 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
140 | 154 | | |
141 | 155 | | |
142 | 156 | | |
| |||
0 commit comments