codegame-share

command module
v0.0.0-...-989eccb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2022 License: AGPL-3.0 Imports: 29 Imported by: 0

README

codegame-share

A service to make sharing game IDs, spectate links and sessions easier.

API

POST /game
Description

Stores the game URL and ID and returns an 8 characters long ID which when presented to the /{id} endpoint will return a web page with information about the game.

Request Body
{
	"game_url": "", // URL of the game server (e.g. games.code-game.org/hoverrace)
	"game_id": "" // ID of the game
}
POST /spectate
Description

Stores the game URL, game ID, player ID and player secret and returns an 8 characters long ID, which when presented to the /{id} endpoint will redirect the user to the respective spectate view of the game server.

Request Body
{
	"game_url": "", // URL of the game server (e.g. games.code-game.org/hoverrace)
	"game_id": "", // ID of the game
	"player_id": "", // ID of the player
	"player_secret": "" // the player secret
}
POST /session
Description

Stores a session object and returns an 8 characters long ID, which when presented to the /{id} endpoint will return the session again.

Request Body
{
	"game_url": "", // URL of the game server (e.g. games.code-game.org/hoverrace)
	"username": "", // the username of the player
	"session": {
		"game_id": "", // ID of the game
		"player_id": "", // ID of the player
		"player_secret": "" // the player secret
	},
	"password": "" // optional password
}
GET /{id}?type=<game|spectate|session>

Retrieves the data associated with the ID and returns it in a different format depending on the endpoint used to store it.

You can use the optional type parameter to assert that the entry is of a specific type.

If the entry is password protected, you will need to set the Password header with the correct password.

IDs and their associated content are stored for 24h.

License

Copyright (c) 2022 Julian Hofmann

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL