@@ -92,24 +92,6 @@ function getIfDeviceInAcceleration(x,y,z) {
9292 }
9393}
9494
95- async function collectHASH ( sha , meta ) {
96- meta = JSON . stringify ( meta )
97- meta = btoa ( meta )
98- const response = await fetch ( "https://mycookie-monster.herokuapp.com/collect-sha/" + sha , {
99- headers : { 'Content-Type' : 'application/json' , 'metadata' : meta } ,
100- method : 'GET' ,
101- } )
102- return response . json ( )
103- }
104-
105- async function scan ( ) {
106- const response = await fetch ( "https://mycookie-monster.herokuapp.com/scan" , {
107- headers : { 'Content-Type' : 'application/json' } ,
108- method : 'GET'
109- } )
110- return response . json ( )
111- }
112-
11395// Add SHA
11496async function addSHA ( sha , meta ) {
11597 meta = btoa ( meta )
@@ -157,7 +139,6 @@ nowFetch().then(response => {
157139
158140 const encodedDynamic = btoa ( JSON . stringify ( dynamicData ) )
159141 const HASH = sha1 ( encodedDynamic )
160- document . querySelector ( '.scan-container' ) . style . display = "block" ;
161142 document . querySelector ( '.visits' ) . textContent = `LOADING.......`
162143 addSHA ( HASH ) . then ( shaRESPONSE => {
163144 const visits = shaRESPONSE . visits
@@ -167,30 +148,6 @@ nowFetch().then(response => {
167148 console . log ( e )
168149 } )
169150
170- const optIn = document . querySelector ( '.optIn' )
171- optIn . addEventListener ( 'click' , ( e ) => {
172- e . preventDefault ( )
173- collectHASH ( HASH , data ) . then ( resp => { console . log ( resp ) } )
174- . catch ( e => { console . log ( e ) } )
175- } )
176-
177- const scanButton = document . querySelector ( '.scanButton' )
178- scanButton . addEventListener ( 'click' , async ( e ) => {
179- document . querySelector ( '.scan-results' ) . textContent = `Scanning.....` ;
180- await collectHASH ( HASH , data ) . then ( resp => { console . log ( resp ) } )
181- . catch ( e => { console . log ( e ) } )
182-
183- scan ( ) . then ( scanRes => {
184- document . querySelector ( '.scan-results' ) . textContent = `` ;
185- scanRes . items . map ( ( item , i ) => {
186- if ( item . sha === HASH ) {
187- scanRes . items . splice ( i , 1 )
188- }
189- } )
190- console . log ( scanRes )
191- } ) . catch ( e => { console . log ( e ) } )
192- } )
193-
194151 console . log ( "HASH:" + HASH )
195152 const hashPhrase = `Your identity HASH: ${ HASH } `
196153 const ipPhrase = `Your IP address is ${ data . ip } .` ;
0 commit comments