Browse Source

advancing federation

psy 2 years ago
parent
commit
5e6e891607
3 changed files with 65 additions and 37 deletions
  1. 51 3
      package-lock.json
  2. 1 1
      package.json
  3. 13 33
      src/views/index.js

+ 51 - 3
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@krakenslab/oasis",
-  "version": "0.2.4",
+  "version": "0.2.5",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -15657,7 +15657,8 @@
         },
         "ini": {
           "version": "1.3.5",
-          "resolved": ""
+          "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
+          "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
         },
         "int53": {
           "version": "1.0.0",
@@ -17397,7 +17398,8 @@
         },
         "path-parse": {
           "version": "1.0.6",
-          "resolved": ""
+          "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
+          "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
         },
         "path-type": {
           "version": "3.0.0",
@@ -19013,6 +19015,52 @@
             "ssb-client": "^4.9.0",
             "ssb-keys": "^7.2.2",
             "ssb-ref": "^2.14.0"
+          },
+          "dependencies": {
+            "abstract-leveldown": {
+              "version": "6.2.3",
+              "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz",
+              "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==",
+              "requires": {
+                "buffer": "^5.5.0",
+                "immediate": "^3.2.3",
+                "level-concat-iterator": "~2.0.0",
+                "level-supports": "~1.0.0",
+                "xtend": "~4.0.0"
+              }
+            },
+            "level": {
+              "version": "6.0.1",
+              "resolved": "https://registry.npmjs.org/level/-/level-6.0.1.tgz",
+              "integrity": "sha512-psRSqJZCsC/irNhfHzrVZbmPYXDcEYhA5TVNwr+V92jF44rbf86hqGp8fiT702FyiArScYIlPSBTDUASCVNSpw==",
+              "requires": {
+                "level-js": "^5.0.0",
+                "level-packager": "^5.1.0",
+                "leveldown": "^5.4.0"
+              }
+            },
+            "level-js": {
+              "version": "5.0.2",
+              "resolved": "https://registry.npmjs.org/level-js/-/level-js-5.0.2.tgz",
+              "integrity": "sha512-SnBIDo2pdO5VXh02ZmtAyPP6/+6YTJg2ibLtl9C34pWvmtMEmRTWpra+qO/hifkUtBTOtfx6S9vLDjBsBK4gRg==",
+              "requires": {
+                "abstract-leveldown": "~6.2.3",
+                "buffer": "^5.5.0",
+                "inherits": "^2.0.3",
+                "ltgt": "^2.1.2"
+              }
+            },
+            "ssb-ref": {
+              "version": "2.16.0",
+              "resolved": "https://registry.npmjs.org/ssb-ref/-/ssb-ref-2.16.0.tgz",
+              "integrity": "sha512-ylyrfz9NLxwTCbeDDAdLo++O3elhNs6/gUqMhZ22F+gSOIjwXy2X7dpg5Q1YTH7uALOSu307Rpo1UfK9sj7Sjw==",
+              "requires": {
+                "ip": "^1.1.3",
+                "is-canonical-base64": "^1.1.1",
+                "is-valid-domain": "~0.0.1",
+                "multiserver-address": "^1.0.1"
+              }
+            }
           }
         },
         "ssb-keys": {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@krakenslab/oasis",
-  "version": "0.2.4",
+  "version": "0.2.5",
   "description": "SNH-Oasis Project Network GUI",
   "repository": {
     "type": "git",

+ 13 - 33
src/views/index.js

@@ -7,7 +7,7 @@ const fs = require("fs");
 const homedir = require('os').homedir();
 
 const supportingPath = path.join(homedir, ".ssb/flume/contacts2.json");
-const offsetPath = path.join(homedir, ".ssb/flume/log.offset");
+const offsetPath = path.join(homedir, ".ssb/gossip.json");
 
 const debug = require("debug")("oasis");
 const highlightJs = require("highlight.js");
@@ -1170,41 +1170,21 @@ exports.peersView = async ({ peers }) => {
 exports.invitesView = ({ invites }) => {
   const pubsList = (pub)
     var pubs = fs.readFileSync(offsetPath, "utf8");
-    var arr = pubs.split(/[{,}]/);
+    var pubs = JSON.parse(pubs);
     const arr2 = [];
     const arr3 = [];
-    var host = [];
-    var id = [];
-    for(var i in arr){
-        arr.push(arr[i]);
-    }
-    for(var i=0; i<arr.length; i++){
-      if (arr[i] === '"address":') {
-      host = arr[i+1].split(':').pop().split(';')[0].split('"')[1];
-      id = arr[i+3].split(':').pop().split(';')[0].split('"')[1];
-      }
-
-      if (!arr2.includes(host + ":" + id)){
-         arr2.push(host + ":" + id)
-      }
-      var f = arr2.filter(function (el) {
-         return el != "" & el != ":";
-      });
-    }
-    for(const v of f){
-         var h = v.split(":")[0];
-         var i = v.split(":")[1];
-         arr3.push(
-               li(
-                "PUB: " + h, br, 
-                 a(
-                  { href: `/author/${encodeURIComponent(i)}` }, 
-                  i
-                 ), br, br
-               )
-         );
+    for(var i=0; i<pubs.length; i++){
+      arr2.push(
+        li("PUB: " + pubs[i].host, br, 
+            i18n.inhabitants + ": " + pubs[i].announcers, br, 
+            a(
+             { href: `/author/${encodeURIComponent(pubs[i].key)}` }, 
+              pubs[i].key
+             ), br, br
+        )               
+      );
     }
-    var pub = arr3;
+    var pub = arr2;
 
  return template(
   i18n.invites,