From 35ea36ef330318a1856950cb7940802fd5be2642 Mon Sep 17 00:00:00 2001
From: dadav <33197631+dadav@users.noreply.github.com>
Date: Sat, 18 Apr 2020 10:09:20 +0200
Subject: [PATCH] auto redirect when decrypted

---
 builder/data/usr/bin/decryption-webserver | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/builder/data/usr/bin/decryption-webserver b/builder/data/usr/bin/decryption-webserver
index 96e7ba6..f968568 100755
--- a/builder/data/usr/bin/decryption-webserver
+++ b/builder/data/usr/bin/decryption-webserver
@@ -88,6 +88,29 @@ POST_RESPONSE = """
   text-align: center;
 }
 </style>
+<script type="text/javascript">
+
+function checkPwnagotchi() {
+    var xhr = new XMLHttpRequest();
+    xhr.open('GET', document.location.hostname + ':8080/');
+    xhr.onload = function () {
+    console.log('DONE: ', xhr.status);
+    };
+    xhr.onreadystatechange = function () {
+        if (xhr.readyState == 4) {
+            if (xhr.status == 200) {
+                window.location.replace("http://" + document.location.hostname + ':8080/');
+            }else{
+                setTimeout(checkPwnagotchi, 1000);
+            }
+        }
+    };
+    xhr.send();
+}
+
+setTimeout(checkPwnagotchi, 1000);
+
+</script>
 </head>
 <body style="margin:0;">