psy 2 лет назад
Родитель
Сommit
59ed9ddfdc
5 измененных файлов с 197 добавлено и 15 удалено
  1. 167 1
      package-lock.json
  2. 4 2
      package.json
  3. 14 2
      src/server.js
  4. 0 6
      src/ssb/flotilla.js
  5. 12 4
      src/views/index.js

+ 167 - 1
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@krakenslab/oasis",
-  "version": "0.2.0",
+  "version": "0.2.1",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -1549,6 +1549,11 @@
         "fill-range": "^7.0.1"
       }
     },
+    "broadcast-stream": {
+      "version": "0.2.2",
+      "resolved": "https://registry.npmjs.org/broadcast-stream/-/broadcast-stream-0.2.2.tgz",
+      "integrity": "sha512-d6iHc4P5YC2RvXv6qZxH3aoue88BiWhzCPki+i1Dj2igeZyNtUoMInloINRfnyrB7Fm+2f1q1bmQYhXQeKWwkQ=="
+    },
     "browser-process-hrtime": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz",
@@ -6965,6 +6970,11 @@
         "is-wsl": "^2.2.0"
       }
     },
+    "opencollective-postinstall": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz",
+      "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q=="
+    },
     "opener": {
       "version": "1.5.2",
       "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
@@ -9999,6 +10009,162 @@
         "ssb-ref": "^2.14.3"
       }
     },
