WebDesk 3rd party App Market server
Go to file
2024-11-21 11:56:09 +01:00
init-scripts init 2024-11-10 22:47:39 +01:00
go.mod make massive changes and improve stability 2024-11-21 01:27:13 +01:00
go.sum make massive changes and improve stability 2024-11-21 01:27:13 +01:00
LICENSE init 2024-11-10 22:47:39 +01:00
main.go add ability to view apps under root and specify custom appid in metadata 2024-11-21 11:54:52 +01:00
README.md add ability to view apps under root and specify custom appid in metadata 2024-11-21 11:56:09 +01:00

WebDesk 3rd party App Market server

This allows you to host custom (known as 3rd party) App Market repositories of WebDesk applications.

Features

  • Listing currently uploaded apps (/apps endpoint and root of web server)
  • 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
    
  3. Build the binary:

    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
AUTH_TOKEN=bearer-token-here # The program will automatically make a new token if not found so do not bother putting your own one 

Client demonstrations

Go

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

!IMPORTANT!

You will need a directory where your program is with read/write rights otherwaise actions like deleting apps will fail.