Include slightly more future-proof target type in user agent string

This commit is contained in:
Tamás Bálint Misius 2022-02-22 08:08:53 +01:00
parent 1e440d078c
commit bfe94618c6
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
7 changed files with 13 additions and 3 deletions

View File

@ -31,7 +31,7 @@ const char *const introTextData =
"\brThis is a BETA, you cannot save things publicly. If you are planning on publishing any saves, use the release version\n"
#endif
"\n"
"\bt" MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) "." MTOS(BUILD_NUM) " " IDENT_PLATFORM
"\bt" MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) "." MTOS(BUILD_NUM) " " IDENT
#ifdef SNAPSHOT
" SNAPSHOT " MTOS(SNAPSHOT_ID)
#elif MOD_ID > 0

View File

@ -301,6 +301,7 @@ conf_data.set('SNAPSHOT_ID', get_option('snapshot_id'))
conf_data.set('SERVER', '"' + get_option('server') + '"')
conf_data.set('STATICSERVER', '"' + get_option('static_server') + '"')
conf_data.set('IDENT_PLATFORM', '"' + copt_identplatform + '"')
conf_data.set('IDENT', '"@0@-@1@-@2@"'.format(copt_architecture, copt_platform, copt_compiler).to_upper())
if get_option('update_server') != ''
conf_data.set('UPDATESERVER', '"' + get_option('update_server') + '"')

View File

@ -45,7 +45,7 @@ option(
'snapshot_id',
type: 'integer',
min: 0,
value: 199,
value: 0,
description: 'Snapshot ID, only relevant if \'snapshot\' is true'
)
option(

View File

@ -31,6 +31,7 @@
#mesondefine STATICSERVER
#mesondefine UPDATESERVER
#mesondefine IDENT_PLATFORM
#mesondefine IDENT
#ifdef WIN
# define PATH_SEP "\\"

View File

@ -46,7 +46,7 @@ namespace http
proxy = Proxy;
user_agent = ByteString::Build("PowderToy/", SAVE_VERSION, ".", MINOR_VERSION, " (", IDENT_PLATFORM, "; ", IDENT_BUILD, "; M", MOD_ID, ") TPTPP/", SAVE_VERSION, ".", MINOR_VERSION, ".", BUILD_NUM, IDENT_RELTYPE, ".", SNAPSHOT_ID);
user_agent = "PowderToy/" MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) " (" IDENT_PLATFORM "; " IDENT_BUILD "; M" MTOS(MOD_ID) "; " IDENT ") TPTPP/" MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) "." MTOS(BUILD_NUM) IDENT_RELTYPE "." MTOS(SNAPSHOT_ID);
worker_thread = std::thread([this]() { Worker(); });
initialized = true;

View File

@ -3753,6 +3753,7 @@ void LuaScriptInterface::initPlatformAPI()
//Methods
struct luaL_Reg platformAPIMethods [] = {
{"platform", platform_platform},
{"ident", platform_ident},
{"build", platform_build},
{"releaseType", platform_releaseType},
{"exeName", platform_exeName},
@ -3775,6 +3776,12 @@ int LuaScriptInterface::platform_platform(lua_State * l)
return 1;
}
int LuaScriptInterface::platform_ident(lua_State * l)
{
lua_pushstring(l, IDENT);
return 1;
}
int LuaScriptInterface::platform_build(lua_State * l)
{
lua_pushstring(l, IDENT_BUILD);

View File

@ -175,6 +175,7 @@ class LuaScriptInterface: public CommandInterface
void initPlatformAPI();
static int platform_platform(lua_State * l);
static int platform_ident(lua_State * l);
static int platform_build(lua_State * l);
static int platform_releaseType(lua_State * l);
static int platform_exeName(lua_State * l);