fixed database not loading on ARM devices

This commit is contained in:
dj2ls 2022-06-15 14:34:17 +02:00
parent 6e08daa603
commit 25a5c1b47a
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",
@ -52,7 +53,7 @@
"build": {
"productName": "FreeDATA",
"appId": "app.freedata",
"npmRebuild" : "false",
"npmRebuild": "false",
"directories": {
"buildResources": "src/img",
"output": "dist"
@ -94,4 +95,3 @@
]
}
}

View file

@ -46,7 +46,20 @@ var selected_callsign = '';
var chatDB = path.join(configFolder, 'chatDB')
// ---- MessageDB
var PouchDB = require('pouchdb');
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;
};
}