Update .woodpecker.yml #1
5
index.js
5
index.js
@ -505,6 +505,7 @@ const server = http.createServer(async (req, res) => {
|
||||
return;
|
||||
}
|
||||
if (req.url.startsWith('/api/webhook/sms') && req.method === 'POST') {
|
||||
log('SMS', `Incoming sms webhook`);
|
||||
const urlObj = new URL(req.url, `http://${req.headers.host || 'localhost'}`);
|
||||
const token = urlObj.searchParams.get('token');
|
||||
if (config.smsWebhookToken && token !== config.smsWebhookToken) {
|
||||
@ -526,7 +527,7 @@ const server = http.createServer(async (req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const from = data.from || 'Unknown';
|
||||
const from = data.sender || 'Unknown';
|
||||
const msg = (data.message || '').trim();
|
||||
if (!msg) {
|
||||
res.writeHead(400);
|
||||
@ -552,7 +553,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const isTest = config.test.smsFrom && from === config.test.smsFrom;
|
||||
log('SMS', `Incoming webhook from ${from}${isTest ? ' (test mode)' : ''}: "${msg}"`);
|
||||
const candidates = isTest && config.test.groupNames.length ? config.test.groupNames : config.groupNames;
|
||||
const matchedGroup = candidates.find((g) => g.toLowerCase() === groupName.toLowerCase());
|
||||
const matchedGroup = candidates.find((g) => g.toLowerCase().startsWith(groupName.toLowerCase()));
|
||||
if (!matchedGroup) {
|
||||
log('SMS', `Group "${groupName}" not found in ${candidates.join(', ')}`);
|
||||
res.writeHead(404);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user