|
64 | 64 | $ca_file = dirname(__FILE__) . '/../modules/connect/fullchain.pem';
|
65 | 65 | }
|
66 | 66 |
|
67 |
| - $query = $username . '/incoming_urls,' . $username . '/menu_session,' . $username . '/reverse_requests'; |
| 67 | + $topics = array( |
| 68 | + $username . '/incoming_urls', |
| 69 | + $username . '/menu_session', |
| 70 | + $username . '/reverse_requests', |
| 71 | + $username . '/forward/#', |
| 72 | + $connect->config['CONNECT_USERNAME'] . '/forward/#', |
| 73 | + ); |
| 74 | + |
| 75 | + $query = implode(',', $topics); |
68 | 76 | $ping_topic = $username . '/ping';
|
69 | 77 | $client_name = "MajorDoMo " . $username . " Connect";
|
70 | 78 | $mqtt_client = new Bluerhinos\phpMQTT($host, $port, $client_name, $ca_file);
|
|
96 | 104 | $previousMillis = $currentMillis;
|
97 | 105 | $checked_time = time();
|
98 | 106 | setGlobal((str_replace('.php', '', basename(__FILE__))) . 'Run', time(), 1);
|
99 |
| - if (isRebootRequired() || IsSet($_GET['onetime'])) { |
| 107 | + if (isRebootRequired() || isset($_GET['onetime'])) { |
100 | 108 | exit;
|
101 | 109 | }
|
102 | 110 | }
|
@@ -186,6 +194,10 @@ function procmsg($topic, $msg)
|
186 | 194 | $url = BASE_URL . '/ajax/connect.html?no_session=1&op=reverse_request&msg=' . urlencode($msg);
|
187 | 195 | echo date("Y-m-d H:i:s") . " Incoming reverse url: $msg\n";
|
188 | 196 | getURLBackground($url, 0);
|
| 197 | + } elseif (preg_match('/\/forward\/(.+)/is', $topic, $m)) { |
| 198 | + $forward_topic = $m[1]; |
| 199 | + //DebMes("Forward $forward_topic: $msg",'connect'); |
| 200 | + callAPI('/api/module/mqtt', 'GET', array('topic' => $forward_topic, 'msg' => $msg)); |
189 | 201 | } elseif (preg_match('/reverse_requests/is', $topic)) {
|
190 | 202 | //DebMes("Reverse request: $msg",'connect');
|
191 | 203 | $url = BASE_URL . '/ajax/connect.html?no_session=1&op=reverse_request_full&msg=' . urlencode($msg);
|
|
0 commit comments