Index: ps/trunk/binaries/data/config/default.cfg
===================================================================
--- ps/trunk/binaries/data/config/default.cfg
+++ ps/trunk/binaries/data/config/default.cfg
@@ -438,6 +438,7 @@
[modio]
public_key = "RWQBhIRg+dOifTWlwgYHe8RfD8bqoDh1cCvygboAl3GOUKiCo0NlF4fw" ; Public key corresponding to the private key valid mods are signed with
+disclaimer = "0" ; Version (hash) of the Disclaimer that the user has accepted
[modio.v1]
baseurl = "https://api.mod.io/v1"
@@ -476,6 +477,7 @@
[userreport] ; Opt-in online user reporting system
url = "http://feedback.wildfiregames.com/report/upload/v1/"
+terms = "0" ; Version (hash) of the UserReporter Terms that the user has accepted
[view] ; Camera control settings
scroll.speed = 120.0
Index: ps/trunk/binaries/data/mods/mod/gui/common/terms.js
===================================================================
--- ps/trunk/binaries/data/mods/mod/gui/common/terms.js
+++ ps/trunk/binaries/data/mods/mod/gui/common/terms.js
@@ -0,0 +1,51 @@
+var g_Terms = {};
+
+function initTerms(terms)
+{
+ g_Terms = terms;
+}
+
+function openTerms(page)
+{
+ Engine.PushGuiPage("page_termsdialog.xml", {
+ "file": g_Terms[page].file,
+ "title": g_Terms[page].title,
+ "buttons": g_Terms[page].buttons || [],
+ "page": page,
+ "callback": "acceptTerms"
+ });
+}
+
+function acceptTerms(data)
+{
+ g_Terms[data.page].accepted = data.accepted;
+
+ let value = data.accepted ? getTermsHash(data.page) : "0";
+ Engine.ConfigDB_CreateValue("user", g_Terms[data.page].config, value);
+ Engine.ConfigDB_WriteValueToFile("user", g_Terms[data.page].config, value, "config/user.cfg");
+
+ if (g_Terms[data.page].callback)
+ g_Terms[data.page].callback(data);
+}
+
+function checkTerms()
+{
+ for (let page in g_Terms)
+ if (!g_Terms[page].accepted)
+ return g_Terms[page].instruction || page;
+
+ return "";
+}
+
+function getTermsHash(page)
+{
+ return Engine.CalculateMD5(
+ (g_Terms[page].salt ? g_Terms[page].salt() : "") +
+ (Engine.FileExists(g_Terms[page].file) ? Engine.ReadFile(g_Terms[page].file) : g_Terms[page].file));
+}
+
+function loadTermsAcceptance()
+{
+ for (let page in g_Terms)
+ g_Terms[page].accepted = Engine.ConfigDB_GetValue("user", g_Terms[page].config) == getTermsHash(page);
+}
Index: ps/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
===================================================================
--- ps/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
+++ ps/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
@@ -60,6 +60,7 @@
function init(data, hotloadData)
{
g_InstalledMods = data && data.installedMods || hotloadData && hotloadData.installedMods || [];
+
initMods();
initGUIButtons(data);
}
@@ -305,23 +306,6 @@
(!operator || versionSatisfied(g_Mods[folder].version, operator[0], version)));
}
-function modIo()
-{
- messageBox(500, 250,
- translate("You are about to connect to the mod.io online service. This provides easy access to community-made mods, but is not under the control of Wildfire Games.\n\nWhile we have taken care to make this secure, we cannot guarantee with absolute certainty that this is not a security risk.\n\nDo you really want to connect?"),
- translate("Connect to mod.io?"),
- [translate("Cancel"), translateWithContext("mod.io connection message box", "Connect")],
- [
- null,
- () => {
- Engine.PushGuiPage("page_modio.xml", {
- "callback": "initMods"
- });
- }
- ]
- );
-}
-
/**
* Compares the given versions using the given operator.
* '-' or '_' is ignored. Only numbers are supported.
Index: ps/trunk/binaries/data/mods/mod/gui/modmod/modmod.xml
===================================================================
--- ps/trunk/binaries/data/mods/mod/gui/modmod/modmod.xml
+++ ps/trunk/binaries/data/mods/mod/gui/modmod/modmod.xml
@@ -192,7 +192,7 @@