2024-11-10 22:47:39 +01:00
|
|
|
# WebDesk 3rd party App Market server
|
|
|
|
|
2024-11-11 21:54:07 +01:00
|
|
|
# THIS APP MARKET SERVER IS IN BETA AND MISSING FEATURES SO DON'T USE IT YET FOR PROD
|
|
|
|
|
2024-11-10 22:47:39 +01:00
|
|
|
This allows you to host custom (known as 3rd party) App Market repositories of WebDesk applications.
|
|
|
|
|
|
|
|
## Features
|
|
|
|
- Listing currently uploaded apps (/apps endpoint)
|
|
|
|
- Showing app source code (under /uploads/app_name/index.js)
|
|
|
|
- Uploading new apps (/apps endpoint with Bearer token)
|
|
|
|
- Editing app info (/editapp endpoint with Bearer token)
|
|
|
|
- Delete apps (/delete endpoint with Bearer token)
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
- Go (1.23.1 or later, older will work with go.mod changes to the version)
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
1. Clone the repository:
|
|
|
|
```
|
|
|
|
git clone https://git.fluffy.pw/matu6968/webdesk-app-market-server
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Go to the project directory:
|
|
|
|
```
|
|
|
|
cd webdesk-app-market-server
|
|
|
|
```
|
|
|
|
|
2024-11-10 22:50:08 +01:00
|
|
|
3. Build the binary:
|
2024-11-10 22:47:39 +01:00
|
|
|
```
|
|
|
|
go build -o app-market-server
|
|
|
|
```
|
|
|
|
|
|
|
|
4. Execture the binary:
|
|
|
|
```
|
|
|
|
./app-market-server
|
|
|
|
```
|
|
|
|
|
|
|
|
# Configuration
|
|
|
|
|
|
|
|
In the .env file this is the only thing you can set
|
|
|
|
|
|
|
|
```
|
|
|
|
PORT=8080
|
|
|
|
TOKEN=bearer-token-here # The program will automatically make a new token if not found so do not bother putting your own one
|
|
|
|
```
|
2024-11-11 00:11:01 +01:00
|
|
|
# Client demonstrations
|
2024-11-11 00:08:24 +01:00
|
|
|
|
|
|
|
[JavaScript](https://git.fluffy.pw/matu6968/webdesk-app-market-server/src/branch/main/client-demo/demo.js)
|
|
|
|
|
2024-11-10 22:47:39 +01:00
|
|
|
## Autostart with systemd or OpenRC
|
|
|
|
|
|
|
|
You can autostart the web server using systemd or OpenRC (init scripts are in the init-scripts folder)
|
|
|
|
To use it, edit the script accordingly (edit username on what user it is going to run and the path to the binary on where it will run from)
|
|
|
|
|
|
|
|
## for systemd edit the following lines:
|
|
|
|
|
|
|
|
```
|
|
|
|
; Don't forget to change the value here!
|
|
|
|
; There is no reason to run this program as root, just use your username
|
|
|
|
User=examplename # change this to your username
|
|
|
|
|
|
|
|
WorkingDirectory=/path/to/binary # change this to the path where the binary resides
|
|
|
|
```
|
|
|
|
### and to add it as a service:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo cp /path/to/cloned/repo/init-scripts/app-market-server.service /etc/systemd/system/
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
sudo systemctl enable app-market-server.service
|
|
|
|
sudo systemctl start app-market-server.service
|
|
|
|
```
|
|
|
|
|
|
|
|
## for OpenRC edit the following lines:
|
|
|
|
|
|
|
|
```
|
|
|
|
command="bash -c cd ~/webdesk-app-market-server && ./app-market-server" # if you have put the eprintclone binary somewhere else change this line
|
|
|
|
# Don't forget to change the value here!
|
|
|
|
# There is no reason to run this program as root, just use your username
|
|
|
|
command_user="userexample" # change this to your usernames
|
|
|
|
```
|
|
|
|
|
|
|
|
### and to add it as a service:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo cp /path/to/cloned/repo/init-scripts/app-market-server /etc/init.d/
|
|
|
|
sudo rc-update add app-market-server
|
|
|
|
sudo rc-service app-market-server start
|
|
|
|
```
|
|
|
|
|
|
|
|
### How does this work
|
|
|
|
To use the API look at the [wiki](https://git.fluffy.pw/matu6968/webdesk-app-market-server/wiki)
|
|
|
|
|
|
|
|
# !IMPORTANT!
|
|
|
|
|
|
|
|
You will need a directory where your program is with read/write rights otherwaise actions like deleting apps will fail.
|
|
|
|
|