Skip to content
Snippets Groups Projects
Commit a25e14bb authored by Otto Zaiser's avatar Otto Zaiser
Browse files

Limite 10 archivos

parent 8078e7b8
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html><html lang=es><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><link href="https://fonts.googleapis.com/css?family=Raleway:400,400i,700,700i" rel=stylesheet><link rel=stylesheet href=static/css/bootstrap.min.css><link rel=stylesheet href=static/css/style.css><link rel=stylesheet href=static/css/tsa2.css><title>Sello de Tiempo - Blockchain Federal Argentina</title><link href=tsa2.js rel=preload as=script></head><body><noscript><b>Lo sentimos pero el sello de tiempo no funciona sin JavaScript. Por favor, habilitalo para continuar.</b></noscript><nav id=navbar role=banner class="navbar navbar-default"><div class=container><div class=navbar-header><a class="logo navbar-btn pull-left" href=/ rel=home><img id=logo src=static/images/logo.svg alt="Blockchain Federal Argentina"></a></div></div></nav><main><div class=container><div class=tsa2><h1>Sello de Tiempo</h1><p>El servicio de Sello de Tiempo de BFA permite demostrar que el contenido de cualquier documento digital existió en un momento y que desde entonces, no ha cambiado. Al sellar un archivo, cualquiera podrá verificar el día y la hora en que su hash fue almacenado en Blockchain Federal Argentina. Tené en cuenta que el documento seleccionado nunca se sube a la red, garantizando su privacidad.</p><p class=font_small><a href=https://bfa.ar/sello>Si tenés un archivo con Recibo Digital (.rd) verificalo aquí</a></p><div id=app apiurl=http://200.108.146.131:3000 lb_00=" El archivo " lb_01=" fue enviado con éxito para ser sellado" lb_02="Se ha producido un error al intentar sellar " lb_03=" se encuentra sellado por: " lb_04=" en el bloque " lb_05="No se ha podido verificar el archivo " lb_06="Volver a Sellar o Verificar" lb_07=Cargando lb_08="Arrastrá archivos aquí<br>ó" lb_09="Seleccioná archivos <span class='sr-only'>para Sellar o Verificar</span>" lb_10="Nombre del archivo: " lb_11="Hash del archivo: " lb_12=Sellar lb_13=Verificar lb_14=" Agregar archivos" lb_15=" Copiar" lb_16="Enlace de verificación" lb_17="Remover archivo" lb_18="Seleccionar otros archivos"></div></div></div><script src=tsa2.js></script></main></body></html>
\ No newline at end of file
<!DOCTYPE html><html lang=es><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><link href="https://fonts.googleapis.com/css?family=Raleway:400,400i,700,700i" rel=stylesheet><link rel=stylesheet href=static/css/bootstrap.min.css><link rel=stylesheet href=static/css/style.css><link rel=stylesheet href=static/css/tsa2.css><title>Sello de Tiempo - Blockchain Federal Argentina</title><link href=tsa2.js rel=preload as=script></head><body><noscript><b>Lo sentimos pero el sello de tiempo no funciona sin JavaScript. Por favor, habilitalo para continuar.</b></noscript><nav id=navbar role=banner class="navbar navbar-default"><div class=container><div class=navbar-header><a class="logo navbar-btn pull-left" href=/ rel=home><img id=logo src=static/images/logo.svg alt="Blockchain Federal Argentina"></a></div></div></nav><main><div class=container><div class=tsa2><h1>Sello de Tiempo</h1><p>El servicio de Sello de Tiempo de BFA permite demostrar que el contenido de cualquier documento digital existió en un momento y que desde entonces, no ha cambiado. Al sellar un archivo, cualquiera podrá verificar el día y la hora en que su hash fue almacenado en Blockchain Federal Argentina. Tené en cuenta que el documento seleccionado nunca se sube a la red, garantizando su privacidad.</p><p class=font_small><a href=https://bfa.ar/sello>Si tenés un archivo con Recibo Digital (.rd) verificalo aquí</a></p><div id=app apiurl=http://200.108.146.180:3000 lb_00=" El archivo " lb_01=" fue enviado con éxito para ser sellado" lb_02="Se ha producido un error al intentar sellar " lb_03=" se encuentra sellado por: " lb_04=" en el bloque " lb_05="No se ha podido verificar el archivo " lb_06="Volver a Sellar o Verificar" lb_07=Cargando lb_08="Arrastrá archivos aquí<br>ó" lb_09="Seleccioná archivos <span class='sr-only'>para Sellar o Verificar</span>" lb_10="Nombre del archivo: " lb_11="Hash del archivo: " lb_12=Sellar lb_13=Verificar lb_14=" Agregar archivos" lb_15=" Copiar" lb_16="Enlace de verificación" lb_17="Remover archivo" lb_18="Seleccionar otros archivos" lb_19=" Solo se pueden agregar " lb_20=" archivos por vez"></div></div></div><script src=tsa2.js></script></main></body></html>
\ No newline at end of file
source diff could not be displayed: it is too large. Options to address this: view the blob.
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -32,7 +32,7 @@
<p>El servicio de Sello de Tiempo de BFA permite demostrar que el contenido de cualquier documento digital existió en un momento y que desde entonces, no ha cambiado. Al sellar un archivo, cualquiera podrá verificar el día y la hora en que su hash fue almacenado en Blockchain Federal Argentina. Tené en cuenta que el documento seleccionado nunca se sube a la red, garantizando su privacidad.</p>
<p class="font_small"><a href="https://bfa.ar/sello">Si tenés un archivo con Recibo Digital (.rd) verificalo aquí</a></p>
<div id="app"
apiurl="http://200.108.146.131:3000"
apiurl="http://200.108.146.180:3000"
lb_00=" El archivo "
lb_01=" fue enviado con éxito para ser sellado"
lb_02="Se ha producido un error al intentar sellar "
......@@ -52,6 +52,8 @@
lb_16="Enlace de verificación"
lb_17="Remover archivo"
lb_18="Seleccionar otros archivos"
lb_19=" Solo se pueden agregar "
lb_20=" archivos por vez"
></div>
</div>
......
<template>
<div id="app">
<div id="app">
<div v-if="limite != 0" class="alert alert-danger" role="alert">
<p><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> <span v-html="this.lb_19"></span> <span v-html="this.limite"></span><span v-html="this.lb_20"></span></p>
</div>
<div>
<div v-if="state == 'stamped'" class="dropAreasuccess-stamp alert alert-success" role="alert">
<p><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <span v-html="this.lb_00"></span> <b>{{archivo}}</b> <span v-html="this.lb_01"></span></p>
......@@ -69,9 +72,12 @@
:lb_14="lb_14"
:lb_17="lb_17"
:lb_18="lb_18"
:lb_19="lb_19"
:lb_20="lb_20"
v-if="state == 'visible-drop'"
v-on:stamp="onStamp"
v-on:failed-stamp="onFailedStamp()"
v-on:limit-surpassed="onLimitSurpassed"
v-on:verify="onVerify"
v-on:verify-completed="onVerifyCompleted"
v-on:failed-verify="onFailedVerify()"
......@@ -104,7 +110,9 @@
'lb_15',
'lb_16',
'lb_17',
'lb_18'
'lb_18',
'lb_19',
'lb_20'
],
computed: {
hash () {
......@@ -114,6 +122,7 @@
data: function() {
return {
state: 'visible-drop',
limite: 0,
archivo: '',
allFiles: [],
stamps: []
......@@ -145,7 +154,10 @@
},
onFilename (value) {
this.archivo = value
},
},
onLimitSurpassed (value) {
this.limite = value
},
getHashURL(index){
var url;
//console.log(index);
......
......@@ -49,7 +49,7 @@
</div>
<!-- <li v-for="(file,index) in uploadedFiles" v-bind:key="index">{{file.fileName}}: {{file.hash}}</li> -->
</div>
<div class="add-btn" v-if="uploadedFiles.length > 0" >
<div class="add-btn" v-if="uploadedFiles.length > 0 && uploadedFiles.length <= limit-1" >
<a class="btn btn-default btn-pill" href="#" v-on:click.stop.prevent="addFile" >
<span class="glyphicon glyphicon-plus text-primary " aria-hidden="true"></span>
<span v-html="this.lb_14"></span>
......@@ -85,11 +85,14 @@ export default {
'lb_13',
'lb_14',
'lb_17',
'lb_18'
'lb_18',
'lb_19',
'lb_20'
],
data: function() {
return {
loading: false,
loading: false,
limit: 10, // CAMBIAR ESTO SI SE PUEDE MAS DE 10 ARCHIVOS
uploadedFiles: [],
verifyCounter: 0,
allHashes: [],
......@@ -108,16 +111,29 @@ export default {
if (this.uploadedFiles.length <= 0) this.uploadFile();
},
handleInput(e) {
if(e.target.files.length > 0){
var files = e.target.files
this.uploadFiles([files])
}
var files = e.target.files;
this.checkLimit(files);
},
handleDrop(e) {
var files = e.dataTransfer.files;
//console.log("Drop files:", files);
//this.uploadFile(files);
this.uploadFiles([files]);
this.checkLimit(files);
},
checkLimit(ufiles){
var self = this;
var files = ufiles;
var lfiles = files.length;
//Checkea si se agregran todos a la vez
if(lfiles > 0 && lfiles <= self.limit){
self.uploadFiles([files]);
}else{
self.limitSurpased(self.limit);
}
},
limitSurpased(value){
var self = this;
// console.log(self.lb_19+self.limit+self.lb_20);
self.$emit('limit-surpassed', value)
},
removeFile(e) {
//Lo saca del array pero no del input
......@@ -232,21 +248,26 @@ export default {
let reader = new FileReader()
reader.onload = function(e) {
let contents = e.target.result
let hash = SHA256.create()
hash.update(contents)
let hex = hash.hex()
//Checks if already exists
if(self.allHashes.indexOf(hex) === -1){
self.uploadedFiles.push({
fileName: name,
hash: hex
});
self.allHashes.push(hex)
} else{
//file already uploaded
if(self.uploadedFiles.length < self.limit){
let contents = e.target.result
let hash = SHA256.create()
hash.update(contents)
let hex = hash.hex()
//Checks if already exists
if(self.allHashes.indexOf(hex) === -1){
self.uploadedFiles.push({
fileName: name,
hash: hex
});
self.allHashes.push(hex)
} else{
//file already uploaded
}
//self.uploadedFiles = self.getUnique(self.uploadedFiles, 'hash')
self.limitSurpased(0);
}else{
self.limitSurpased(self.limit);
}
//self.uploadedFiles = self.getUnique(self.uploadedFiles, 'hash')
self.loading = false;
};
reader.readAsArrayBuffer(file, "UTF-8")
......
......@@ -42,6 +42,8 @@ new Vue({
lb_16: this.$el.attributes.lb_16.value,
lb_17: this.$el.attributes.lb_17.value,
lb_18: this.$el.attributes.lb_18.value,
lb_19: this.$el.attributes.lb_19.value,
lb_20: this.$el.attributes.lb_20.value,
}
})
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment