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.
Remote Server
Hello Frappe-Books Team,
I'm writing to submit a pull request for the remote connection feature I've been working on. I wanted to emphasize that this implementation is very basic (and unconventional) but I have had a great experience using it so far. I have begun working on a remote connection feature, which aims to simplify the way users can share there books by establishing a connection to a remote server. Although the feature is already fully functional, I would like to highlight that security measures have not been incorporated at all yet. Consequently, this pull request is intended for review and discussion.
How it works
I have implemented a custom Knex database client that extends the standard better-sqlite3 client. My client intercepts the communication just before establishing a native SQLite connection, redirecting the SQL queries that would normally hit the SQLite database directly, and instead sending the queries to a server. This server then establishes the necessary communication with the SQLite file and responds with the query results.
Here is a quick illustration:
Things I had to change
Add another button with a modal to the database selector allowing the user to enter the server adress
Add a util function that allows me to test whether the database path is a URL
Bypass the interaction with the file system if the database path is a URL in various places
Dynamically use the custom client in the database core file when the database path is a URL
Enhance the database selector by incorporating an additional button with a modal window, enabling users to input the server address.
Add a utility function that verifies whether the database path corresponds to a URL.
Alter various sections along the way to bypass file system interactions when dealing with a URL-based database path.
Dynamic use of the custom client within the database core file, when the database path is a URL.
The Server
The server implementation can be found here frappe-books-server
I have also build a docker-image
That's it for now, I hope there may be some value to this. As said I had a great experience using it so far, while working with in a team. I am sure there is a better way to implement server connectivity but I doubt that there will be a simpler one.
Thank you,
Erik