Encrypt draft wiki blobs.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4619 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
607e9ef71b
commit
6cdf207dcd
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "📝",
|
"emoji": "📝",
|
||||||
"previous": "&rj3P1MdTitVRBCznRAN+lmMz8dxPwil2PjQ31KdkPi4=.sha256"
|
"previous": "&N1wA9DJ6RacaPG52I+ZEhWbbVvf3U1Dcvouh0UkfkG0=.sha256"
|
||||||
}
|
}
|
@ -25,8 +25,15 @@ class TfWikiDocElement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load_blob() {
|
async load_blob() {
|
||||||
this.blob = await tfrpc.rpc.get_blob(this.value?.blob);
|
let blob = await tfrpc.rpc.get_blob(this.value?.blob);
|
||||||
this.blob_original = this.blob;
|
if (blob.endsWith('.box')) {
|
||||||
|
let d = await tfrpc.rpc.try_decrypt(this.whoami, blob);
|
||||||
|
if (d) {
|
||||||
|
blob = d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.blob = blob;
|
||||||
|
this.blob_original = blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
on_edit(event) {
|
on_edit(event) {
|
||||||
@ -39,7 +46,11 @@ class TfWikiDocElement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async append_message(draft) {
|
async append_message(draft) {
|
||||||
let id = await tfrpc.rpc.store_blob(this.blob);
|
let blob = this.blob;
|
||||||
|
if (draft) {
|
||||||
|
blob = await tfrpc.rpc.encrypt(this.whoami, this.value.editors, blob);
|
||||||
|
}
|
||||||
|
let id = await tfrpc.rpc.store_blob(blob);
|
||||||
let message = {
|
let message = {
|
||||||
type: 'wiki-doc',
|
type: 'wiki-doc',
|
||||||
key: this.value.id,
|
key: this.value.id,
|
||||||
|
Loading…
Reference in New Issue
Block a user