This repository has been archived by the owner on Apr 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
85 lines (78 loc) · 3.38 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html lang="en">
<head>
<meta name="viewport" content="width=device-width">
<title>HTTP storage</title>
<script src="/login/client.js"></script>
<script>
meeshkan.onUser = (user) => {
let signedInStatus = document.getElementById('signedInStatus');
if (user == null) {
let signInButton = document.createElement('input');
signInButton.setAttribute('type', 'button');
signInButton.setAttribute('value', 'Sign in');
signInButton.onclick = () => { meeshkan.signIn(); }
signedInStatus.appendChild(signInButton);
document.getElementById('info').textContent = 'Stored data will show up here after signing in using the button at the top of the page.';
return;
}
signedInStatus.innerHTML = '';
signedInStatus.appendChild(document.createTextNode('Signed in: ' + user.email + ' '));
let signOutButton = document.createElement('input');
signOutButton.setAttribute('type', 'button');
signOutButton.setAttribute('value', 'Sign out');
signOutButton.onclick = () => { meeshkan.signOut(); }
signedInStatus.appendChild(signOutButton);
fetch('/http-storage/hosts', {
method: 'POST',
body: JSON.stringify({'access_token': user.accessToken})
})
.then((response) => {
return response.json();
})
.then((data) => {
let info = document.getElementById('info');
info.innerHTML = '';
if (Object.entries(data).length == 0) {
info.textContent = 'No data currently stored.';
}
console.log(data)
let ul = document.createElement('ui');
for (const [host, count] of Object.entries(data)) {
var li = document.createElement('li');
var downloadButton = document.createElement('input');
downloadButton.setAttribute('type', 'button');
downloadButton.value = 'Download';
downloadButton.onclick = () => {
window.location.href = '/http-storage/download?host=' + encodeURIComponent(host) + '&access_token=' + encodeURIComponent(user.accessToken);
};
li.appendChild(downloadButton);
li.appendChild(document.createTextNode(' '));
var schemaButton = document.createElement('input');
schemaButton.setAttribute('type', 'button');
schemaButton.value = 'Build schema';
schemaButton.onclick = () => {
window.location.href = '/http-storage/generate-schema?host=' + encodeURIComponent(host) + '&access_token=' + encodeURIComponent(user.accessToken);
};
li.appendChild(schemaButton);
li.appendChild(document.createTextNode(` ${host} (${count} exchanges) `));
ul.appendChild(li);
}
info.appendChild(ul);
});
};
</script>
</head>
<body>
<div id="signedInStatus"></div>
<h1>HTTP storage</h1>
<p>Here you can store HTTP traffic data in the <a href="https://meeshkan.github.io/http-types/">http-types</a> format using a UUID key as shown below:</p>
<p><code>UUID=`uuidgen`</code></p>
<p><code>curl --data-binary @recordings.jsonl https://meeshkan.io/http-storage/$UUID</code></p>
<p>Then visit the same URL in the browser to claim the data.</p>
<h2>Stored data</h2>
<div id="info">Loading...</div>
<h2>About</h2>
<p>See the <a href="https://github.com/meeshkan/meeshkan-hosted-http-storage">meeshkan-hosted-http-storage repository</a> for how this service is built.</p>
<p><a href="/">See all services on meeshkan.io</a></p>
</body>
</html>