Merge remote-tracking branch 'origin/stable'

This commit is contained in:
zadam 2021-02-05 22:54:50 +01:00
commit 45516fa7b4
5 changed files with 9 additions and 9 deletions

View file

@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.45.8",
"version": "0.45.9",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {

View file

@ -235,7 +235,7 @@ function register(app) {
route(GET, '/api/setup/status', [], setupApiRoute.getStatus, apiResultHandler);
route(POST, '/api/setup/new-document', [auth.checkAppNotInitialized], setupApiRoute.setupNewDocument, apiResultHandler);
route(POST, '/api/setup/sync-from-server', [auth.checkAppNotInitialized], setupApiRoute.setupSyncFromServer, apiResultHandler, false);
route(GET, '/api/setup/sync-seed', [auth.checkBasicAuth], setupApiRoute.getSyncSeed, apiResultHandler);
route(GET, '/api/setup/sync-seed', [auth.checkCredentials], setupApiRoute.getSyncSeed, apiResultHandler);
route(POST, '/api/setup/sync-seed', [auth.checkAppNotInitialized], setupApiRoute.saveSyncSeed, apiResultHandler, false);
apiRoute(GET, '/api/sql/schema', sqlRoute.getSchema);

View file

@ -77,8 +77,8 @@ function reject(req, res, message) {
res.status(401).send(message);
}
function checkBasicAuth(req, res, next) {
const header = req.headers.authorization || '';
function checkCredentials(req, res, next) {
const header = req.headers['trilium-cred'] || '';
const token = header.split(/\s+/).pop() || '';
const auth = new Buffer.from(token, 'base64').toString();
const [username, password] = auth.split(/:/);
@ -100,5 +100,5 @@ module.exports = {
checkAppNotInitialized,
checkApiAuthOrElectron,
checkToken,
checkBasicAuth
checkCredentials
};

View file

@ -1 +1 @@
module.exports = { buildDate:"2021-01-11T22:47:11+01:00", buildRevision: "6afc299efb616d47c72b5f58ab2827c0e3e121c2" };
module.exports = { buildDate:"2021-02-05T21:38:32+01:00", buildRevision: "9d7d79ef94bc7734393ae7f89993e76bbc7d97e3" };

View file

@ -70,9 +70,9 @@ async function setupSyncFromSyncServer(syncServerHost, syncProxy, username, pass
const resp = await request.exec({
method: 'get',
url: syncServerHost + '/api/setup/sync-seed',
auth: {
'user': username,
'pass': password
headers: {
// not using Authorization header because some proxy servers will filter it out
'trilium-cred': Buffer.from(username + ':' + password).toString('base64')
},
proxy: syncProxy,
timeout: 30000 // seed request should not take long