-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.html
182 lines (149 loc) · 4.94 KB
/
test.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
* {
font-family: 'Roboto', sans-serif;
}
body {
max-width: 600px;
margin-left: auto;
margin-right: auto;
margin-bottom:24px;
}
button {
background-color: rgb(230, 230, 230);
padding: 10px;
border-radius: 0px;
border-width: 0px;
transition: 200ms;
}
button:hover {
background-color: rgb(206, 206, 206);
}
button:focus {
background-color: rgb(199, 199, 199);
}
.divider {
margin-top: 10px;
margin-bottom: 10px;
border-width: 1px;
border-style: solid;
width: 100%;
border-color: rgb(230, 230, 230);
}
.card {
background-color: rgb(230, 230, 230);
padding: 10px;
margin-bottom: 5px;
}
p {
margin-top: 0px
}
input {
border-radius: 0px;
border-width: 0px;
background-color: rgb(230, 230, 230);
padding: 0px;
padding-top: 10px;
padding-bottom: 10px;
width: 100%;
display: block;
text-indent: 10px;
margin-bottom: 5px
}
form, .inputCard {
padding: 10px;
background-color: rgb(243, 243, 243);
text-align: right;
}
</style>
</head>
<body>
<div>
<h1>purecore.io quick testing tool</h1>
<div class="divider"></div>
<section>
<h1>profiles</h1>
<div id="profiles">
</div>
<div class="inputCard">
<button onclick="login('minecraft')">minecraft</button>
<button onclick="login('microsoft')">microsoft</button>
<button onclick="login('google')">google</button>
<button onclick="login('steam')">steam</button>
<button onclick="login('github')">github</button>
<button onclick="login('discord')">discord</button>
</div>
</section>
<div class="divider"></div>
<section>
<h1>networks</h1>
<div id="networks">
</div>
<form onsubmit="createNetwork(event)">
<input placeholder="name" type="text" />
<input placeholder="cname" type="text" />
<button>Create Network</button>
</form>
</section>
<section>
<h1>wallets</h1>
<div id="wallets">
</div>
<div class="inputCard">
<button onclick="wallet('stripe')">stripe</button>
<button onclick="wallet('paypal')">paypal</button>
<button onclick="wallet('mollie')">mollie</button>
<button onclick="wallet('coinbase')">coinbase</button>
</div>
</section>
</div>
<script>
let core = new Core(undefined, true)
let user;
function login(method) {
console.log("login")
core.login(method).then(async () => {
user = await core.getUser()
loadEverything()
})
}
async function loadEverything() {
if (!user) user = await core.getUser()
loadProfiles()
loadNetworks()
}
async function loadProfiles() {
document.getElementById("profiles").innerHTML = ""
const profiles = await user.getProfiles()
profiles.forEach(profile => {
document.getElementById("profiles").innerHTML += `<div class="card"><p>${profile.externalName} (${profile.service})</p>${profile.id} - ${profile.externalId}</div>`
});
}
async function createNetwork(event) {
event.preventDefault();
const name = event.target[0].value
const cname = event.target[1].value
const network = await user.asOwner().createNetwork(name, cname)
await loadNetworks()
}
async function loadNetworks() {
document.getElementById("networks").innerHTML = ""
const networks = await user.asOwner().getNetworks()
networks.forEach(network => {
document.getElementById("networks").innerHTML += `<div class="card">${network.name} (${network.id})</div>`
});
}
async function wallet(service) {
console.log(await user.linkWallet('stripe'))
}
loadEverything()
</script>
</body>
</html>