diff --git a/.vitepress/config.ts b/.vitepress/config.ts index f98f0f8..cbff498 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -1,9 +1,9 @@ import { defineConfig } from 'vitepress' -const ogUrl = 'https://lona.js.org/' +const ogUrl = 'https://docs.lona-development.org/' const ogImage = `${ogUrl}og.png#1` const title = 'Lona Development' -const description = 'JSON based Database written in JavaScript' +const description = 'JSON based Database written in PHP' // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -22,7 +22,7 @@ export default defineConfig({ ['meta', { name: 'twitter:url', content: ogUrl }], ], title: "Lona Development", - description: "JSON based and written in PHP", + description: "JSON based database and written in PHP", themeConfig: { logo: '/favicon.svg', search: { @@ -38,14 +38,26 @@ export default defineConfig({ { text: 'Introduction', items: [ - { text: 'Getting Started', link: '/guide/getting-started' } + { text: 'Getting Started', link: '/guide/getting-started' }, + { text: 'Installation', link: '/guide/install' }, + { text: 'Webinterface', link: '/guide/webinterface' }, + { text: 'Clients', link: '/guide/clients' }, + { text: 'Plugins', link: '/guide/plugins' } + ] + }, + { + text: 'Clients', + items: [ + { text: 'PHP', link: '/client/php' }, + { text: 'JavaScript', link: '/client/javascript' }, + { text: 'Python', link: '/client/python' } ] } ], socialLinks: [ { icon: 'discord', link: 'https://discord.gg/tBWVGQt8sP' }, - { icon: 'github', link: 'https://github.com/LonaDB/Server' } + { icon: 'github', link: 'https://github.com/LonaDB' } ] } }) diff --git a/client/javascript.md b/client/javascript.md index 943c038..4088d54 100644 --- a/client/javascript.md +++ b/client/javascript.md @@ -1,7 +1,3 @@ -# lonadb-client - -The JavaScript-Client is an npm library designed to facilitate communication with LonaDB's "Hadro" Database Server. This library provides a convenient way to interact with the server's various functions, allowing you to manage tables, variables, users, permissions, and more. It simplifies the process of sending requests and receiving responses from the server using the TCP protocol. - ## Installation You can install the JavaScript-Client library using npm: @@ -12,7 +8,7 @@ npm install lonadb-client ## Usage -To use the `lonadb-client` library, follow these steps: +To use the LonaDB Client library, follow these steps: 1. Import the required modules and classes: @@ -20,21 +16,22 @@ To use the `lonadb-client` library, follow these steps: const LonaClient = require("lonadb-client"); ``` -2. Create an instance of the `LonadbClient` class: +2. Create an instance of the `LonaDB-Client` class: ```javascript const client = new LonaClient(host, port, name, password); ``` -Replace `host`, `port`, `name`, and `password` with the appropriate values for your Hadro Database Server. +Replace `host`, `port`, `name`, and `password` with the appropriate values for your LonaDB Server. 3. Use the provided methods to interact with the server: ```javascript // Example: Get a list of tables -client.get("Table", "Variable name") - .then(data => { - console.log("The content of the variable is " + data); +client.getTables() + .then(tables => { + console.log("List of tables:"); + console.log(tables); }) .catch(error => { console.error("Error:", error); @@ -43,7 +40,7 @@ client.get("Table", "Variable name") ## Available Methods -### `getTables()` +### `getTables(username)` Retrieves a list of tables available in the database. @@ -103,6 +100,12 @@ Retrieves the raw permission data for a user. Adds a permission to a user. +### `eval(function)` + +Runs the function (must be a string of PHP code)
+Example: "if($abc === 1234) return 'wtf';" +Response: {"success": true, "response": "wtf", "process": processID} + ## License -This project is licensed under the GNU Affero General Public License version 3 (GNU AGPL-3.0) +This project is licensed under the GNU Affero General Public License version 3 (GNU AGPL-3.0) \ No newline at end of file diff --git a/client/php.md b/client/php.md new file mode 100644 index 0000000..48c26c9 --- /dev/null +++ b/client/php.md @@ -0,0 +1,112 @@ +## Installation + +You can use the LonaDB PHP Client by including it in your project. Simply download the `LonaDB.php` file and include it in your PHP project. + +## Usage + +To use the `LonaDB` PHP Client, follow these steps: + +1. Include the `LonaDB` class in your PHP file: + +```php +require_once('path/to/LonaDB.php'); +``` + +2. Create an instance of the `LonaDB` class by providing the required connection details: + +```php +$client = new LonaDB($host, $port, $name, $password); +``` + +Replace `$host`, `$port`, `$name`, and `$password` with the appropriate values for your LonaDB Server. + +3. Use the provided methods to interact with the server: + +```php +// Example: Get a list of tables +$tables = $client->getTables("username"); + +// Display the list of tables +print_r($tables); +``` + +## Available Methods + +### `getTables(username)` + +Retrieves a list of tables available in the database. + +### `getTableData(table)` + +Retrieves data from a specified table. + +### `deleteTable(name)` + +Deletes a table by its name. + +### `createTable(name)` + +Creates a new table with the given name. + +### `set(table, name, value)` + +Sets a variable within a table to the specified value. + +### `delete(table, name)` + +Deletes a variable from a table. + +### `get(table, name)` + +Retrieves the value of a variable from a table. + +### `getUsers()` + +Retrieves a list of users in the database. + +### `createUser(name, password)` + +Creates a new user with the given name and password. + +### `deleteUser(name)` + +Deletes a user by their name. + +### `checkPassword(name, password)` + +Checks if the provided password is correct for a given user. + +### `checkPermission(user, permission)` + +Checks if a user has a specific permission. + +### `removePermission(user, permission)` + +Removes a permission from a user. + +### `getPermissionsRaw(name)` + +Retrieves the raw permission data for a user. + +### `addPermission(user, permission)` + +Adds a permission to a user. + +### `createFunction(name, content)` + +Create a function which can be executed whenever you want. Just like eval. +Content = string of PHP code + +### `executeFunction(name)` + +Executes the function + +### `eval(function)` + +Runs the function (must be a string of PHP code)
+Example: "if($abc === 1234) return 'wtf';" +Response: {"success": true, "response": "wtf", "process": processID} + +## License + +This project is licensed under the GNU Affero General Public License version 3 (GNU AGPL-3.0). \ No newline at end of file diff --git a/client/python.md b/client/python.md new file mode 100644 index 0000000..29f272e --- /dev/null +++ b/client/python.md @@ -0,0 +1,116 @@ +## Installation + +You can install the LonaDB Python Client via pip: + +```bash +pip install lonadb-client +``` + +## Usage + +To use the `LonaDB` Python Client, follow these steps: + +1. Import the `LonaDB` class into your Python script: + +```python +from lonadb_client import LonaDB +``` + +2. Create an instance of the `LonaDB` class by providing the required connection details: + +```python +client = LonaDB(host, port, name, password) +``` + +Replace `host`, `port`, `name`, and `password` with the appropriate values for your LonaDB server. + +3. Use the provided methods to interact with the server: + +```python +# Example: Get a list of tables +tables = client.get_tables("username"); + +# Display the list of tables +print(tables) +``` + +## Available Methods + +### `get_tables(user)` + +Retrieves a list of tables available in the database. + +### `get_table_data(table)` + +Retrieves data from a specified table. + +### `delete_table(table)` + +Deletes a table by its name. + +### `create_table(table)` + +Creates a new table with the given name. + +### `set_variable(table, name, value)` + +Sets a variable within a table to the specified value. + +### `remove_variable(table, name)` + +Deletes a variable from a table. + +### `get_variable(table, name)` + +Retrieves the value of a variable from a table. + +### `get_users()` + +Retrieves a list of users in the database. + +### `create_user(name, password)` + +Creates a new user with the given name and password. + +### `delete_user(name)` + +Deletes a user by their name. + +### `check_password(name, password)` + +Checks if the provided password is correct for a given user. + +### `check_permission(name, permission)` + +Checks if a user has a specific permission. + +### `remove_permission(name, permission)` + +Removes a permission from a user. + +### `get_permissions_raw(name)` + +Retrieves the raw permission data for a user. + +### `add_permission(name, permission)` + +Adds a permission to a user. + +### `create_function(name, content)` + +Create a function which can be executed whenever you want. Just like eval. +Content = string of PHP code + +### `execute_function(name)` + +Executes the function + +### `eval(func)` + +Runs the function (must be a string of PHP code) +Example: "if ($abc == 1234) return 'wtf';" +Response: {"success": True, "response": "wtf", "process": processID} + +## License + +This project is licensed under the GNU Affero General Public License version 3 (GNU AGPL-3.0). \ No newline at end of file diff --git a/guide/clients.md b/guide/clients.md new file mode 100644 index 0000000..957bf9e --- /dev/null +++ b/guide/clients.md @@ -0,0 +1,9 @@ +# Clients +To use LonaDB for your own project, you need to use one of the clients. + +[PHP](https://docs.lona-development.org/client/php.html) +[JavaScript](https://docs.lona-development.org/client/javascript.html) +[Python](https://docs.lona-development.org/client/python.html) + +We are interested in making LonaDB available in more languages but we are a small team of 4 developers.
+Do you want to help us? Join our Discord Server! \ No newline at end of file diff --git a/guide/getting-started.md b/guide/getting-started.md index aaa6445..f7a574e 100644 --- a/guide/getting-started.md +++ b/guide/getting-started.md @@ -1,35 +1,17 @@ -# Installation +# LonaDB +LonaDB is a document-oriented DBMS written in PHP. It utilizes AES-encrypted JSON files to store data.
+The communication between the server and clients happens with a TCP-socket using our own API. -To install the LonaDB server, follow these steps: +## Important links +- [Installation](https://docs.lona-development.org/guide/install.html) +- [Webinterface](https://docs.lona-development.org/guide/webinterface.html) +- [Clients](https://docs.lona-development.org/guide/clients.html) +- [Plugin Template](https://github.com/LonaDB/PluginTemplate) -## 1. Run the install script with sudo: +## Contributing -```bash -sudo curl -fsSL https://lona-development.org/download/install.sh | sh -``` +Contributions to the LonaDB project are welcome! If you encounter any issues or have suggestions for improvements, please open an issue in the [GitHub repository](https://github.com/LonaDB/Server). -## 2. Start the Server: +## License -```bash -./start.sh -``` - -## 3. Configure everything: - -On every start, you have to put in your encryption key. -If the wrong key has been provided, the configuration file cannot be read and the Server will stop instantly. - -If wanted, you can change the ```php ...``` line in the start.sh file to automatically put in your encryption key: -```bash -printf "yourEncryptionKey\n" | php ... -``` -But this is not recommended since it will basically make everyone be able to find your root user password, wich is stored in the config file, which is encrypted with this key. - -We don't store the key by default because of security of the root user. - -If you don't have a configuration file, a users table or any data tables, the Server will run you through initial setup and create everything needed for the database to run. - -## 4. Use your database: - -Thats it! -You now have your own instance of LonaDB! \ No newline at end of file +This project is licensed under the [AGPL-3.0 License](LICENSE). Feel free to use, modify, and distribute it \ No newline at end of file diff --git a/guide/webinterface.md b/guide/webinterface.md new file mode 100644 index 0000000..9c8b7f9 --- /dev/null +++ b/guide/webinterface.md @@ -0,0 +1,20 @@ +# Installation + +## To install the LonaDB Webinterface, you first need to clone the Repository and go into the directory +´´´bash +git clone https://github.com/LonaDB/Webinterface +cd Webinterface +´´´ + +## Install the NPM Packages +´´´bash +npm install +´´´ + +## Run the server and go through the Setup +´´´bash +node webinterface +´´´ + +## Use it! +Thats it. The installation can't get easier! \ No newline at end of file diff --git a/index.md b/index.md index 6b680ab..33dea0f 100644 --- a/index.md +++ b/index.md @@ -18,11 +18,11 @@ hero: features: - title: What is LonaDB? - details: LonaDB is a prototype of a PHP-based database. It utilizes Encrypted JSON-objects as its storage format and provides support for multiple users and tables. + details: LonaDB is a database written in PHP. It utilizes Encrypted JSON-objects as its storage format and provides support for custom functions, plugins, multiple users and tables. - title: Open-Source! details: This is a Open-Source Project. This means that anyone can look at our source code. That way, we can't collect your data. - title: How does it work? - details: It's really simple! The Server is installed using a installer script. The Client libraries can be found on npm or pip for examle. If there is no Package Manager for your programming language (or we didn't upload the client on it), you can always check our GitHub profile for a client. + details: It's really simple! The Server is installed using a installer script. The Client libraries can be found on our GitHub page (or on pip/npm). - title: Your own instance! details: LonaDB is self-hosted, meaning you can run it on your own server. This allows you to have full control over your data with no one spying. ---