+    "ssb-links": {
+      "version": "3.0.10",
+      "resolved": "https://registry.npmjs.org/ssb-links/-/ssb-links-3.0.10.tgz",
+      "integrity": "sha512-p6rH5dcwebRnwGRBfBpkOV49ZLLApGX+hppHwJtBsWKTXIKZFu4+9pGuRHmC1UNa+B5A2wELjo4Ru1AMQdYGwA==",
+      "requires": {
+        "flumeview-links": "^1.0.1",
+        "map-filter-reduce": "^2.0.0",
+        "ssb-msgs": "^5.2.0"
+      },
+      "dependencies": {
+        "abstract-leveldown": {
+          "version": "6.0.3",
+          "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.0.3.tgz",
+          "integrity": "sha512-jzewKKpZbaYUa6HTThnrl+GrJhzjEAeuc7hTVpZdzg7kupXZFoqQDFwyOwLNbmJKJlmzw8yiipMPkDiuKkT06Q==",
+          "requires": {
+            "level-concat-iterator": "~2.0.0",
+            "xtend": "~4.0.0"
+          }
+        },
+        "deep-equal": {
+          "version": "2.1.0",
+          "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.1.0.tgz",
+          "integrity": "sha512-2pxgvWu3Alv1PoWEyVg7HS8YhGlUFUV7N5oOvfL6d+7xAmLSemMwv/c8Zv/i9KFzxV5Kt5CAvQc70fLwVuf4UA==",
+          "requires": {
+            "call-bind": "^1.0.2",
+            "es-get-iterator": "^1.1.2",
+            "get-intrinsic": "^1.1.3",
+            "is-arguments": "^1.1.1",
+            "is-date-object": "^1.0.5",
+            "is-regex": "^1.1.4",
+            "isarray": "^2.0.5",
+            "object-is": "^1.1.5",
+            "object-keys": "^1.1.1",
+            "object.assign": "^4.1.4",
+            "regexp.prototype.flags": "^1.4.3",
+            "side-channel": "^1.0.4",
+            "which-boxed-primitive": "^1.0.2",
+            "which-collection": "^1.0.1",
+            "which-typed-array": "^1.1.8"
+          }
+        },
+        "flumeview-level": {
+          "version": "3.0.14",
+          "resolved": "https://registry.npmjs.org/flumeview-level/-/flumeview-level-3.0.14.tgz",
+          "integrity": "sha512-Nl0gJOgrDGpJGZDkP6gvo6s1Q9WmRynbHUvI/JY3eQ81YgzUUa2FKLlfu6OHV5ho5NeXP+00F+0K1yBVaEgJOQ==",
+          "requires": {
+            "charwise": "^3.0.1",
+            "explain-error": "^1.0.4",
+            "level": "^5.0.0",
+            "ltgt": "^2.1.3",
+            "mkdirp": "^0.5.1",
+            "obv": "0.0.1",
+            "pull-level": "^2.0.3",
+            "pull-paramap": "^1.2.1",
+            "pull-stream": "^3.5.0",
+            "pull-write": "^1.1.1"
+          }
+        },
+        "flumeview-links": {
+          "version": "1.0.1",
+          "resolved": "https://registry.npmjs.org/flumeview-links/-/flumeview-links-1.0.1.tgz",
+          "integrity": "sha512-X7enLH2Ijoav3xA+EPoahf5e1RjMoRaHWQcG/RyHvpXbV/qlhEgH2zwIi8kg+Ezt90KTtnGxVygcSZ7RGpdkng==",
+          "requires": {
+            "deep-equal": "^2.0.3",
+            "flumeview-level": "^3.0.14",
+            "map-filter-reduce": "^3.2.2",
+            "pull-flatmap": "0.0.1",
+            "pull-stream": "^3.6.14"
+          },
+          "dependencies": {
+            "map-filter-reduce": {
+              "version": "3.2.2",
+              "resolved": "https://registry.npmjs.org/map-filter-reduce/-/map-filter-reduce-3.2.2.tgz",
+              "integrity": "sha512-p+NIGQbEBxlw/qWwG+NME98G/9kjOQI70hmaH8QEZtIWfTmfMYLKQW4PJChP4izPHNAxlOfv/qefP0+2ZXn84A==",
+              "requires": {
+                "binary-search": "^1.2.0",
+                "compare-at-paths": "^1.0.0",
+                "pull-sink-through": "0.0.0",
+                "pull-sort": "^1.0.1",
+                "pull-stream": "^3.4.3",
+                "typewiselite": "^1.0.0"
+              }
+            }
+          }
+        },
+        "immediate": {
+          "version": "3.2.3",
+          "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz",
+          "integrity": "sha512-RrGCXRm/fRVqMIhqXrGEX9rRADavPiDFSoMb/k64i9XMk8uH4r/Omi5Ctierj6XzNecwDbO4WuFbDD1zmpl3Tg=="
+        },
+        "isarray": {
+          "version": "2.0.5",
+          "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+          "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="
+        },
+        "level": {
+          "version": "5.0.1",
+          "resolved": "https://registry.npmjs.org/level/-/level-5.0.1.tgz",
+          "integrity": "sha512-wcak5OQeA4rURGacqS62R/xNHjCYnJSQDBOlm4KNUGJVE9bWv2B04TclqReYejN+oD65PzD4FsqeWoI5wNC5Lg==",
+          "requires": {
+            "level-js": "^4.0.0",
+            "level-packager": "^5.0.0",
+            "leveldown": "^5.0.0",
+            "opencollective-postinstall": "^2.0.0"
+          }
+        },
+        "level-js": {
+          "version": "4.0.2",
+          "resolved": "https://registry.npmjs.org/level-js/-/level-js-4.0.2.tgz",
+          "integrity": "sha512-PeGjZsyMG4O89KHiez1zoMJxStnkM+oBIqgACjoo5PJqFiSUUm3GNod/KcbqN5ktyZa8jkG7I1T0P2u6HN9lIg==",
+          "requires": {
+            "abstract-leveldown": "~6.0.1",
+            "immediate": "~3.2.3",
+            "inherits": "^2.0.3",
+            "ltgt": "^2.1.2",
+            "typedarray-to-buffer": "~3.1.5"
+          }
+        },
+        "map-filter-reduce": {
+          "version": "2.2.1",
+          "resolved": "https://registry.npmjs.org/map-filter-reduce/-/map-filter-reduce-2.2.1.tgz",
+          "integrity": "sha512-A/pDveT5HWrJk8II4gH6QhuDIYs+FC7X8eAmACyNJsWpIF35/wSWIHi6h+9EDUj3u46qfjBmfL4TW/70m0I8ZQ==",
+          "requires": {
+            "binary-search": "^1.2.0",
+            "pull-sink-through": "0.0.0",
+            "pull-stream": "^3.3.0",
+            "typewiselite": "^1.0.0"
+          }
+        },
+        "mkdirp": {
+          "version": "0.5.6",
+          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
+          "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
+          "requires": {
+            "minimist": "^1.2.6"
+          }
+        },
+        "typedarray-to-buffer": {
+          "version": "3.1.5",
+          "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
+          "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
+          "requires": {
+            "is-typedarray": "^1.0.0"
+          }
+        }
+      }
+    },
+    "ssb-local": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/ssb-local/-/ssb-local-1.0.0.tgz",
+      "integrity": "sha512-aIkz+tDsAQFLbcN5d9itipHG71EG62UdIwojz78BQBxD7kGTwMezZofkMplURp9/njwdqMiqxYEUMvOh8Emh/w==",
+      "requires": {
+        "broadcast-stream": "^0.2.2",
+        "ssb-ref": "^2.13.9"
+      }
+    },
     "ssb-logging": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/ssb-logging/-/ssb-logging-1.0.0.tgz",

