Skip to content
Snippets Groups Projects

Ability to upload a document in Dashboard

Merged Alexey Lunin requested to merge 422-upload-documents into master
3 files
+ 68
44
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -1074,9 +1074,49 @@ const connection = Penpal.connectToParent({
result(res)
})
},
// Collabora APIs
collaboraDiscovery() {
return collaboraApi.discovery().then(apps => apps);
},
// WOPI APIs
// TODO rewrite with async await
getPassports: function(fileID) {
return new Penpal.Promise(function(result) {
const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
if (
!authenticationPublicKey ||
!window.loadedIdentities[authenticationPublicKey] ||
!extendPinCodeTtl(authenticationPublicKey)
) {
return encodeResponse("400", "", "Identity not authenticated");
}
wopiAPI.getPassports(fileID).then(function(response) {
result(response.data);
});
});
},
// TODO rewrite with async await
wopiPutFile: function (fileId, accessToken, file) {
return new Penpal.Promise(function(result) {
const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
if (
!authenticationPublicKey ||
!window.loadedIdentities[authenticationPublicKey] ||
!extendPinCodeTtl(authenticationPublicKey)
) {
return encodeResponse("400", "", "Identity not authenticated");
}
wopiAPI.putDocument(fileId, accessToken, file).then(function(response) {
result(response.data);
});
});
},
...penpalMethods
}
});
Loading