Loading pdf from hash

This commit is contained in:
Vincent LAURENT 2022-03-31 11:53:55 +02:00
parent a41155c950
commit b6dad1dcf5
2 changed files with 18 additions and 1 deletions

View File

@ -947,7 +947,15 @@ var pageSignature = async function(url) {
fontCaveat = font;
});
let pdfBlob = await getPDFBlobFromCache(url);
if(hash) {
var response = await fetch(url);
if(response.status != 200) {
return;
}
let pdfBlob = await response.blob();
} else {
let pdfBlob = await getPDFBlobFromCache(url);
}
if(!pdfBlob) {
document.location = '/signature';
return;
@ -962,6 +970,11 @@ var pageSignature = async function(url) {
};
(function () {
if(hash) {
pageSignature('/signature/'+hash+'/pdf');
return;
}
if(window.location.hash && window.location.hash.match(/^\#http/)) {
let hashUrl = window.location.hash.replace(/^\#/, '');
pageUpload();

View File

@ -157,6 +157,10 @@
<script>
var maxSize = <?php echo $maxSize ?>;
var maxPage = <?php echo $maxPage ?>;
var hash = null;
<?php if(isset($hash)): ?>
hash = "<?php echo $hash ?>";
<?php endif; ?>
</script>
<script src="/js/signature.js?202203261059"></script>
</body>