mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
revert accidentally committed auth changes, #1629
This commit is contained in:
parent
067ca9ab16
commit
5b679930de
@ -224,7 +224,7 @@ function register(app) {
|
|||||||
route(GET, '/api/setup/status', [], setupApiRoute.getStatus, apiResultHandler);
|
route(GET, '/api/setup/status', [], setupApiRoute.getStatus, apiResultHandler);
|
||||||
route(POST, '/api/setup/new-document', [auth.checkAppNotInitialized], setupApiRoute.setupNewDocument, 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(POST, '/api/setup/sync-from-server', [auth.checkAppNotInitialized], setupApiRoute.setupSyncFromServer, apiResultHandler, false);
|
||||||
route(GET, '/api/setup/sync-seed', [auth.checkCredentials], setupApiRoute.getSyncSeed, apiResultHandler);
|
route(GET, '/api/setup/sync-seed', [auth.checkBasicAuth], setupApiRoute.getSyncSeed, apiResultHandler);
|
||||||
route(POST, '/api/setup/sync-seed', [auth.checkAppNotInitialized], setupApiRoute.saveSyncSeed, apiResultHandler, false);
|
route(POST, '/api/setup/sync-seed', [auth.checkAppNotInitialized], setupApiRoute.saveSyncSeed, apiResultHandler, false);
|
||||||
|
|
||||||
apiRoute(GET, '/api/sql/schema', sqlRoute.getSchema);
|
apiRoute(GET, '/api/sql/schema', sqlRoute.getSchema);
|
||||||
|
@ -77,8 +77,8 @@ function reject(req, res, message) {
|
|||||||
res.status(401).send(message);
|
res.status(401).send(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkCredentials(req, res, next) {
|
function checkBasicAuth(req, res, next) {
|
||||||
const header = req.headers['trilium-cred'] || '';
|
const header = req.headers.authorization || '';
|
||||||
const token = header.split(/\s+/).pop() || '';
|
const token = header.split(/\s+/).pop() || '';
|
||||||
const auth = new Buffer.from(token, 'base64').toString();
|
const auth = new Buffer.from(token, 'base64').toString();
|
||||||
const [username, password] = auth.split(/:/);
|
const [username, password] = auth.split(/:/);
|
||||||
@ -100,5 +100,5 @@ module.exports = {
|
|||||||
checkAppNotInitialized,
|
checkAppNotInitialized,
|
||||||
checkApiAuthOrElectron,
|
checkApiAuthOrElectron,
|
||||||
checkToken,
|
checkToken,
|
||||||
checkCredentials
|
checkBasicAuth
|
||||||
};
|
};
|
||||||
|
@ -70,9 +70,9 @@ async function setupSyncFromSyncServer(syncServerHost, syncProxy, username, pass
|
|||||||
const resp = await request.exec({
|
const resp = await request.exec({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: syncServerHost + '/api/setup/sync-seed',
|
url: syncServerHost + '/api/setup/sync-seed',
|
||||||
headers: {
|
auth: {
|
||||||
// not using Authorization header because some proxy servers will filter it out
|
'user': username,
|
||||||
'trilium-cred': Buffer.from(username + ':' + password).toString('base64')
|
'pass': password
|
||||||
},
|
},
|
||||||
proxy: syncProxy,
|
proxy: syncProxy,
|
||||||
timeout: 30000 // seed request should not take long
|
timeout: 30000 // seed request should not take long
|
||||||
|
Loading…
x
Reference in New Issue
Block a user