output raw fingerprint if we can't deserialize it
All checks were successful
Build and push Doorman UI / API / docker (push) Successful in 1m19s
All checks were successful
Build and push Doorman UI / API / docker (push) Successful in 1m19s
This commit is contained in:
parent
5b57024105
commit
016e0cfa85
@ -7,11 +7,15 @@ exports.handler = async function(context, event, callback) {
|
||||
let msg = event.msg;
|
||||
|
||||
if (event.json && event.json != "undefined") {
|
||||
const fingerprint = JSON.parse(event.json)?.fingerprint;
|
||||
try {
|
||||
const fingerprint = JSON.parse(event.json);
|
||||
msg += `\`\`\`# Unlocked by\n${JSON.stringify(fingerprint, null, 4)}\`\`\``;
|
||||
} catch (e) {
|
||||
msg += `\`\`\`# Unlocked by\n# WARN: Unknown or corrupt raw fingerprint:\n ${fingerprint}\`\`\``;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(event.msg);
|
||||
console.log(msg);
|
||||
|
||||
// user must be in "Doorman" server
|
||||
await discord.sendMessageToUser(context,
|
||||
|
||||
@ -47,7 +47,7 @@ exports.handler = async function(context, event, callback) {
|
||||
else if (res.status === 200) {
|
||||
clearInterval(interval);
|
||||
const body = await res.json();
|
||||
twiml.redirect(`/door-open?fingerprint=${encodeURIComponent(JSON.stringify(body))}&${configQuery}`);
|
||||
twiml.redirect(`/door-open?fingerprint=${encodeURIComponent(JSON.stringify(body.fingerprint))}&${configQuery}`);
|
||||
callback(null, twiml);
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user