Kaynağa Gözat

Improved example HTML

	* Use a stagged server
	* Add Dockerfile for deploying
develop
Silvestr Predko 2 yıl önce
ebeveyn
işleme
a9cb739e5a
4 değiştirilmiş dosya ile 553 ekleme ve 635 silme
  1. 5
    0
      example/Dockerfile
  2. 21
    8
      example/assets/index.html
  3. 523
    626
      example/package-lock.json
  4. 4
    1
      example/src/index.ts

+ 5
- 0
example/Dockerfile Dosyayı Görüntüle

@@ -0,0 +1,5 @@
1
+FROM nginx
2
+
3
+COPY dist /usr/share/nginx/html/
4
+
5
+ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"]

+ 21
- 8
example/assets/index.html Dosyayı Görüntüle

@@ -7,20 +7,33 @@
7 7
 </head>
8 8
 
9 9
 <body>
10
-    <div>
10
+    <div class="sign-in" style="margin:10px">
11 11
         <label for="account">Account: </label>
12
-        <input type="text" id="account_id" name="account"><br><br>
13
-        <input type="submit" value="Login" id="login_id"><br><br>
12
+        <input type="text" id="account_id" name="account">
13
+        <button id="login_id">Login</button>
14
+    </div>
14 15
 
16
+    <div style="margin: 10px">
15 17
         <label for="login_id">Init meeting with participants:</label>
16
-        <input type="text" id="inp_participants" name="meeting"><br><br>
17
-        <input type="submit" value="Start Meeting" id="start_meeting_id"><br><br>
18
+        <input type="text" id="inp_participants" name="meeting">
19
+        <button id="start_meeting_id">Start Meeting</button>
20
+    </div>
21
+
22
+    <div for="meeting_id_label" style="margin: 10px">
23
+        Meeting Id: <span id="meeting_id_label">...</span>
24
+    </div>
18 25
 
26
+    <div style="margin: 10px">
19 27
         <label for="meeting_id">Meeting Id: </label>
20
-        <input type="text" id="inp_meeting_id" name="meeting"><br><br>
21
-        <input type="submit" value="Join Meeting" id="join_meeting_id"><br><br>
28
+        <input type="text" id="inp_meeting_id" name="meeting">
29
+        <button id="join_meeting_id">Join Meeting</button>
30
+    </div>
31
+
32
+    <div for="secret_id_label" style="margin: 10px">
33
+        Secret: <span id="secret_id_label">...</span>
22 34
     </div>
23
-    <script src="main.js"></script>
24 35
 </body>
25 36
 
26 37
 </html>
38
+
39
+<script src="main.js"></script>

+ 523
- 626
example/package-lock.json
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 4
- 1
example/src/index.ts Dosyayı Görüntüle

@@ -54,7 +54,7 @@ async function handle_wallet(wallet_connection: WalletConnection, near_connectio
54 54
     let accessKeys = await account.getAccessKeys();
55 55
     let found = accessKeys.find(key => key.public_key.toString() == keypair.getPublicKey().toString());
56 56
 
57
-    let config = new ProvisionerConfig("contract2.demoacc.testnet", "https://rpc.testnet.near.org", "http://127.0.0.1:3000");
57
+    let config = new ProvisionerConfig("contract2.demoacc.testnet", "https://rpc.testnet.near.org", "http://servtest.relayz.io:3000");
58 58
     let provisioner = new KeyProvisioner(keypair.toString(), BigInt(found.access_key.nonce), account_id.toString(), config);
59 59
 
60 60
     console.log("KeyPair: ", keypair.getPublicKey().toString());
@@ -65,8 +65,10 @@ async function handle_wallet(wallet_connection: WalletConnection, near_connectio
65 65
         if (participants.length > 0) {
66 66
             console.log("Participants: " + participants);
67 67
             provisioner.init(new Set(participants.split(","))).then((id) => {
68
+                (document.getElementById("meeting_id_label") as HTMLSpanElement).textContent = id;
68 69
                 console.log("Meeting Id:", id);
69 70
                 provisioner.send_keys(id).then((secret_key) => {
71
+                    (document.getElementById("secret_id_label") as HTMLSpanElement).textContent = secret_key;
70 72
                     console.log("Secret Key" + secret_key);
71 73
                 }).catch((err) => {
72 74
                     console.log("Error: " + err.err_msg());
@@ -83,6 +85,7 @@ async function handle_wallet(wallet_connection: WalletConnection, near_connectio
83 85
         if (meeting_id.length > 0) {
84 86
             provisioner.push_to_near(meeting_id).then((id) => {
85 87
                 provisioner.get_key(meeting_id).then((secret_key) => {
88
+                    (document.getElementById("secret_id_label") as HTMLSpanElement).textContent = secret_key;
86 89
                     console.log("Secret Key" + secret_key);
87 90
                 }).catch((err) => {
88 91
                     console.log("ErrorType: " + ErrorType[err.err_type()]);

Loading…
İptal
Kaydet