|
65 | 65 | const mediaContent = document.getElementById('mediaContent'); |
66 | 66 | const customGifFilterId = (urlParams.get('gifid') || '').trim(); |
67 | 67 | const customGifFilterCommand = (urlParams.get('gifcommand') || '').trim().toLowerCase(); |
| 68 | + const customGifFilterCommands = customGifFilterCommand.split(',').map(function(command) { |
| 69 | + return command.trim(); |
| 70 | + }).filter(Boolean); |
68 | 71 | if (urlParams.has('stretch')) document.body.classList.add('stretch'); |
69 | 72 | let mediaQueue = []; |
70 | 73 | let isPlaying = false; |
|
104 | 107 | const mediaProbeTimeout = 4000; |
105 | 108 |
|
106 | 109 | function shouldShowCustomGifData(data) { |
107 | | - if (!customGifFilterId && !customGifFilterCommand) return true; |
| 110 | + if (!customGifFilterId && !customGifFilterCommands.length) return true; |
108 | 111 |
|
109 | 112 | const meta = data && data.meta ? data.meta : {}; |
110 | 113 | if (customGifFilterId && String(meta.customGifCommandId || '') === customGifFilterId) { |
111 | 114 | return true; |
112 | 115 | } |
113 | 116 |
|
114 | | - if (customGifFilterCommand) { |
| 117 | + if (customGifFilterCommands.length) { |
115 | 118 | const command = String(meta.customGifCommand || '').toLowerCase(); |
116 | | - if (command === customGifFilterCommand) return true; |
| 119 | + if (customGifFilterCommands.indexOf(command) !== -1) return true; |
117 | 120 |
|
118 | 121 | const commands = Array.isArray(meta.customGifCommands) ? meta.customGifCommands : []; |
119 | 122 | for (let i = 0; i < commands.length; i++) { |
120 | | - if (String(commands[i] || '').toLowerCase() === customGifFilterCommand) { |
| 123 | + if (customGifFilterCommands.indexOf(String(commands[i] || '').toLowerCase()) !== -1) { |
121 | 124 | return true; |
122 | 125 | } |
123 | 126 | } |
| 127 | + |
| 128 | + const chatMessage = String(data && data.chatmessage ? data.chatmessage : '').trim().toLowerCase(); |
| 129 | + const firstWord = chatMessage.split(/\s+/)[0] || ''; |
| 130 | + if (customGifFilterCommands.indexOf(firstWord) !== -1 || customGifFilterCommands.indexOf(chatMessage) !== -1) { |
| 131 | + return true; |
| 132 | + } |
124 | 133 | } |
125 | 134 |
|
126 | 135 | return false; |
|
536 | 545 |
|
537 | 546 | const iframe = document.createElement("iframe"); |
538 | 547 | const filename = new URL(window.location.href).pathname.split('/').pop().split('.')[0] || "dock"; |
539 | | - const bridgeLabel = (customGifFilterId || urlParams.get('label') || filename).trim() || filename; |
| 548 | + const bridgeLabel = ((customGifFilterId || customGifFilterCommand) ? filename : (urlParams.get('label') || filename)).trim() || filename; |
540 | 549 | const password = urlParams.get('password') || 'false'; |
541 | 550 | const lanonly = urlParams.has('lanonly') ? '&lanonly' : ''; |
542 | 551 | iframe.src = "https://vdo.socialstream.ninja/?ln&salt=vdo.ninja¬mobile¬mobile&password=" + encodeURIComponent(password) + lanonly + "&solo&view=" + urlParams.get('session') + "&novideo&noaudio&label=" + encodeURIComponent(bridgeLabel) + "&cleanoutput&room=" + urlParams.get('session'); |
|
0 commit comments