Added a new document: How it all works.

zrep 2024-04-05 16:29:02 +02:00
parent a38016f6d6
commit 4d2b2e3774
2 changed files with 39 additions and 0 deletions

@ -11,6 +11,10 @@ Welcome to the official Wiki for [zrep](https://git.kekepower.com/kekePower/zrep
- **Modular Design:** Supports the installation, removal, and management of Zsh addons and scripts. - **Modular Design:** Supports the installation, removal, and management of Zsh addons and scripts.
- **Configuration via `.zreprc`:** Customizable settings through a dedicated configuration file. - **Configuration via `.zreprc`:** Customizable settings through a dedicated configuration file.
## How it all works
I've written a short document on [How it all works](How-it-all-works.md) that is, for the moment, an brief introduction to **zrep** and the back-end.
## Getting Started ## Getting Started
### Create your own scripts ### Create your own scripts

35
How-it-all-works.md Normal file

@ -0,0 +1,35 @@
# How it all works
## Introduction
**zrep** is, in its essence, a concept and a client/server system.
The **zrep** client connects to the zrep web server to request information and then performs operations on the client side.
## The zrep client
The **zrep** client is written for the Zsh shell and I've tried to utilize the power of Zsh as much as I could thoughout the script. There are, of course, something better left to other tools, such as parsing JSON with **jq**, the use of grep and sed and a selection of download toos such as **curl**, **wget** or **wget2**.
When you first launch **zrep** it tries to access different files and if they're not present, you'll be told to run **zrep init**. This command will create and populate **~/.zreprc** which is the configuration file. It will also create, per default, a directory in **~/.zrep** which holds functions, themes, a temp directory and the scripts you will install later.
**zrep init** will download 2 files from the Github repository. 1. **zini** which is an INI reader also written in Zsh. 2. **~/.zrep/themes/classic**. This is the color theme for the messages the **zrep** client displays.
## The website and the rePanel Dashboard
The website contains a few PHP scripts that the **zrep** client connects to.
For example, when you run **zrep install kekePower/tohtml** it connects to the webserver (/getver.php) which responds with a JSON tree that **zrep** parses and inserts the **version** to the download URL (/download/kekePower/tohtml/**version**). The download script does a few things. First off it checks if the script is present in the database and has the **published** key set and if it is, it updates the **download count** for the respective script. Then it sends the request to Github to actually download the requested package.
The reason I am using Github for this is to save bandwidth on my connection.
Another example is when you run **zrep search 'search term'**. This also connects to the webserver (/find.php) which searches through the database and presents a list of packages, if there are more than one, with the package name, a description and the URL to the package on the zrep website.
### The rePanel Dashboard
**rePanel** is the dashboard for creators, people who registers for an account. This is the place they have complete access to their scripts and statistics. Since the dashboard is at its beginning stage, quite a lot of functionality is still not complete and will be completed over time. I do not have a time frame for this, but will do my best to make it happen. You can also help out if you want to. [Send me a message](/contact/) if you have suggestions or want to help me refine the website and/or rePanel.
When a new script is created, it is added to the database but is not yet published. This is done in a separate step.
The publishing step is done in two steps. The first step is when the creator publishes the script. The files are written to disk in a temporary directory and are waiting there to be moved to the Github repository.
This move is done using a shell script that runs, at the moment, every hour. This will change over time as more and more scripts are added by more and more creators.