Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
initial exploratory work on sync
azivner415a5f58f1b8
diff --git a/app.py b/app.pyindex ac19741cea..1dfb5aea3e 100644--- a/app.py+++ b/app.py@@ -10,6 +10,11 @@ import randomimport stringimport configparserimport bcrypt+import requests+import json+import os+import binascii+import hashlibfrom flask import render_template, redirect@@ -303,5 +308,24 @@ def load_user(user_id):else:return None+syncServerUrl = config['Sync']['sync-server-url']+syncServerUsername = config['Sync']['sync-server-username']+syncServerPassword = config['Sync']['sync-server-password']++nonce = binascii.hexlify(bytearray(os.urandom(32)))++print('Nonce: ' + nonce)++# SHA256(user + ":" + SHA256(user + ":" + password) + ":" + nonce) where SHA256 is a hex encoded value+auth = hashlib.sha256(syncServerUsername + ":" + hashlib.sha256(syncServerPassword + ":" + syncServerPassword).hexdigest() + ":" + nonce).hexdigest()++response = requests.post(syncServerUrl + "/login", json={+ 'user': syncServerUsername,+ 'nonce': nonce,+ 'auth': auth+})++print(response)+if __name__ == '__main__':- app.run(host='0.0.0.0')+ app.run(host='0.0.0.0')\ No newline at end of filediff --git a/config.ini b/config.iniindex 695f0a70b8..cbda03fc7c 100644--- a/config.ini+++ b/config.ini@@ -2,4 +2,9 @@# Enter below credentials with with which you want to authenticate to Notecase web appusername=adam# This is bcrypt password hash. You can use generate-password.py (in this directory) to hash your password-password-hash=$2b$12$jcbhRx6WRbCRogpCckH1hehWrHWgFaFYC3u3ebdVURJX36..fdAca\ No newline at end of file+password-hash=$2b$12$jcbhRx6WRbCRogpCckH1hehWrHWgFaFYC3u3ebdVURJX36..fdAca++[Sync]+sync-server-url=http://localhost:57201+sync-server-username=syncuser+sync-server-password=password\ No newline at end of file