diff --git a/Makefile b/Makefile index b6497bbe..2bee340d 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,8 @@ MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules PROJECT = tildefriends +VERSION_NUMBER := 0.0.8 +VERSION_NAME := The secret ingredient is love. BUILD_DIR ?= out BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64 UNAME_M := $(shell uname -m) @@ -432,6 +434,10 @@ endef $(foreach build_type,$(BUILD_TYPES),$(eval $(call build_rules,$(build_type)))) +src/version.h : $(firstword $(MAKEFILE_LIST)) + @echo [version] $@ + @echo "#define VERSION_NUMBER \"$(VERSION_NUMBER)\"\n#define VERSION_NAME \"$(VERSION_NAME)\"\n" > $@ + # Android support. out/res/layout_activity_main.xml.flat: src/android/res/layout/activity_main.xml @mkdir -p $(dir $@) diff --git a/core/client.js b/core/client.js index 003b4c6f..c3da6b3c 100644 --- a/core/client.js +++ b/core/client.js @@ -52,6 +52,8 @@ class TfNavigationElement extends LitElement { show_permissions: {type: Boolean}, status: {type: Object}, spark_lines: {type: Object}, + version: {type: Object}, + show_version: {type: Boolean}, }; } @@ -128,7 +130,8 @@ class TfNavigationElement extends LitElement { ${k_global_style}
- 😎 + this.show_version = !this.show_version}>😎 + ${this.version?.number} TF apps edit @@ -768,6 +771,7 @@ function _receive_websocket_message(message) { if (window.location.hash) { send({event: "hashChange", hash: window.location.hash}); } + document.getElementsByTagName('tf-navigation')[0].version = message.version; send({action: 'enableStats', enabled: true}); } else if (message && message.action == "ping") { send({action: "pong"}); diff --git a/core/core.js b/core/core.js index fa743424..9129d374 100644 --- a/core/core.js +++ b/core/core.js @@ -456,7 +456,7 @@ async function getProcessBlob(blobId, key, options) { } broadcastEvent('onSessionBegin', [getUser(process, process)]); if (process.app) { - process.app.send({action: "ready"}); + process.app.send({action: "ready", version: version()}); process.sendPermissions(); } await process.task.execute({name: appSourceName, source: appSource}); diff --git a/src/task.c b/src/task.c index eff51dd8..0f3b6cb3 100644 --- a/src/task.c +++ b/src/task.c @@ -14,6 +14,7 @@ #include "tlscontext.js.h" #include "trace.h" #include "util.js.h" +#include "version.h" #include "backtrace.h" #include "quickjs.h" @@ -35,8 +36,6 @@ #define _countof(a) ((int)(sizeof((a)) / sizeof(*(a)))) #endif -static const char* k_version = "1.0"; - static JSClassID _import_class_id; static int _count; @@ -675,9 +674,11 @@ static JSValue _tf_task_version(JSContext* context, JSValueConst this_val, int a { tf_task_t* task = JS_GetContextOpaque(context); tf_trace_begin(task->_trace, __func__); - JSValue result = JS_NewString(task->_context, k_version); + JSValue version = JS_NewObject(context); + JS_SetPropertyStr(context, version, "number", JS_NewString(context, VERSION_NUMBER)); + JS_SetPropertyStr(context, version, "name", JS_NewString(context, VERSION_NAME)); tf_trace_end(task->_trace); - return result; + return version; } exportid_t tf_task_export_function(tf_task_t* task, tf_taskstub_t* to, JSValue function) diff --git a/src/version.h b/src/version.h new file mode 100644 index 00000000..8690f9f8 --- /dev/null +++ b/src/version.h @@ -0,0 +1,3 @@ +#define VERSION_NUMBER "0.0.8" +#define VERSION_NAME "The secret ingredient is love." + diff --git a/tools/release.sh b/tools/release.sh index 46939212..c148b0f9 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,10 +1,10 @@ #!/bin/bash -VERSION=$1 -NICKNAME=$2 -rm -rfv tildefriends-$VERSION -svn export . tildefriends-$VERSION -echo "tildefriends-$VERSION: $NICKNAME" > tildefriends-$VERSION/VERSION +VERSION_NUMBER=`sed -n -e 's/^VERSION_NUMBER := //p' Makefile` +VERSION_NAME=`sed -n -e 's/^VERSION_NAME := //p' Makefile` +rm -rfv tildefriends-$VERSION_NUMBER +svn export . tildefriends-$VERSION_NUMBER +echo "tildefriends-$VERSION_NUMBER: $VERSION_NAME" > tildefriends-$VERSION_NUMBER/VERSION tar \ --exclude=deps/libbacktrace/Isaac.Newton-Opticks.txt \ --exclude=deps/libsodium/builds \ @@ -17,5 +17,5 @@ tar \ --exclude=deps/sqlite/shell.c \ --exclude=deps/zlib/contrib/vstudio \ --exclude=deps/zlib/doc \ - -caf tildefriends-$VERSION.tar.xz tildefriends-$VERSION -rm -rfv tildefriends-$VERSION + -caf tildefriends-$VERSION_NUMBER.tar.xz tildefriends-$VERSION_NUMBER +rm -rfv tildefriends-$VERSION_NUMBER