Skip to content

Commit 6a6389d

Browse files
authored
Merge pull request #4 from TrustTunnel/fix/offline_notice
Inform user that QR code generator works offline
2 parents d5b3556 + 22f15b0 commit 6a6389d

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

qr.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ <h1 class="text-3xl font-bold text-gray-900 mb-2 text-center">Import TrustTunnel
3737
<form id="link-form" class="max-w-xl mx-auto">
3838
<label for="link-input" class="block text-sm font-medium text-gray-700 mb-2">Enter TrustTunnel configuration link</label>
3939
<input type="text" id="link-input" placeholder="tt://?AQAL..." class="w-full px-4 py-3 border border-gray-300 rounded-lg text-gray-900 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
40-
<button type="submit" class="mt-4 w-full px-6 py-3 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700 transition-colors">Submit</button>
40+
<button type="submit" class="mt-4 w-full px-6 py-3 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700 transition-colors">Generate QR Code Locally</button>
4141
</form>
42+
<p class="mt-4 text-sm text-gray-500 text-center">This is an offline QR code generator. Your data is processed entirely in your browser and is never sent to any server. You can also <a href="#" id="download-page-link" class="text-blue-600 hover:text-blue-800 underline">download this page</a> to run it locally.</p>
4243
</div>
4344

4445
<!-- Error state -->
@@ -431,6 +432,21 @@ <h3 class="text-lg font-semibold text-gray-900">Configuration Details</h3>
431432
}
432433
});
433434

435+
// --- Download page for offline use ---
436+
document.getElementById('download-page-link').addEventListener('click', function (e) {
437+
e.preventDefault();
438+
var html = document.documentElement.outerHTML;
439+
var blob = new Blob(['<!DOCTYPE html>\n' + html], { type: 'text/html' });
440+
var url = URL.createObjectURL(blob);
441+
var a = document.createElement('a');
442+
a.href = url;
443+
a.download = 'trusttunnel-qr.html';
444+
document.body.appendChild(a);
445+
a.click();
446+
document.body.removeChild(a);
447+
URL.revokeObjectURL(url);
448+
});
449+
434450
// --- Init ---
435451
try {
436452
var payload = getPayloadFromHash();

0 commit comments

Comments
 (0)