diff --git a/app/src/server.c b/app/src/server.c index c02390a4..712a6f4a 100644 --- a/app/src/server.c +++ b/app/src/server.c @@ -93,6 +93,7 @@ sc_server_params_copy(struct sc_server_params *dst, COPY(crop); COPY(codec_options); COPY(encoder_name); + COPY(hook_script); COPY(tcpip_dst); #undef COPY @@ -233,6 +234,23 @@ execute_server(struct sc_server *server, if (params->encoder_name) { ADD_PARAM("encoder_name=%s", params->encoder_name); } + if (params->hook_script) { + char* requoted_hook; + int64_t replace_result = sc_str_find_replace(params->hook_script, "'", "'\"'\"'", &requoted_hook); + switch(replace_result){ + case -2: + LOG_OOM(); + break; + case -1: + case 0: + ADD_PARAM("hook_script='%s'", params->hook_script); + break; + default: + ADD_PARAM("hook_script='%s'", requoted_hook); + free(requoted_hook); + } + + } if (params->power_off_on_close) { ADD_PARAM("power_off_on_close=true"); } diff --git a/app/src/server.h b/app/src/server.h index 5f630ca8..cf52e963 100644 --- a/app/src/server.h +++ b/app/src/server.h @@ -39,6 +39,7 @@ struct sc_server_params { bool show_touches; bool stay_awake; bool force_adb_forward; + const char * hook_script; bool power_off_on_close; bool clipboard_autosync; bool downsize_on_error;