mirror of
https://github.com/zyphlar/doorlock.git
synced 2024-04-03 21:36:03 +00:00
using ajax for submission
This commit is contained in:
@@ -28,31 +28,6 @@ module.exports = class Cards {
|
||||
return this.all().then(cards =>
|
||||
cards.find(c => parseInt(c.number, 10) === parseInt(number, 10))
|
||||
)
|
||||
// console.log(':', JSON.stringify(number.toString().trim()))
|
||||
// const scanned = parseInt(
|
||||
// number
|
||||
// .toString('hex')
|
||||
// .trim() // Remove any whiespace or newlines
|
||||
// .replace('\u0003', '') // Remove "end of text" character
|
||||
// .replace('\u0002', '') // Remove "start of text" character
|
||||
// .substring(3) // Strip off con
|
||||
// .slice(0, -2), // Strip off checksum
|
||||
// 16
|
||||
// )
|
||||
|
||||
// this.log('Scanned card:', scanned)
|
||||
|
||||
// return this.readCardsFromSDCard().then(cards => {
|
||||
// const card = cards.find(c => parseInt(c.number) === scanned)
|
||||
|
||||
// if (card) {
|
||||
// const name = card.name.split(' ')[0]
|
||||
// this.log(`Welcome in ${name}!`, scanned)
|
||||
// this.openDoor()
|
||||
// } else {
|
||||
// this.log('Card is invalid:', scanned)
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
static sortByName(cards) {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ module.exports = class Logs {
|
||||
static all() {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(LOGS_PATH, (err, data) => {
|
||||
if (err) return reject(err)
|
||||
if (err) return resolve(JSON.parse("[]"))
|
||||
resolve(JSON.parse(data))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user