Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion resources/js/admin/script-executors/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import ScriptExecutors from "./ScriptExecutors";
import Pusher from "pusher-js";
import Echo from "laravel-echo";
import ScriptExecutors from "./ScriptExecutors.vue";
import { setGlobalVariables } from "../../next/globalVariables";

if (Processmaker && Processmaker.script_microservice && Processmaker.script_microservice.enabled) {
const config = Processmaker.script_microservice.broadcasting;

setGlobalVariables({
ScriptMicroserviceEcho: new Echo({
...config,
client: new Pusher(config.key, config),
}),
});
}

new Vue({
el: "#script-executors",
Expand Down
19 changes: 19 additions & 0 deletions resources/views/admin/script-executors/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@

@section('js')
<script>
if (!!{{ config('script-runner-microservice.enabled') }}) {
window.Processmaker.script_microservice = {
enabled : {{ config('script-runner-microservice.enabled', false) }},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabled microservice breaks inline script

Medium Severity

Blade prints a boolean false as an empty string, so script-runner-microservice.enabled being off yields invalid JavaScript (if (!!) and enabled : ,). That parse error aborts the whole inline script, including the packages setup that follows. The original layout avoided this with a Blade @if so the block was omitted when the microservice is disabled.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e5a2002. Configure here.

broadcasting : {
broadcaster: "pusher",
key: "{{config('script-runner-microservice.broadcasting.app_key')}}",
cluster: "{{config('script-runner-microservice.broadcasting.cluster')}}",
forceTLS: {{config('script-runner-microservice.broadcasting.scheme') === 'https' ? 'true' : 'false'}},
enabledTransports: ['ws', 'wss'],
disableStats: true,
}
};
const broadcastingHost = "{{config('script-runner-microservice.broadcasting.host')}}";
if (broadcastingHost !== "") {
window.Processmaker.script_microservice.broadcasting.wsHost = "{{config('script-runner-microservice.broadcasting.host')}}";
window.Processmaker.script_microservice.broadcasting.wsPort = "{{config('script-runner-microservice.broadcasting.port')}}";
window.Processmaker.script_microservice.broadcasting.wssPort = "{{config('script-runner-microservice.broadcasting.port')}}";
}
}
window.temporal = window.temporal || {};
window.temporal.packages = @json(\App::make(ProcessMaker\Managers\PackageManager::class)->listPackages());
window.packages = @json(\App::make(ProcessMaker\Managers\PackageManager::class)->listPackages());
Expand Down
Loading