2
0
mirror of https://github.com/frappe/books.git synced 2024-11-09 23:30:56 +00:00

fix: path fixes, electron-builder creds

This commit is contained in:
18alantom 2022-01-28 18:08:01 +05:30 committed by Alan
parent 39b56e1d1c
commit 6440455470
2 changed files with 20 additions and 4 deletions

View File

@ -1,6 +1,12 @@
productName: Frappe Books
appId: io.frappe.books
afterSign: build/notarize.js
extraResources: [
{
from: 'err_log_creds.txt',
to: '../creds/err_log_creds.txt',
}
]
mac:
type: distribution
category: public.app-category.finance

View File

@ -6,7 +6,18 @@ import path from 'path';
function getUrlAndTokenString() {
const inProduction = app.isPackaged;
const errLogCredsPath = path.join(__dirname, '../err_log_creds.txt');
let errLogCredsPath = path.join(
process.resourcesPath,
'../creds/err_log_creds.txt'
);
if (!fs.existsSync(errLogCredsPath)) {
errLogCredsPath = path.join(__dirname, '../err_log_creds.txt');
}
if (!fs.existsSync(errLogCredsPath)) {
!inProduction && console.log(`${errLogCredsPath} doesn't exist, can't log`);
return;
}
let apiKey, apiSecret, url;
try {
@ -16,13 +27,12 @@ function getUrlAndTokenString() {
.filter((f) => f.length);
} catch (err) {
if (!inProduction) {
console.log('error logging failed');
console.log(`logging error using creds at: ${errLogCredsPath} failed`);
console.log(err);
}
return;
}
!inProduction && console.log(apiKey, apiSecret, url);
return { url: encodeURI(url), tokenString: `token ${apiKey}:${apiSecret}` };
}