+ 4 - 2
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@krakenslab/oasis",
-  "version": "0.2.0",
+  "version": "0.2.1",
   "description": "SNH-Oasis Project Network GUI",
   "repository": {
     "type": "git",
@@ -63,6 +63,8 @@
     "ssb-invite": "^3.0.1",
     "ssb-keys": "^8.0.0",
     "ssb-lan": "^1.0.0",
+    "ssb-links": "^3.0.10",
+    "ssb-local": "^1.0.0",
     "ssb-logging": "^1.0.0",
     "ssb-markdown": "^6.0.7",
     "ssb-master": "^1.0.3",
@@ -79,12 +81,12 @@
     "ssb-replicate": "^1.3.0",
     "ssb-room": "^1.3.0",
     "ssb-search": "^1.3.0",
+    "ssb-server": "^15.3.0",
     "ssb-tangle": "^1.0.1",
     "ssb-thread-schema": "^1.1.1",
     "ssb-unix-socket": "^1.0.0",
     "ssb-ws": "^6.2.3",
     "ssb-gossip": "^1.1.1",
-    "ssb-server": "^15.3.0",
     "ssb-tunnel": "^2.0.0",
     "yargs": "^17.0.0"
   },

+ 14 - 2
src/server.js

@@ -1,12 +1,15 @@
 var Server = require('ssb-server')
+var SecretStack = require('secret-stack')
+var SSB = require('ssb-db')
+var caps = require('ssb-caps')
 var config = require('ssb-config')
 var fs = require('fs')
 var path = require('path')
 
 // add required plugins
 Server
-  .use(require('ssb-master'))
   .use(require('ssb-db'))
+  .use(require('ssb-master'))
   .use(require('ssb-replicate'))
   .use(require('ssb-backlinks'))
   .use(require('ssb-conn'))
@@ -19,17 +22,19 @@ Server
   .use(require('ssb-about'))
   .use(require('ssb-ebt'))
   .use(require('ssb-invite'))
+  .use(require('ssb-local'))
   .use(require('ssb-lan'))
+  .use(require('ssb-links'))
   .use(require('ssb-logging'))
   .use(require('ssb-meme'))
   .use(require('ssb-no-auth'))
   .use(require('ssb-onion'))
   .use(require('ssb-ooo'))
   .use(require('ssb-plugins'))
-  .use(require('ssb-private1'))
   .use(require('ssb-unix-socket'))
   .use(require('ssb-ws'))
   .use(require('ssb-tunnel'))
+  .use(require("ssb-private1"))
 
 // load config into ssb
 var server = Server(config)
@@ -40,3 +45,10 @@ fs.writeFileSync(
   path.join(config.path, 'manifest.json'), // ~/.ssb/manifest.json
   JSON.stringify(manifest)
 )
+
+// create server
+function createSsbServer () {
+  return SecretStack({ caps }).use(SSB)
+}
+module.exports = createSsbServer()
+

+ 0 - 6
src/ssb/flotilla.js

@@ -6,13 +6,9 @@ const ssbConfig = require("ssb-config");
 const plugins = [
   // Authentication often hooked for authentication.
   require("ssb-master"),
-  // Methods often used during init().
   require("ssb-db"),
-  // Method `replicate()` often hooked for improvements.
   require("ssb-replicate"),
-  // Required by ssb-about, ssb-tangle, etc.
   require("ssb-backlinks"),
-  // Required by ssb-room
   require("ssb-conn"),
   shuffle([
     require("ssb-about"),
@@ -39,8 +35,6 @@ const plugins = [
 
 module.exports = (config) => {
   const server = stack();
-
-  // TODO: Move this out of the main function.
   const walk = (input) => {
     if (Array.isArray(input)) {
       input.forEach(walk);

+ 12 - 4
src/views/index.js

@@ -1058,12 +1058,20 @@ exports.peersView = async ({ peers }) => {
       );
    });
 
-  const supportedList = (supporting)
   try{
-    var supporting = JSON.parse(fs.readFileSync(supportingPath, {encoding:'utf8', flag:'r'})).value;
-    var supportingValue = "true";
+      var supporting = JSON.parse(fs.readFileSync(supportingPath, {encoding:'utf8', flag:'r'})).value;
   }catch{
-    var supportingValue = "false";
+      var supporting = undefined;
+  }
+  if (supporting == undefined) {
+        var supportingValue = "false";
+  }else{
+        var keys = Object.keys(supporting);
+        if (keys[0] === undefined){
+          var supportingValue = "false";
+        }else{
+          var supportingValue = "true";
+        }
   }
   if (supportingValue === "true") {
     var arr = [];