Count worlds instance

This commit is contained in:
sladecraven 2022-01-30 16:11:20 +01:00
parent 67b4070c27
commit 167a3d5894
1 changed files with 24 additions and 0 deletions

View File

@ -217,6 +217,28 @@ function messageDeBienvenue() {
}
}
/* -------------------------------------------- */
// Register world usage statistics
function registerUsageCount( registerKey ) {
if ( game.user.isGM ) {
game.settings.register(registerKey, "world-key", {
name: "Unique world key",
scope: "world",
config: false,
type: String
});
let worldKey = game.settings.get(registerKey, "world-key")
if ( worldKey == undefined || worldKey == "" ) {
worldKey = randomID(32)
game.settings.set(registerKey, "world-key", worldKey )
}
// Simple API counter
$.ajax(`https://jdr.lahiette.com/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.data.version}"`)
/* -------------------------------------------- */
}
}
/* -------------------------------------------- */
/* Foundry VTT Initialization */
/* -------------------------------------------- */
@ -246,6 +268,7 @@ Hooks.once("ready", async function () {
}
if (Misc.isUniqueConnectedGM()) {
messageDeBienvenue();
registerUsageCount( SYSTEM_RDD );
}
});
@ -282,6 +305,7 @@ async function migrationPngWebp_1_5_34() {
let sidebar = document.getElementById("sidebar");
sidebar.style.width = "min-content";
}
}
/* -------------------------------------------- */