conversejs / converse.js

Web-based XMPP/Jabber chat client written in JavaScript
http://conversejs.org
Mozilla Public License 2.0
3.08k stars 772 forks source link

Some adhoc commands aren't working (no action on click) #3155

Closed roughnecks closed 6 months ago

roughnecks commented 1 year ago

Describe the bug Some adhoc commands aren't working. If I click on the command nothing happens

To Reproduce Steps to reproduce the behavior:

  1. Go to the cog icon on the top left of the screen, near your username and click it
  2. Click on 'commands' button
  3. Write your domain.tld (it auto fills)
  4. Click an any of those commands (see screenshot)

Expected behavior A form should display to be filled and get some output results

Screenshots image

Environment (please complete the following information):

citronalco commented 1 year ago

Same here. "Archive settings" and "Search Settings" work. "Get uptime", "Create new contact invite" do not work

Here's what's on the browser console for "Get uptime": (Firefox 109.0)

 ERROR: Error while trying to execute command for bytewerk.org log.js:64:19
 ERROR: lp@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:527305
fetchCommandForm@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:527919
async*toggleCommandForm@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:427:10853
2440/V_/<@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:75:30
handleEvent@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:380430
EventListener.handleEvent*_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:380321
p@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:376696
$@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:378010
_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377410
k@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:378297
_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377456
p@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:376696
$@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:378010
_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377410
p@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:376696
$@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377955
_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377410
lh@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:381194
update@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:381601
performUpdate@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:371668
scheduleUpdate@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:371315
_$Ej@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:371223
async*requestUpdate@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:371118
set@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:367817
fetchCommands@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:427:10313
async*handleEvent@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:380430
EventListener.handleEvent*_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:380321
p@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:376696
$@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:378010
_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377410
lh@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:381194
update@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:381601
performUpdate@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:371668
scheduleUpdate@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:371315
_$Ej@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:371223
async*requestUpdate@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:371118
u@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:368798
Eu@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:367084
hh@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:381249
Vy@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:9:43097
@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:427:9918
v@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:376267
$@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377992
_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377410
p@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:376696
$@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:378010
_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377410
p@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:376696
$@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:378010
_$AI@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:377410
lh@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:2:381194
render@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:9:49813
initialize@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:9:51453
connectedCallback@https://xmpp.bytewerk.org/conversejs/dist/converse.min.js:9:49574
log.js:64:19
    log log.js:64
    error log.js:81
    fetchCommandForm api.js:58
    toggleCommandForm adhoc-commands.js:80
    V_ ad-hoc-command.js:8
    handleEvent lit-html.ts:2003
    (Async: EventListener.handleEvent)
    _$AI lit-html.ts:1992
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    k lit-html.ts:1603
    _$AI lit-html.ts:1394
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    p lit-html.ts:1181
    $ lit-html.ts:1525
    _$AI lit-html.ts:1375
    lh lit-html.ts:2169
    update lit-element.ts:165
    performUpdate reactive-element.ts:1331
    scheduleUpdate reactive-element.ts:1263
    _$Ej reactive-element.ts:1235
    requestUpdate reactive-element.ts:1210
    set reactive-element.ts:726
    fetchCommands adhoc-commands.js:56
    handleEvent lit-html.ts:2003
    (Async: EventListener.handleEvent)
    _$AI lit-html.ts:1992
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    lh lit-html.ts:2169
    update lit-element.ts:165
    performUpdate reactive-element.ts:1331
    scheduleUpdate reactive-element.ts:1263
    _$Ej reactive-element.ts:1235
    requestUpdate reactive-element.ts:1210
    u reactive-element.ts:948
    Eu reactive-element.ts:931
    hh lit-element.ts:115
    Vy element.js:5
    <anonym> adhoc-commands.js:25
    v lit-html.ts:1122
    $ lit-html.ts:1528
    _$AI lit-html.ts:1375
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    lh lit-html.ts:2169
    render element.js:70
    initialize modal.js:28
    connectedCallback element.js:45
