wip(wifi workflow): DELETE method available doesn't represent writable on CPY 10.0.3 lilygot tdisplay S3, switch to fs json like circup #412
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This switches to using the file web api response to get the writable state, which is returned whenever the listDir api is used.
On the lilygo T-Display S3 the HTTP PUT failed due to not being writable, and the http response was something like "USB ACTIVE, try reseting board" or something like that, but the response text is not displayed in console nor to user.
Looking deeper, the PUT request should have been skipped, due to writable: false being part of the listDir response for "/".
Checking the current readOnly code, it checks for an HTTP OPTIONS query and inspects the returned methods for DELETE, which was present when my device was not writable. The JSON property was correctly returned.
This switches to using the /fs/ API check instead of relying on HTTP DELETE method being supported.
It's probably worth refactoring this into a class level flag thats updated with each listDir and then cached, until a disconnect event or failed write call at which point it's forcefully refreshed.
Calling like it currently does at each call of readOnly is actually fine (at least on a responsive wifi network).