Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Syncthing configuration & REST API datasource #137

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

LBF38
Copy link
Owner

@LBF38 LBF38 commented Oct 16, 2023

This PR will improve the Syncthing configuration panel shown inside the Obsidian settings. Later on, this panel could be accessed via the command palette to easier access to the modal.

Moreover, it improves the Syncthing remote datasource to have full validation on all API calls to the Syncthing REST API. (WIP: this should be verified against real API calls, might have some errors from there).

Finally, it aims to improve reactivity inside the Svelte components and the whole plugin by using svelte/stores.

Closes #10

fix util function to validate simple types.
fix toJSON method in last model
* chore(deps): 📦 add valibot dependency

* feat(dev): ⚗️ testing valibot in real usecase

mobile and desktop real test example.
add SyncthingSystemStatus object/schema.
valibot allows to easily parse the data coming from unknown json.

* refactor(dev): ♻️ add date schema to validate date

* feat(dev): 🐛 update date validation

update SyncthingSystemStatus to validate date types

* refactor(dev): ♻️ move date validations

* refactor(dev): ♻️ move url property to settings

* refactor(dev): ♻️ update all code to valibot

change all types used in the codebase
move to valibot schemas for easy JSON validation and typing.

* refactor(dev): 🔥 clean unused code
remove code specific to mobile
add valibot validation/parsing inside the function.
directly manage the error inside the function.
help to make it easier when calling API endpoints.
TODO: add support for more HTTP methods such as POST/PUT
update configuration view to have a msg
when syncthing needs to be restarted.
add slot in warning message.
add method param in requestEndpoint for syncthing REST datasource.
add more properties from configuration definition.
add button in settings tab to test the configuration endpoint.
create the full TS wrapper over the Syncthing API
This is the first commit for implementing every Syncthing endpoints
continue refactoring to implement all syncthing endpoints
using the new architecture/syntax.
Still need some real tests to check endpoints and syntax
update stats_device and stats_folder
update devices and folders cluster endpoints.
WIP: Still need to implement the DELETE part and test them.
refactor all endpoints.
Still need to verify and implement some endpoints
working on folder endpoints.
still need to implement some methods for folder_versions
refactored all endpoints.
need to test them.
also need to verify syntax/validate the output
add all schemas to validate events from API calls.
will help to handle all Syncthing events.
add events entities to validate API calls
implement the endpoints
still need to validate, when I will consume the endpoint
use of svelte/stores for better reactivity
@LBF38 LBF38 self-assigned this Oct 16, 2023
@LBF38 LBF38 added feature New feature or request dev UI UI related issues labels Oct 16, 2023
add a modal to test all the refactoring for Syncthing REST API access
this is experimental.
Will be enhanced to test all features against a Syncthing instance (created only for that)
docker compose file to create new Syncthing instances for testing purposes
change all methods to arrow functions to capture `this` in proper context.
also add a svelte component to test all the functions and methods.
will see how I check all the methods in Obsidian and if really necessary too.
update code to test some approaches for testing the syncthing remote datasource methods
add a first simple svelte component to test xstate
will be using it for more components, in particular configuration modal component
testing the xstate machines to use it for fetching configuration and updating UI.
this is for testing purposes for now
made simple xstate machine to fetch all the configuration from Syncthing instance.
for now, it fetches the config and can fail or succeed.
more features will be implemented afterwards.
a failure message is shown when there is an error occuring in the config modal.
change to npx for commitlint package
add call to syncthing system status for myID device info
also created a syncthingController machine to orchestrate all the config table fetch/update logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev feature New feature or request UI UI related issues
Projects
Status: 🔖 Ready
Development

Successfully merging this pull request may close these issues.

[FEATURE] View Syncthing configuration inside Obsidian
1 participant