1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 04:34:43 +04:00

JS CLI command (#3539)

* js command
* made the js command exit when there's an error
* JS CLI: moved to js_app
* JS: abortable cli invocations
* JS: less debug logging in console logs, fix storage descriptor leak in cli

Co-authored-by: Milk-Cool <milan-pl@mail.ru>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov
2024-03-25 19:35:38 +03:00
committed by GitHub
parent bb439a9761
commit 84beb9b23e
5 changed files with 98 additions and 4 deletions

View File

@@ -5,6 +5,9 @@
#define TAG "JS modules"
// Absolute path is used to make possible plugin load from CLI
#define MODULES_PATH "/ext/apps_data/js_app/plugins"
typedef struct {
JsModeConstructor create;
JsModeDestructor destroy;
@@ -81,7 +84,7 @@ mjs_val_t js_module_require(JsModules* modules, const char* name, size_t name_le
// External module load
if(!module_found) {
FuriString* module_path = furi_string_alloc();
furi_string_printf(module_path, "%s/js_%s.fal", APP_DATA_PATH("plugins"), name);
furi_string_printf(module_path, "%s/js_%s.fal", MODULES_PATH, name);
FURI_LOG_I(TAG, "Loading external module %s", furi_string_get_cstr(module_path));
do {
uint32_t plugin_cnt_last = plugin_manager_get_count(modules->plugin_manager);