Set some blob auto-delete option defaults on android only.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4383 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-08-04 23:35:02 +00:00
parent 9506f518c2
commit 0573008c9c
2 changed files with 17 additions and 2 deletions

View File

@ -74,12 +74,12 @@ const k_global_settings = {
},
blob_fetch_age_seconds: {
type: 'integer',
default_value: undefined,
default_value: (platform() == 'android' ? 0.5 * 365 * 24 * 60 * 60 : undefined),
description: 'Only blobs mentioned more recently than this age will be automatically fetched.',
},
blob_expire_age_seconds: {
type: 'integer',
default_value: undefined,
default_value: (platform() == 'android' ? 1.0 * 365 * 24 * 60 * 60 : undefined),
description: 'Blobs older than this will be automatically deleted.',
},
};

View File

@ -175,6 +175,7 @@ static bool _export_record_release(tf_task_t* task, export_record_t** export)
}
static JSValue _tf_task_version(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv);
static JSValue _tf_task_platform(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv);
static JSValue _tf_task_get_parent(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv);
static JSValue _tf_task_exit(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv);
static JSValue _tf_task_trace(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv);
@ -694,6 +695,19 @@ static JSValue _tf_task_version(JSContext* context, JSValueConst this_val, int a
return version;
}
static JSValue _tf_task_platform(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
{
#if defined(_WIN32)
return JS_NewString(context, "windows");
#elif defined(__ANDROID__)
return JS_NewString(context, "android");
#elif defined(__linux__)
return JS_NewString(context, "linux");
#else
return JS_NewString(context, "other");
#endif
}
exportid_t tf_task_export_function(tf_task_t* task, tf_taskstub_t* to, JSValue function)
{
export_record_t* export = NULL;
@ -1725,6 +1739,7 @@ void tf_task_activate(tf_task_t* task)
tf_util_register(context);
JS_SetPropertyStr(context, global, "exit", JS_NewCFunction(context, _tf_task_exit, "exit", 1));
JS_SetPropertyStr(context, global, "version", JS_NewCFunction(context, _tf_task_version, "version", 0));
JS_SetPropertyStr(context, global, "platform", JS_NewCFunction(context, _tf_task_platform, "platform", 0));
JS_SetPropertyStr(context, global, "getFile", JS_NewCFunction(context, _tf_task_getFile, "getFile", 1));
JS_FreeValue(context, global);
}