mirror of
https://github.com/zadam/trilium.git
synced 2025-02-28 00:53:10 +08:00
removed sync code as it's probably not going to happen ...
This commit is contained in:
parent
eff67cbf27
commit
22749f252b
2 changed files with 0 additions and 67 deletions
|
@ -18,8 +18,3 @@ certKeyPath=cert.key
|
||||||
username=your_username
|
username=your_username
|
||||||
# This is bcrypt password hash. You can use generate-password.py (in this directory) to hash your password
|
# This is bcrypt password hash. You can use generate-password.py (in this directory) to hash your password
|
||||||
passwordHash=$2b$12$FHT8keXp3BGTfzAV/VnrkuLpkwN8Vpj5iIh4RwCbHTNWYSBI9hGAK
|
passwordHash=$2b$12$FHT8keXp3BGTfzAV/VnrkuLpkwN8Vpj5iIh4RwCbHTNWYSBI9hGAK
|
||||||
|
|
||||||
[Sync]
|
|
||||||
sync-server-url=https://localhost:57201
|
|
||||||
sync-server-username=syncuser
|
|
||||||
sync-server-password=password
|
|
62
src/sync.py
62
src/sync.py
|
@ -1,62 +0,0 @@
|
||||||
import binascii
|
|
||||||
import hashlib
|
|
||||||
import os
|
|
||||||
|
|
||||||
import configparser
|
|
||||||
import requests
|
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
|
||||||
config.read('config.ini')
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
authContent = syncServerUsername + ":" + hashlib.sha256(syncServerUsername + ":" + syncServerPassword).hexdigest() + ":" + nonce
|
|
||||||
|
|
||||||
print('Auth content: ' + authContent)
|
|
||||||
|
|
||||||
# SHA256(user + ":" + SHA256(user + ":" + password) + ":" + nonce) where SHA256 is a hex encoded value
|
|
||||||
auth = hashlib.sha256(authContent).hexdigest()
|
|
||||||
|
|
||||||
response = requests.post(syncServerUrl + "/login", json={
|
|
||||||
'user': syncServerUsername,
|
|
||||||
'nonce': nonce,
|
|
||||||
'auth': auth,
|
|
||||||
'protocol': '2'
|
|
||||||
}, verify=False)
|
|
||||||
|
|
||||||
# verify='/home/adam/.notecase/server.pem'
|
|
||||||
|
|
||||||
def printResp(resp):
|
|
||||||
print('Status: ' + str(resp.status_code))
|
|
||||||
|
|
||||||
for key in response.headers:
|
|
||||||
print(key + ': ' + resp.headers[key])
|
|
||||||
|
|
||||||
print('Body: ' + resp.content)
|
|
||||||
|
|
||||||
printResp(response)
|
|
||||||
|
|
||||||
session = response.headers['Auth']
|
|
||||||
|
|
||||||
response = requests.get(syncServerUrl + "/document/list", headers={
|
|
||||||
'Auth': session
|
|
||||||
}, verify=False)
|
|
||||||
|
|
||||||
printResp(response)
|
|
||||||
|
|
||||||
response = requests.post(syncServerUrl + "/document/tree", headers={
|
|
||||||
'Auth': session
|
|
||||||
},
|
|
||||||
json={
|
|
||||||
'id': 1,
|
|
||||||
'password': ''
|
|
||||||
},
|
|
||||||
verify=False)
|
|
||||||
|
|
||||||
printResp(response)
|
|
Loading…
Reference in a new issue