@@ -22,27 +22,37 @@ router.post('/', async function (req, res, next) {
2222
2323 let unlock = await DB . getLensUnlock ( lensId ) ;
2424 if ( unlock && unlock [ 0 ] ) {
25- console . log ( 'Re-downloading Unlock' , lensId ) ;
26- await Util . downloadUnlock ( unlock [ 0 ] . lens_id , unlock [ 0 ] . lens_url )
27- return res . json ( { } ) ;
25+ if ( unlock [ 0 ] . lens_id && unlock [ 0 ] . lens_url ) {
26+ console . log ( 'Re-downloading Unlock' , lensId ) ;
27+ await Util . downloadUnlock ( unlock [ 0 ] . lens_id , unlock [ 0 ] . lens_url )
28+ return res . json ( { } ) ;
29+ } else {
30+ console . warn ( 'Unlock Download URL is missing' , lensId ) ;
31+ }
2832 }
2933
3034 if ( useRelay ) {
35+ console . log ( 'Trying to get Unlock from relay server' , lensId ) ;
3136 unlock = await Util . getUnlockFromRelay ( lensId ) ;
3237 if ( unlock ) {
33- console . log ( 'Getting Unlock from relay server' , lensId ) ;
38+ console . log ( 'Received Unlock from relay server' , lensId ) ;
3439 await DB . insertUnlock ( unlock , true ) ;
3540 return res . json ( { } ) ;
41+ } else {
42+ console . log ( 'Failed to get Unlock from relay server' , lensId ) ;
3643 }
3744 }
3845
3946 if ( useWebSource ) {
4047 if ( lens && lens . uuid ) {
48+ console . log ( 'Trying to get Unlock from web' , lensId ) ;
4149 unlock = await Web . getUnlockByHash ( uuid ) ;
4250 if ( unlock ) {
43- console . log ( 'Getting Unlock from web' , lensId ) ;
51+ console . log ( 'Received Unlock from web' , lensId ) ;
4452 await DB . insertUnlock ( unlock , true ) ;
4553 return res . json ( { } ) ;
54+ } else {
55+ console . log ( 'Failed to get Unlock from web' , lensId ) ;
4656 }
4757 }
4858 }
0 commit comments