From 0b5017b20865d1b2433c817b8380db4ca8747a5b Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 17 Jan 2022 22:00:42 +0000 Subject: [PATCH] Import stock apps into /~core/ at launch. Makes the first time experience vaguely work with only running and clicking in the web interface. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3774 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/core.js | 2 +- src/main.c | 1 + src/task.c | 5 +++++ src/task.h | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/core.js b/core/core.js index 38faed93..f82879fa 100644 --- a/core/core.js +++ b/core/core.js @@ -11,7 +11,7 @@ var gProcesses = {}; var gSessionIndex = 0; var gGlobalSettings = { - index: "/~cory/index", + index: "/~core/index", }; var kGlobalSettingsFile = "data/global/settings.json"; diff --git a/src/main.c b/src/main.c index 1a31182b..42d008fb 100644 --- a/src/main.c +++ b/src/main.c @@ -341,6 +341,7 @@ static int _tf_run_task(const tf_run_args_t* args, int index) tf_task_set_db_path(task, db_path); tf_task_set_secrets_path(task, secrets_path); tf_task_activate(task); + tf_ssb_import(tf_task_get_ssb(task), "core", "apps"); if (tf_task_execute(task, args->script)) { tf_task_run(task); diff --git a/src/task.c b/src/task.c index 374e51f5..f25146c9 100644 --- a/src/task.c +++ b/src/task.c @@ -1407,6 +1407,11 @@ JSContext* tf_task_get_context(tf_task_t* task) return task->_context; } +tf_ssb_t* tf_task_get_ssb(tf_task_t* task) +{ + return task->_ssb; +} + static void _tf_task_on_handle_close(uv_handle_t* handle) { handle->data = NULL; diff --git a/src/task.h b/src/task.h index a1ba7ee2..4c03cce5 100644 --- a/src/task.h +++ b/src/task.h @@ -14,6 +14,7 @@ typedef int exportid_t; typedef struct _tf_taskstub_t tf_taskstub_t; typedef struct _tf_task_t tf_task_t; typedef struct _tf_trace_t tf_trace_t; +typedef struct _tf_ssb_t tf_ssb_t; static const taskid_t k_task_parent_id = 0; @@ -53,6 +54,7 @@ JSValue tf_task_add_import(tf_task_t* task, taskid_t stub_id, exportid_t export_ uv_loop_t* tf_task_get_loop(tf_task_t* task); tf_task_t* tf_task_get(JSContext* context); tf_trace_t* tf_task_get_trace(tf_task_t* task); +tf_ssb_t* tf_task_get_ssb(tf_task_t* task); void tf_task_run_jobs(tf_task_t* task); const char* tf_task_get_name(tf_task_t* task);