diff --git a/game_manager_frame.php b/game_manager_frame.php
index 37c4a8e..3fea850 100644
--- a/game_manager_frame.php
+++ b/game_manager_frame.php
@@ -92,6 +92,15 @@ if (!get_autologin_state() || (($user_data["privilege"] !== PRIVILEGE_CREATOR) &
+
diff --git a/gamemgr.php b/gamemgr.php
index 1e6575a..4e1c720 100644
--- a/gamemgr.php
+++ b/gamemgr.php
@@ -22,6 +22,8 @@ function create_game(string $name, string $owner, string $description = "", arra
"game_file_present" => false,
"properties" => $properties,
"groups" => [],
+ "public" => false,
+ "public_id" => uniqid("p"),
];
$game_data = $gamedb->insert($game_data);
diff --git a/interface.php b/interface.php
index 97500e8..977038c 100644
--- a/interface.php
+++ b/interface.php
@@ -220,6 +220,8 @@ switch ($action) {
$game_data["contributors"] = array_intersect($contributors, get_all_nicknames());
$game_data["properties"]["time_limit"] = $properties["time_limit"];
$game_data["properties"]["repeatable"] = $properties["repeatable"];
+
+ $game_data["public"] = $data["public"];
update_game($game_data);
// update game file if supplied
diff --git a/js/gamemgr.js b/js/gamemgr.js
index 876e973..f277da8 100644
--- a/js/gamemgr.js
+++ b/js/gamemgr.js
@@ -31,6 +31,10 @@ function list_all_games() {
});
}
+function get_full_hostname() {
+ return window.location.origin + window.location.pathname;
+}
+
var EDITED_GAME = null;
function create_edit_game(game = null) {
@@ -51,6 +55,8 @@ function create_edit_game(game = null) {
let time_limitedChk = document.getElementById("time_limited");
let time_limitF = document.getElementById("time_limit");
let repeatableChk = document.getElementById("repeatable");
+ let publicChk = document.getElementById("public");
+ let publicUrlF = document.getElementById("public_url");
if (!updating) { // creating a new game
nameF.value = "";
@@ -62,6 +68,8 @@ function create_edit_game(game = null) {
groupF.value = "";
time_limitedChk.checked = false;
repeatableChk.checked = true;
+ publicChk.checked = false;
+ publicUrlF.value = "";
// hide additional controls
hide("additional_controls");
@@ -74,6 +82,13 @@ function create_edit_game(game = null) {
contributorsF.value = game["contributors"].join(", ");
groupF.value = game["groups"].join(", ");
+ publicChk.addEventListener("change", () => {
+ publicUrlF.hidden = !publicChk.checked;
+ });
+ publicChk.checked = game["public"];
+ publicUrlF.hidden = !publicChk.checked;
+ publicUrlF.value = game["public_id"];
+
let props = game["properties"];
let time_limit = Math.max(Number(props["time_limit"]), 0);
time_limitF.value = seconds_to_time(time_limit);
@@ -114,6 +129,7 @@ function create_edit_game(game = null) {
owner: updating ? ownerF.value.trim() : USERDATA["nickname"],
contributors: contributorsF.value.trim(),
groups: groupF.value.trim(),
+ public: publicChk.checked,
properties: {
time_limit: updating ? (time_limitedChk.checked ? time_to_seconds(time_limitF.value) : 0) : 0,
repeatable: updating ? repeatableChk.checked : false
|