Uncaught (in promise) TypeError: t.actions is undefined
    V_ converse.min.js:96
    V_ ad-hoc-command.js:15
    Lb ad-hoc.js:40
    Lb ad-hoc.js:40
    render adhoc-commands.js:33
    update lit-element.ts:160
    performUpdate reactive-element.ts:1331
    scheduleUpdate reactive-element.ts:1263
    _$Ej reactive-element.ts:1235
converse.min.js:96:1
Uncaught (in promise) TypeError: t.actions is undefined
    V_ converse.min.js:96
    V_ ad-hoc-command.js:15
    Lb ad-hoc.js:40
    Lb ad-hoc.js:40
    render adhoc-commands.js:33
    update lit-element.ts:160
    performUpdate reactive-element.ts:1331
    scheduleUpdate reactive-element.ts:1263
    _$Ej reactive-element.ts:1235
    requestUpdate reactive-element.ts:1210
    set reactive-element.ts:726
    toggleCommandForm adhoc-commands.js:85
    V_ ad-hoc-command.js:8
    handleEvent lit-html.ts:2003
    _$AI lit-html.ts:1992
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    k lit-html.ts:1603
    _$AI lit-html.ts:1394
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    p lit-html.ts:1181
    $ lit-html.ts:1525
    _$AI lit-html.ts:1375
    lh lit-html.ts:2169
    update lit-element.ts:165
    performUpdate reactive-element.ts:1331
    scheduleUpdate reactive-element.ts:1263
    _$Ej reactive-element.ts:1235
    requestUpdate reactive-element.ts:1210
    set reactive-element.ts:726
    fetchCommands adhoc-commands.js:56
    handleEvent lit-html.ts:2003
    _$AI lit-html.ts:1992
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    lh lit-html.ts:2169
    update lit-element.ts:165
    performUpdate reactive-element.ts:1331
    scheduleUpdate reactive-element.ts:1263
    _$Ej reactive-element.ts:1235
    requestUpdate reactive-element.ts:1210
    u reactive-element.ts:948
    Eu reactive-element.ts:931
    hh lit-element.ts:115
    Vy element.js:5
    <anonymous> adhoc-commands.js:25
    v lit-html.ts:1122
    $ lit-html.ts:1528
    _$AI lit-html.ts:1375
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    p lit-html.ts:1181
    $ lit-html.ts:1538
    _$AI lit-html.ts:1375
    lh lit-html.ts:2169
    render element.js:70
    initialize modal.js:28
    connectedCallback element.js:45
converse.min.js:96:1
BetaRays commented 7 months ago

I encountered a similar behavior with Prosody’s “Create new account invite” adhoc command, which seems to be defined in https://hg.prosody.im/0.12/file/tip/plugins/mod_invites_adhoc.lua.

Maybe Converse.js doesn’t currently handle adhoc commands that don’t include an <actions/> element? https://xmpp.org/extensions/xep-0050.html#impl-actions

BetaRays commented 7 months ago

As expected, Converse.js assumes all ad-hoc commands are multistage, unlike these examples in the XEP: https://xmpp.org/extensions/xep-0050.html#execute-simple. This includes Prosody’s “Get uptime” command, which just replies with a <note> of type info, and no form data.

More specifically, clicking on a command in the command list calls the toggleCommandForm function on its view. This method calls api.adhoc.fetchCommandForm, (which uses getCommandFields to get instructions and fields from the form that will need to be completed (type=form only, not type=result, …)), and sets the form to be displayed by the ad-hoc-command-form.js template, which includes the offending line.

BetaRays commented 7 months ago

I see that getCommandFields also fails (this is the first error that is logged), which causes fetchCommandForm to enter this part of the code, which is also supposed to show an explicit error by returning a form with no fields and an error message in the instructions. This form, however, doesn’t include actions, which makes the ad-hoc-command-form.js template fail.

BetaRays commented 7 months ago

Even when the command initially provides a form to fill, Converse.js doesn’t show neither jabber:x:data results, nor notes.