Merge pull request #212 from DJ2LS/raspberry_pi_chat_fix

fixed database not loading on ARM devices
This commit is contained in:
DJ2LS 2022-06-15 14:35:07 +02:00 committed by GitHub
commit 34bf67dedd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View file

@ -1,6 +1,6 @@
{
"name": "FreeDATA",
"version": "0.4.1-alpha",
"version": "0.4.2-alpha",
"description": "FreeDATA ",
"main": "main.js",
"scripts": {
@ -40,6 +40,7 @@
"emoji-picker-element-data": "^1.3.0",
"mime": "^3.0.0",
"pouchdb": "^7.3.0",
"pouchdb-browser": "^7.3.0",
"pouchdb-find": "^7.3.0",
"qth-locator": "^2.1.0",
"utf8": "^3.0.0",
@ -94,4 +95,3 @@
]
}
}

View file

@ -46,7 +46,20 @@ var selected_callsign = '';
var chatDB = path.join(configFolder, 'chatDB')
// ---- MessageDB
try{
var PouchDB = require('pouchdb');
} catch(err){
console.log(err);
/*
This is a fix for raspberryPi where we get an error when loading pouchdb because of
leveldown package isnt running on ARM devices.
pouchdb-browser does not depend on leveldb and seems to be working.
*/
console.log("using pouchdb-browser fallback")
var PouchDB = require('pouchdb-browser');
}
PouchDB.plugin(require('pouchdb-find'));
var db = new PouchDB(chatDB);
var dxcallsigns = new Set();
@ -759,7 +772,7 @@ update_chat = function(obj) {
});
});
};
}
//window.location = window.location
}
@ -815,7 +828,7 @@ function get_icon_for_state(state) {
var status_icon = '<i class="bi bi-question" style="font-size:1rem;"></i>';
}
return status_icon;
};
}