dsv-su / play

Dev repository for Play
0 stars 1 forks source link
laravel php

1. Overview

Development setup for DSVPlay.

2. Requirements

Requirements are best determined using Server Requirements page of corresponding Laravel 8 version

3. Installation

Make sure these folder exist or create these folders under storage/framework:

sessions 
views
cache

4. Building assets (dev)

Make sure you have updated npm to the latest version

npm update -g

Install the dependecies

npm install

Build the development assets by running

npm run dev

For production build the production assets

npm run production

5. API

Issued valid tokens are stored in the play.ini file (/systemconfig). There are tokens for storing new presentations and for retrieving presentation metadata (not yet fully implemented).

Endpoints for storing presentations:

Verb URI Action
POST /api/recordings Add a new json file for the presentation (requires a token with permission=store)
GET /api/recordings Request a list of all presentations in json format (requires a token with permission=read)

Endpoints for checking presentation permissions:

Verb URI Action
POST /api/perm Check user permission for presentation

Endpoints for issuing/destroying tokens:

Verb URI Action
POST /api/token_store Issue a token with permission to store a presentation
POST /api/token_read Issue a token with permission to read
POST /api/destroy Destroy token sent

To issue a new token you have to POST to the /api/token_store or /api/token_read endpoint with valid credentials, e.g.

{

    "email": "server@dsv.su.se",
    "password": "password"
}

The response:

{

    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiO7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ",
    "token_type": "bearer"

}

6. Database

Database

7. Multiplayer

The multiplayer is available under /storage/app/multiplayer and is a standalone application. The folder is linked to the multiplayer repo on gitea.dsv.su.se and excluded from the platform's git repo. Updating the multiplayer is easiest with the artisan command:

php artisan update:multiplayer
php artisan integrate:multiplayer

This will check if an update is available on the multiplayer repo and if so perform a git pull, execute the multiplayer python script to create a local player and finally integrate the player into the platform.