Reileta is a system for the management for AtelierVR.
- Clone the repository
git clone https://github.com/hactazoff/AVR-Reileta.git
cd AVR-Reileta/
- Install the dependencies
npm install
- Create a .env file and fill it with the .env.example file
cp .env.example .env
- Start the server
npm run dev
DATABASE_URL=string path
- The database urlREILETA_ID=string
- The id of the serverREILETA_ENABLE=boolean
- If the server is enabledREILETA_PORT=number
- The port of the serverREILETA_PREFERED_ADDRESS=string
- The prefered address of the serverREILETA_SECURE=boolean
- If the server is secureREILETA_AUTH_CAN_LOGIN=boolean
- If you can loginREILETA_AUTH_CAN_REGISTER=boolean
- If you can registerREILETA_AUTH_CAN_DELETE=boolean
- If you can delete your accountREILETA_INTEGRITY_CAN_CREATE=boolean
- If you can create integrityREILETA_INTEGRITY_CAN_CHECK=boolean
- If you can check integrityREILETA_SOFT_HIDE_WORLDS=boolean
- If you can view all worldsREILETA_WORLD_CAN_MODIFY=boolean
- If you can modify worldsREILETA_WORLD_FALLBACK=string
- The fallback world idREILETA_TMP_FILE_EXPIRATION=number
- The expiration of the temporary filesREILETA_DEFAULT_USER_TAGS=string
- The default user tags (comma separated)REILETA_CAN_EDIT_WORLD=boolean
- If you can edit worldsREILETA_SUPPORTED_WORLD_ASSET_ENGINE=string
- The supported world asset engines (comma separated)REILETA_SUPPORTED_WORLD_ASSET_PLATFORMS=string
- The supported world asset platforms (comma separated)REILETA_INTEGRITY_EXPIRATION=number
- The expiration of the integrityHIDE_IP=boolean
- If you can hide the ip 'REILETA_CAN_UPLOAD_FILE=boolean
- If you can upload filesREILETA_FILE_PATH=string
- The file origin path
The Eta is the main server of the system. It is the registry server for the users, services and worlds.
The Reil is the security server of the system. It is the security server for authentication, challenges and proxy. It can moderate the authorized servers and clients. On Request HTTP, it can add
AVR-Gateway: {secure bool} {address string}
header with the gateway address of the server.
The Ins are the instance servers of the system. They can be created by the users, services or decicated servers. They communicate with socket connections to the Reil and Eta servers. The others clients can connect to the Ins servers with the Reil server.
The system of Reileta is based on HTTP requests. The secure connection is mostly impotant and trustingly. The following table shows the available requests. All requests if you get a external server, you have to use the
?server
query parameter.
A sample response looks like this:
{
"request": REQUEST_URL,
"data": DATA_OBJECT | undefined,
"time": TIMESTAMP_IN_MILLISECONDS,
"error": {
"code": ERROR_CODE,
"message": ERROR_MESSAGE
} | undefined,
"redirect": {
"secure": REDIRECT_SECURE,
"address": REDIRECT_ADDRESS
} | undefined
}
REQUEST_URL
is the url of the request.DATA_OBJECT
is the real response data of the request.TIMESTAMP_IN_MILLISECONDS
is the timestamp of the request.ERROR_CODE
is the error code of the request.ERROR_MESSAGE
is the error message of the request.REDIRECT_SECURE
is the secure of the redirect for the next request.REDIRECT_ADDRESS
is the address of the redirect for the next request.
- GET /api/server - Get the server information
- POST /api/server - Update the server information
- GET /api/time - Get the server time
The authentication is based on a token. You can Authenticate yourself with the following requests with the
Authorization
andUser-Agent: AVR(User)
headers, or with the?authuser
(deprecated) query parameter.
- POST /api/auth/login - Login with a user
- POST /api/auth/register - Register a new user
- GET /api/auth/logout - Logout the current session
- DELETE /api/auth/logout - Delete the current session
Tips: If you use
@me
as user:id
, you can get the information about the current user. You can find a user by its ID or its name. The:server
parameter is optional and only needed if you want to get the information of a user on a specific server. You can't not use ids with starting with@
, because they are reserved for the system. For example@me
is the current user,@root
is the root user, and@admin
is the main admin of the server.
- GET /api/users - Get all users
- GET /api/users/:id - Get a user information
- POST /api/users/:id - Update a user information
- DELETE /api/users/:id - Delete a user
- GET /api/users/:id/home - Get the user home
- POST /api/users/:id/home - Update the user home
- DELETE /api/users/:id/home - Delete the user home
- GET /api/users/:id/thumbnail - Get the user thumbnail png
- POST /api/users/:id/thumbnail - Upload a new user thumbnail png
- DELETE /api/users/:id/thumbnail - Delete the user thumbnail png
- GET /api/users/:id/banner - Get the user banner png
- POST /api/users/:id/banner - Upload a new user banner png
- DELETE /api/users/:id/banner - Delete the user banner png
The services are addons the the mods client ans other services server. Is must be a unique id for alls services of the global system.
- GET /api/services - Get all services
- PUT /api/services - Create a new service
- GET /api/services/:id - Get a service information
- POST /api/services/:id - Update a service information
- DELETE /api/services/:id - Delete a service
- GET /api/worlds - Get all worlds
- PUT /api/worlds - Create a new world
- GET /api/worlds/:id - Get a world information
- POST /api/worlds/:id - Update a world information
- DELETE /api/worlds/:id - Delete a world
- GET /api/worlds/:id/thumbnail - Get the world thumbnail png
- POST /api/worlds/:id/thumbnail - Upload a new world thumbnail png
- DELETE /api/worlds/:id/thumbnail - Delete the world thumbnail png
- GET /api/worlds/:id/assets - Get all assets
- PUT /api/worlds/:id/assets - Create a new asset
- GET /api/worlds/:id/assets/:asset - Get a asset information
- POST /api/worlds/:id/assets/:asset - Update a asset information
- DELETE /api/worlds/:id/assets/:asset - Delete a asset
- GET /api/worlds/:id/assets/:asset/file - Get the asset file
- POST /api/worlds/:id/assets/:asset/file - Upload a new asset file
The server challenges are a way to get a token for a server. The token is used to authenticate the server to a other server. It can Authenticate itself with the following requests with the
Authorization
andUser-Agent: AVR(Server)
headers, or with the?authserver
query parameter.
- GET /api/challenges - Get all server challenges
- PUT /api/challenges - Create a new server challenge
- GET /api/chalnges/:id - Get a server challenge information
- DELETE /api/challenges/:id - Delete a server challenge
The integrity is a way to check the identity of a user on a other server, to access private data or access to a instance. It can Authenticate itself with the following requests with the
Authorization
andUser-Agent: AVR(User)
headers, or with the?integrityuser
query parameter.
- GET /api/integrity - Get all integrity
- PUT /api/integrity - Fetch a new integrity token by a sever for a own user (server only)
- POST /api/integrity - Fetch a create integrity token by a user for a server (user only, on host server)
The instances are the servers of the system.
- GET /api/instances - Get all instances
- PUT /api/instances - Create a new instance
- GET /api/instances/:id - Get a instance information
- POST /api/instances/:id - Update a instance information
- DELETE /api/instances/:id - Delete a instance
- GET /api/instances/:id/candidate - Get the candidate of the instance
- POST /api/instances/:id/candidate - Add a candidate to join the instance
- DELETE /api/instances/:id/candidate - Remove a candidate to join the instance
The utility of the WebSocket is to the communication with the proxy and the instance servers. The WebSocket is used to send and receive data from your server.
- GET /api/ws - Get the WebSocket connection
Sample request:
{
"state"?: REQUEST_STATE,
"command": REQUEST_EVENT,
"data": DATA_OBJECT | undefined,
}
REQUEST_STATE
is the state custom state of the request.REQUEST_EVENT
is the event of the request. Is represented by a path, for exampleavr/instance:join
.DATA_OBJECT
is the data of the request.
Sample response:
{
"state"?: RESPONSE_STATE,
"command": RESPONSE_EVENT,
"data": DATA_OBJECT | undefined,
"error": {
"code": ERROR_CODE,
"message": ERROR_MESSAGE
} | undefined
}
RESPONSE_STATE
is the state custom state of the response.RESPONSE_EVENT
is the event of the response.DATA_OBJECT
is the data of the response.ERROR_CODE
is the error code of the response.ERROR_MESSAGE
is the error message of the response.
-
avr/ping - Get the pong of the server
{ "i": number, // Initial timestamp by the client }
-
avr/authenticate - Authenticate to the server
{ "token"?: string, // The token of the user "integrity"?: string // The integrity token of the user }
-
avr/enter - Join a instance
{ "instance": string, // The instance id }
-
avr/quit - Leave a instance
{ "instance": string, // The instance id }
-
avr/moderate - Moderate a user
{ "to_socket": string, // The socket id of the user "type": ModerationType // If the user is moderate }
-
avr/transform - Transform in the instance
{ "path": string, // The path of the transform, for a playere, it's `p:<@me|player_id>/<path>` "p": Transform.Position, "r": Transform.Rotation, "s": Transform.Scale, "v": Transform.Velocity, "a": Transform.Acceleration }
-
avr/ping - Pong of the server
The event is't send in logs.
{ "i": number, // Initial timestamp by the client "o": number // Timestamp by the server }
-
avr/authenticate - All authentication events
{ "internal": boolean, // If use token or not "user": { "id": string, "username": string, "display": string, "server": string } }
-
avr/enter - The current user entered a instance
{ "player": string, // The player id of the user "user": string, // The user id@server }
-
avr/quit - The current user left a instance
{ "player": string, // The player id of the user "code": Instance.QuitType // The code of the leave }
-
avr/join - A user joined a instance
{ "player": string, // The player id of the user "user": string // The user id@server }
-
avr/left - A user left a instance
{ "player": string, // The player id of the user "type": QuitType // The code of the leave }
-
avr/moderate - Response of the moderation
{ "to_player": string, // The player id of the user "type": ModerationType // If the user is moderate }
-
avr/moderation - A user is moderate
{ "to_player": string, // The player id of the user "by_player": string, // The player id of the moderator "type": ModerationType // If the user is moderate }
-
avr/data - A user send data in the instance
The event is't send in logs.
{ "player": string, // The player id of the user "data": any // The data of the user }
-
avr/transform - A user transform in the instance
The event is't send in logs.
{ "player": string, // The player id of the user "path": string, // The path of the transform "p": Transform.Position, "r": Transform.Rotation, "s": Transform.Scale, "v": Transform.Velocity, "a": Transform.Acceleration "at": number // custom number to prevent rollback }