annotate mod_admin_web/admin_web/www_files/js/main.js @ 6257:fa45ae704b79

mod_cloud_notify: Update Readme diff --git a/mod_cloud_notify/README.md b/mod_cloud_notify/README.md --- a/mod_cloud_notify/README.md +++ b/mod_cloud_notify/README.md @@ -1,109 +1,106 @@ ---- -labels: -- 'Stage-Beta' -summary: 'XEP-0357: Cloud push notifications' ---- +# Introduction -Introduction -============ +This module enables support for sending "push notifications" to clients +that need it, typically those running on certain mobile devices. -This module enables support for sending "push notifications" to clients that -need it, typically those running on certain mobile devices. +As well as this module, your client must support push notifications (the +apps that need it generally do, of course) and the app developer's push +gateway must be reachable from your Prosody server (this happens over a +normal XMPP server-to-server 's2s' connection). -As well as this module, your client must support push notifications (the apps -that need it generally do, of course) and the app developer's push gateway -must be reachable from your Prosody server (this happens over a normal XMPP -server-to-server 's2s' connection). - -Details -======= +# Details Some platforms, notably Apple's iOS and many versions of Android, impose -limits that prevent applications from running or accessing the network in the -background. This makes it difficult or impossible for an XMPP application to -remain reliably connected to a server to receive messages. - -In order for messaging and other apps to receive notifications, the OS vendors -run proprietary servers that their OS maintains a permanent connection to in -the background. Then they provide APIs to application developers that allow -sending notifications to specific devices via those servers. +limits that prevent applications from running or accessing the network +in the background. This makes it difficult or impossible for an XMPP +application to remain reliably connected to a server to receive +messages. -When you connect to your server with an app that requires push notifications, -it will use this module to set up a "push registration". When you receive -a message but your device is not connected to the server, this module will -generate a notification and send it to the push gateway operated by your -application's developers). Their gateway will then connect to your device's -OS vendor and ask them to forward the notification to your device. When your -device receives the notification, it will display it or wake up the app so it -can connect to XMPP and receive any pending messages. +In order for messaging and other apps to receive notifications, the OS +vendors run proprietary servers that their OS maintains a permanent +connection to in the background. Then they provide APIs to application +developers that allow sending notifications to specific devices via +those servers. -This protocol is described for developers in [XEP-0357: Push Notifications]. +When you connect to your server with an app that requires push +notifications, it will use this module to set up a "push registration". +When you receive a message but your device is not connected to the +server, this module will generate a notification and send it to the push +gateway operated by your application's developers). Their gateway will +then connect to your device's OS vendor and ask them to forward the +notification to your device. When your device receives the notification, +it will display it or wake up the app so it can connect to XMPP and +receive any pending messages. -For this module to work reliably, you must have [mod_smacks], [mod_mam] and -[mod_carbons] also enabled on your server. +This protocol is described for developers in \[XEP-0357: Push +Notifications\]. + +For this module to work reliably, you must have \[mod_smacks\], +\[mod_mam\] and \[mod_carbons\] also enabled on your server. -Some clients, notably Siskin and Snikket iOS need some additional extensions -that are not currently defined in a standard XEP. To support these clients, -see [mod_cloud_notify_extensions]. +Some clients, notably Siskin and Snikket iOS need some additional +extensions that are not currently defined in a standard XEP. To support +these clients, see \[mod_cloud_notify_extensions\]. -Configuration -============= +# Configuration - Option Default Description - ------------------------------------ ----------------- ------------------------------------------------------------------------------------------------------------------- - `push_notification_important_body` `New Message!` The body text to use when the stanza is important (see above), no message body is sent if this is empty - `push_max_errors` `16` How much persistent push errors are tolerated before notifications for the identifier in question are disabled - `push_max_devices` `5` The number of allowed devices per user (the oldest devices are automatically removed if this threshold is reached) - `push_max_hibernation_timeout` `259200` (72h) Number of seconds to extend the smacks timeout if no push was triggered yet (default: 72 hours) - `push_notification_with_body` (\*) `false` Whether or not to send the real message body to remote pubsub node. Without end-to-end encryption, enabling this may expose your message contents to your client developers and OS vendor. Not recommended. - `push_notification_with_sender` (\*) `false` Whether or not to send the real message sender to remote pubsub node. Enabling this may expose your contacts to your client developers and OS vendor. Not recommended. + Option Default Description + -------------------------------------- ---------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + `push_notification_important_body` `New Message!` The body text to use when the stanza is important (see above), no message body is sent if this is empty + `push_max_errors` `16` How much persistent push errors are tolerated before notifications for the identifier in question are disabled + `push_max_devices` `5` The number of allowed devices per user (the oldest devices are automatically removed if this threshold is reached) + `push_max_hibernation_timeout` `259200` (72h) Number of seconds to extend the smacks timeout if no push was triggered yet (default: 72 hours) + `push_notification_with_body` (\*) `false` Whether or not to send the real message body to remote pubsub node. Without end-to-end encryption, enabling this may expose your message contents to your client developers and OS vendor. Not recommended. + `push_notification_with_sender` (\*) `false` Whether or not to send the real message sender to remote pubsub node. Enabling this may expose your contacts to your client developers and OS vendor. Not recommended. -(\*) There are privacy implications for enabling these options. +(\*) There are privacy implications for enabling these options.[^1] -Internal design notes -===================== +# Internal design notes -App servers are notified about offline messages, messages stored by [mod_mam] -or messages waiting in the smacks queue. -The business rules outlined [here](//mail.jabber.org/pipermail/standards/2016-February/030925.html) are all honored[^2]. +App servers are notified about offline messages, messages stored by +\[mod_mam\] or messages waiting in the smacks queue. The business rules +outlined +[here](//mail.jabber.org/pipermail/standards/2016-February/030925.html) +are all honored[^2]. -To cooperate with [mod_smacks] this module consumes some events: -`smacks-ack-delayed`, `smacks-hibernation-start` and `smacks-hibernation-end`. -These events allow this module to send out notifications for messages received -while the session is hibernated by [mod_smacks] or even when smacks -acknowledgements for messages are delayed by a certain amount of seconds -configurable with the [mod_smacks] setting `smacks_max_ack_delay`. +To cooperate with \[mod_smacks\] this module consumes some events: +`smacks-ack-delayed`, `smacks-hibernation-start` and +`smacks-hibernation-end`. These events allow this module to send out +notifications for messages received while the session is hibernated by +\[mod_smacks\] or even when smacks acknowledgements for messages are +delayed by a certain amount of seconds configurable with the +\[mod_smacks\] setting `smacks_max_ack_delay`. -The `smacks_max_ack_delay` setting allows to send out notifications to clients -which aren't already in smacks hibernation state (because the read timeout or -connection close didn't already happen) but also aren't responding to acknowledgement -request in a timely manner. This setting thus allows conversations to be smoother -under such circumstances. +The `smacks_max_ack_delay` setting allows to send out notifications to +clients which aren't already in smacks hibernation state (because the +read timeout or connection close didn't already happen) but also aren't +responding to acknowledgement request in a timely manner. This setting +thus allows conversations to be smoother under such circumstances. -The new event `cloud-notify-ping` can be used by any module to send out a cloud -notification to either all registered endpoints for the given user or only the endpoints -given in the event data. +The new event `cloud-notify-ping` can be used by any module to send out +a cloud notification to either all registered endpoints for the given +user or only the endpoints given in the event data. -The config setting `push_notification_important_body` can be used to specify an alternative -body text to send to the remote pubsub node if the stanza is encrypted or has a body. -This way the real contents of the message aren't revealed to the push appserver but it -can still see that the push is important. -This is used by Chatsecure on iOS to send out high priority pushes in those cases for example. +The config setting `push_notification_important_body` can be used to +specify an alternative body text to send to the remote pubsub node if +the stanza is encrypted or has a body. This way the real contents of the +message aren't revealed to the push appserver but it can still see that +the push is important. This is used by Chatsecure on iOS to send out +high priority pushes in those cases for example. -Compatibility -============= - -**Note:** This module should be used with Lua 5.2 and higher. Using it with -Lua 5.1 may cause push notifications to not be sent to some clients. +# Compatibility ------- ----------------------------------------------------------------------------- - trunk Works - 0.12 Works - 0.11 Works - 0.10 Works - 0.9 Support dropped, use last supported version [675726ab06d3](//hg.prosody.im/prosody-modules/raw-file/675726ab06d3/mod_cloud_notify/mod_cloud_notify.lua) ------- ----------------------------------------------------------------------------- +**Note:** This module should be used with Lua 5.2 and higher. Using it +with Lua 5.1 may cause push notifications to not be sent to some +clients. + ------- ----------------------------------------------------------------- + trunk Works as of 25-06-13 + 13 Works + 0.12 Works + ------- ----------------------------------------------------------------- -[^1]: The service which is expected to forward notifications to something like Google Cloud Messaging or Apple Notification Service -[^2]: [business_rules.markdown](//hg.prosody.im/prosody-modules/file/tip/mod_cloud_notify/business_rules.markdown) +[^1]: The service which is expected to forward notifications to + something like Google Cloud Messaging or Apple Notification Service + +[^2]: [business_rules.md](//hg.prosody.im/prosody-modules/file/tip/mod_cloud_notify/business_rules.md)
author Menel <menel@snikket.de>
date Fri, 13 Jun 2025 10:36:52 +0200
parents 1630c6ed3814
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
307
eeef1fa57f88 mod_admin_web: Specify only directory as bosh service, so it (normally) doesn't need changing (Thanks Zash)
Florian Zeitz <florob@babelmonkeys.de>
parents: 306
diff changeset
1 var BOSH_SERVICE = '/http-bind/';
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
2 var show_log = false;
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
3
317
4f78f5020aa9 mod_admin_web: Get rid of the mod_pubsub dependency
Florian Zeitz <florob@babelmonkeys.de>
parents: 308
diff changeset
4 Strophe.addNamespace('C2SSTREAM', 'http://prosody.im/streams/c2s');
4f78f5020aa9 mod_admin_web: Get rid of the mod_pubsub dependency
Florian Zeitz <florob@babelmonkeys.de>
parents: 308
diff changeset
5 Strophe.addNamespace('S2SSTREAM', 'http://prosody.im/streams/s2s');
4f78f5020aa9 mod_admin_web: Get rid of the mod_pubsub dependency
Florian Zeitz <florob@babelmonkeys.de>
parents: 308
diff changeset
6 Strophe.addNamespace('ADMINSUB', 'http://prosody.im/adminsub');
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
7 Strophe.addNamespace('CAPS', 'http://jabber.org/protocol/caps');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
8
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
9 var localJID = null;
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
10 var connection = null;
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
11
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
12 var adminsubHost = null;
573
c9955858dc7e mod_adhoc_web: Redesign adhoc command pane
Florian Zeitz <florob@babelmonkeys.de>
parents: 547
diff changeset
13 var adhocControl = new Adhoc('#adhocDisplay', function() {});
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
14
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
15 function log(msg) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
16 var entry = $('<div></div>').append(document.createTextNode(msg));
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
17 $('#log').append(entry);
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
18 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
19
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
20 function rawInput(data) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
21 log('RECV: ' + data);
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
22 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
23
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
24 function rawOutput(data) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
25 log('SENT: ' + data);
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
26 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
27
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
28 function _cbNewS2S(e) {
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
29 var items, item, entry, tmp, retract, id, jid, infos, info, metadata;
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
30 items = e.getElementsByTagName('item');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
31 for (i = 0; i < items.length; i++) {
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
32 item = items[i];
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
33 id = item.attributes.getNamedItem('id').value;
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
34 jid = item.getElementsByTagName('session')[0].attributes.getNamedItem('jid').value;
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
35 infos = item.getElementsByTagName('info');
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
36
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
37 entry = $('<li id="' + id + '">' + jid + '</li>');
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
38 if (tmp = item.getElementsByTagName('encrypted')[0]) {
396
8cb21ef24e5d mod_admin_web: Show S2S certificate validity
Florian Zeitz <florob@babelmonkeys.de>
parents: 334
diff changeset
39 if (tmp.getElementsByTagName('valid')[0]) {
8cb21ef24e5d mod_admin_web: Show S2S certificate validity
Florian Zeitz <florob@babelmonkeys.de>
parents: 334
diff changeset
40 entry.append('<img src="images/secure.png" title="encrypted (certificate valid)" alt=" (secure) (encrypted)" />');
8cb21ef24e5d mod_admin_web: Show S2S certificate validity
Florian Zeitz <florob@babelmonkeys.de>
parents: 334
diff changeset
41 } else {
8cb21ef24e5d mod_admin_web: Show S2S certificate validity
Florian Zeitz <florob@babelmonkeys.de>
parents: 334
diff changeset
42 entry.append('<img src="images/encrypted.png" title="encrypted (certificate invalid)" alt=" (encrypted)" />');
8cb21ef24e5d mod_admin_web: Show S2S certificate validity
Florian Zeitz <florob@babelmonkeys.de>
parents: 334
diff changeset
43 }
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
44 }
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
45 if (item.getElementsByTagName('compressed')[0]) {
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
46 entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />');
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
47 }
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
48 metadata = $('<ul/>').css('display', 'none');
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
49 entry.on('click', function() {
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
50 $(this).find("ul").slideToggle();
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
51 });
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
52 metadata.appendTo(entry);
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
53 for (j = 0; j < infos.length; j++) {
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
54 info = infos[j];
1189
1630c6ed3814 mod_admin_web: Use .textContent, instead of .innerHTML
Florian Zeitz <florob@babelmonkeys.de>
parents: 1117
diff changeset
55 metadata.append('<li><b>' + info.attributes.getNamedItem('name').value + ':</b> ' + info.textContent + '</li>');
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
56 }
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
57 if (infos.length == 0)
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
58 metadata.append('<li>No information available</li>');
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
59
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
60 if (items[i].getElementsByTagName('out')[0]) {
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
61 entry.appendTo('#s2sout');
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
62 } else {
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
63 entry.appendTo('#s2sin');
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
64 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
65 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
66 retract = e.getElementsByTagName('retract')[0];
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
67 if (retract) {
614
40ab83736f6e mod_admin_web: Correctly access items in NamedNodeMaps
Florian Zeitz <florob@babelmonkeys.de>
parents: 584
diff changeset
68 id = retract.attributes.getNamedItem('id').value;
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
69 $('#' + id).remove();
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
70 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
71 return true;
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
72 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
73
301
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
74 function _cbNewC2S(e) {
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
75 var items, item, entry, retract, id, jid, infos, info, metadata;
301
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
76 items = e.getElementsByTagName('item');
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
77 for (i = 0; i < items.length; i++) {
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
78 item = items[i];
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
79 id = item.attributes.getNamedItem('id').value;
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
80 jid = item.getElementsByTagName('session')[0].attributes.getNamedItem('jid').value;
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
81 infos = item.getElementsByTagName('info');
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
82 entry = $('<li id="' + id + '">' + jid + '</li>');
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
83 if (item.getElementsByTagName('encrypted')[0]) {
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
84 entry.append('<img src="images/encrypted.png" title="encrypted" alt=" (encrypted)" />');
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
85 }
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
86 if (item.getElementsByTagName('compressed')[0]) {
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
87 entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />');
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
88 }
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
89 metadata = $('<ul/>').css('display', 'none');
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
90 entry.on('click', function() {
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
91 $(this).find("ul").slideToggle();
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
92 });
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
93 metadata.appendTo(entry);
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
94 for (j = 0; j < infos.length; j++) {
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
95 info = infos[j];
1189
1630c6ed3814 mod_admin_web: Use .textContent, instead of .innerHTML
Florian Zeitz <florob@babelmonkeys.de>
parents: 1117
diff changeset
96 metadata.append('<li><b>' + info.attributes.getNamedItem('name').value + ':</b> ' + info.textContent + '</li>');
1117
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
97 }
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
98 if (infos.length == 0)
d643c385d3f6 mod_admin_web: Provide some information about the TLS layer
Florian Zeitz <florob@babelmonkeys.de>
parents: 1023
diff changeset
99 metadata.append('<li>No information available</li>');
306
c152ab024d1a mod_admin_web: Show whether connection is encrypted/compressed
Florian Zeitz <florob@babelmonkeys.de>
parents: 302
diff changeset
100 entry.appendTo('#c2s');
301
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
101 }
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
102 retract = e.getElementsByTagName('retract')[0];
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
103 if (retract) {
614
40ab83736f6e mod_admin_web: Correctly access items in NamedNodeMaps
Florian Zeitz <florob@babelmonkeys.de>
parents: 584
diff changeset
104 id = retract.attributes.getNamedItem('id').value;
301
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
105 $('#' + id).remove();
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
106 }
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
107 return true;
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
108 }
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
109
317
4f78f5020aa9 mod_admin_web: Get rid of the mod_pubsub dependency
Florian Zeitz <florob@babelmonkeys.de>
parents: 308
diff changeset
110 function _cbAdminSub(e) {
614
40ab83736f6e mod_admin_web: Correctly access items in NamedNodeMaps
Florian Zeitz <florob@babelmonkeys.de>
parents: 584
diff changeset
111 var node = e.getElementsByTagName('items')[0].attributes.getNamedItem('node').value;
317
4f78f5020aa9 mod_admin_web: Get rid of the mod_pubsub dependency
Florian Zeitz <florob@babelmonkeys.de>
parents: 308
diff changeset
112 if (node == Strophe.NS.C2SSTREAM) {
301
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
113 _cbNewC2S(e);
317
4f78f5020aa9 mod_admin_web: Get rid of the mod_pubsub dependency
Florian Zeitz <florob@babelmonkeys.de>
parents: 308
diff changeset
114 } else if (node == Strophe.NS.S2SSTREAM) {
301
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
115 _cbNewS2S(e);
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
116 }
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
117
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
118 return true;
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
119 }
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
120
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
121 function onConnect(status) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
122 if (status == Strophe.Status.CONNECTING) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
123 log('Strophe is connecting.');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
124 } else if (status == Strophe.Status.CONNFAIL) {
915
1d03dc7cf28f mod_admin_web: Better error reporting
Florian Zeitz <florob@babelmonkeys.de>
parents: 914
diff changeset
125 alert('Connection failed (Wrong host?)');
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
126 log('Strophe failed to connect.');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
127 showConnect();
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
128 } else if (status == Strophe.Status.DISCONNECTING) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
129 log('Strophe is disconnecting.');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
130 } else if (status == Strophe.Status.DISCONNECTED) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
131 log('Strophe is disconnected.');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
132 showConnect();
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
133 } else if (status == Strophe.Status.AUTHFAIL) {
915
1d03dc7cf28f mod_admin_web: Better error reporting
Florian Zeitz <florob@babelmonkeys.de>
parents: 914
diff changeset
134 alert('Wrong username and/or password');
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
135 log('Authentication failed');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
136 if (connection) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
137 connection.disconnect();
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
138 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
139 } else if (status == Strophe.Status.CONNECTED) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
140 log('Strophe is connected.');
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
141 connection.sendIQ($iq({to: connection.domain, type: 'get', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
142 .c('adminfor'), function(e) {
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
143 var items;
1019
7cba8be42d9e mod_admin_web: Update to new strophejs location, and jQuery 1.9.1
Florian Zeitz <florob@babelmonkeys.de>
parents: 915
diff changeset
144 var domainpart = Strophe.getDomainFromJid(connection.jid);
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
145 items = e.getElementsByTagName('item');
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
146 if (items.length == 0) {
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
147 alert("You are not an administrator");
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
148 connection.disconnect();
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
149 return false;
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
150 }
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
151 for (i = 0; i < items.length; i++) {
914
fa996cfec6da mod_admin_web: Default the host selection to the administrators domainpart
Florian Zeitz <florob@babelmonkeys.de>
parents: 614
diff changeset
152 var host = $(items[i]).text();
1019
7cba8be42d9e mod_admin_web: Update to new strophejs location, and jQuery 1.9.1
Florian Zeitz <florob@babelmonkeys.de>
parents: 915
diff changeset
153 $('<option/>').text(host).prop('selected', host == domainpart).appendTo('#host');
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
154 }
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
155 showDisconnect();
1020
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
156 adminsubHost = $('#host').val();
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
157 adhocControl.checkFeatures(adminsubHost,
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
158 function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').html(result); }) },
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
159 function () { $('#adhocCommands').empty(); $('#adhocDisplay').html('<p>This host does not support commands</p>'); });
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
160 connection.addHandler(_cbAdminSub, Strophe.NS.ADMINSUB + '#event', 'message');
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
161 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
162 .c('subscribe', {node: Strophe.NS.C2SSTREAM}));
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
163 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
164 .c('subscribe', {node: Strophe.NS.S2SSTREAM}));
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
165 connection.sendIQ($iq({to: adminsubHost, type: 'get', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
166 .c('items', {node: Strophe.NS.S2SSTREAM}), _cbNewS2S);
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
167 connection.sendIQ($iq({to: adminsubHost, type: 'get', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
168 .c('items', {node: Strophe.NS.C2SSTREAM}), _cbNewC2S);
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
169 });
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
170 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
171 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
172
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
173 function showConnect() {
539
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
174 $('#login').show();
294
5a619d6045a8 mod_admin_web: Prepare for adding more features
Florian Zeitz <florob@babelmonkeys.de>
parents: 292
diff changeset
175 $('#menu').hide();
539
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
176 $('#main').hide();
302
50abf9922e6e mod_admin_web: Don't delete the menu
Florian Zeitz <florob@babelmonkeys.de>
parents: 301
diff changeset
177 $('#s2sin').empty();
50abf9922e6e mod_admin_web: Don't delete the menu
Florian Zeitz <florob@babelmonkeys.de>
parents: 301
diff changeset
178 $('#s2sout').empty();
50abf9922e6e mod_admin_web: Don't delete the menu
Florian Zeitz <florob@babelmonkeys.de>
parents: 301
diff changeset
179 $('#c2s').empty();
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
180 $('#host').empty();
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
181 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
182
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
183 function showDisconnect() {
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
184 $('#s2sList').hide();
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
185 $('#c2sList').hide();
539
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
186 $('#login').hide();
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
187
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
188 $('#menu').show();
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
189 $('#main').show();
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
190 $('#adhoc').show();
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
191 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
192
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
193 $(document).ready(function () {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
194 connection = new Strophe.Connection(BOSH_SERVICE);
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
195 if (show_log) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
196 $('#log_container').show();
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
197 connection.rawInput = rawInput;
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
198 connection.rawOutput = rawOutput;
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
199 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
200
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
201 $("#log_toggle").click(function () {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
202 $("#log").toggle();
294
5a619d6045a8 mod_admin_web: Prepare for adding more features
Florian Zeitz <florob@babelmonkeys.de>
parents: 292
diff changeset
203 });
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
204
1023
83f56d3a07f5 mod_admin_web: Update to JQuery 1.10.0
Florian Zeitz <florob@babelmonkeys.de>
parents: 1020
diff changeset
205 $('#cred').on('submit', function (event) {
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
206 var button = $('#connect').get(0);
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
207 var jid = $('#jid');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
208 var pass = $('#pass');
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
209 localJID = jid.get(0).value;
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
210
1020
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
211 $('#log').empty();
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
212 connection.connect(localJID, pass.get(0).value, onConnect);
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
213 event.preventDefault();
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
214 });
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
215
539
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
216 $('#logout').click(function (event) {
1020
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
217 connection.disconnect();
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
218 event.preventDefault();
539
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
219 });
99465bbfa205 First pass of web-admin redesign
Florian Zeitz <florob@babelmonkeys.de>
parents: 396
diff changeset
220
547
f0ef6e285d69 mod_adhoc_web: fade instead of scrolling
Florian Zeitz <florob@babelmonkeys.de>
parents: 539
diff changeset
221 $('#adhocMenu, #serverMenu, #clientMenu').click(function (event) {
294
5a619d6045a8 mod_admin_web: Prepare for adding more features
Florian Zeitz <florob@babelmonkeys.de>
parents: 292
diff changeset
222 event.preventDefault();
1020
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
223 var tab = $(this).attr('href');
547
f0ef6e285d69 mod_adhoc_web: fade instead of scrolling
Florian Zeitz <florob@babelmonkeys.de>
parents: 539
diff changeset
224 $('#main > div').hide();
f0ef6e285d69 mod_adhoc_web: fade instead of scrolling
Florian Zeitz <florob@babelmonkeys.de>
parents: 539
diff changeset
225 $(tab).fadeIn('fast');
301
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
226 });
b241c79a0eb7 mod_admin_web: Add a live view for C2S connections
Florian Zeitz <florob@babelmonkeys.de>
parents: 297
diff changeset
227
1023
83f56d3a07f5 mod_admin_web: Update to JQuery 1.10.0
Florian Zeitz <florob@babelmonkeys.de>
parents: 1020
diff changeset
228 $('#host').on('change', function (event) {
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
229 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
230 .c('unsubscribe', {node: Strophe.NS.C2SSTREAM}));
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
231 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
232 .c('unsubscribe', {node: Strophe.NS.S2SSTREAM}));
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
233 adminsubHost = $(this).val();
1020
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
234 adhocControl.checkFeatures(adminsubHost,
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
235 function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').html(result); }) },
9839198539c8 mod_admin_web: Fix indentation
Florian Zeitz <florob@babelmonkeys.de>
parents: 1019
diff changeset
236 function () { $('#adhocCommands').empty(); $('#adhocDisplay').html('<p>This host does not support commands</p>'); });
319
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
237 $('#s2sin').empty();
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
238 $('#s2sout').empty();
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
239 $('#c2s').empty();
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
240 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
241 .c('subscribe', {node: Strophe.NS.C2SSTREAM}));
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
242 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
243 .c('subscribe', {node: Strophe.NS.S2SSTREAM}));
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
244 connection.sendIQ($iq({to: adminsubHost, type: 'get', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
245 .c('items', {node: Strophe.NS.S2SSTREAM}), _cbNewS2S);
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
246 connection.sendIQ($iq({to: adminsubHost, type: 'get', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
247 .c('items', {node: Strophe.NS.C2SSTREAM}), _cbNewC2S);
ba2e78661ea8 mod_admin_web: Make module global. Host to administrate is now chooseable
Florian Zeitz <florob@babelmonkeys.de>
parents: 317
diff changeset
248 });
288
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
249 });
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
250
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
251 window.onunload = window.onbeforeunload = function() {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
252 if (connection) {
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
253 connection.disconnect();
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
254 }
9233d7ee3c09 mod_admin_web: Initial PoC commit
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
255 }