ios: Revise the iOS agreement somewhat.

This commit is contained in:
2025-11-02 20:30:17 -05:00
parent 7879ab1d50
commit 687665cd6b
5 changed files with 33 additions and 128 deletions

View File

@@ -1,6 +1,5 @@
#include "httpd.js.h"
#include "eula.h"
#include "file.js.h"
#include "http.h"
#include "log.h"
@@ -14,7 +13,6 @@
#include "sodium/crypto_sign.h"
#include "sodium/utils.h"
#include "zlib.h"
#if defined(__APPLE__)
#include <TargetConditionals.h>
@@ -25,6 +23,8 @@
#define YELLOW "\e[1;33m"
#define RESET "\e[0m"
static const int k_eula_version = 1;
static JSClassID _httpd_request_class_id;
typedef struct _http_user_data_t
@@ -645,12 +645,11 @@ static void _httpd_root_work(tf_ssb_t* ssb, void* user_data)
false;
#endif
int64_t accepted_eula_crc = 0;
uint32_t eula_crc = crc32(crc32(0, NULL, 0), k_eula, k_eula_len);
int64_t accepted_eula_version = 0;
sqlite3* db = tf_ssb_acquire_db_reader(ssb);
tf_ssb_db_get_global_setting_int64(db, "accepted_eula_crc", &accepted_eula_crc);
if (require_eula && accepted_eula_crc != eula_crc)
tf_ssb_db_get_global_setting_int64(db, "accepted_eula_version", &accepted_eula_version);
if (require_eula && accepted_eula_version != k_eula_version)
{
root->path = tf_strdup("/static/eula.html");
}
@@ -689,12 +688,11 @@ static void _httpd_endpoint_root(tf_http_request_t* request)
static void _httpd_accept_eula_work(tf_ssb_t* ssb, void* user_data)
{
uint32_t eula_crc = crc32(crc32(0, NULL, 0), k_eula, k_eula_len);
char buffer[64];
snprintf(buffer, sizeof(buffer), "%u", eula_crc);
snprintf(buffer, sizeof(buffer), "%d", k_eula_version);
sqlite3* db = tf_ssb_acquire_db_writer(ssb);
tf_ssb_db_set_global_setting_from_string(db, "accepted_eula_crc", buffer);
tf_ssb_db_set_global_setting_from_string(db, "accepted_eula_version", buffer);
tf_ssb_release_db_writer(ssb, db);
}