Kaynağa Gözat

added names to peers

psy 2 yıl önce
ebeveyn
işleme
dd36622c88
5 değiştirilmiş dosya ile 14 ekleme ve 58 silme
  1. 3 51
      package-lock.json
  2. 1 1
      package.json
  3. 6 0
      src/index.js
  4. 1 0
      src/supports.js
  5. 3 6
      src/views/index.js

+ 3 - 51
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@krakenslab/oasis",
-  "version": "0.2.7",
+  "version": "0.2.8",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -15897,8 +15897,7 @@
         },
         "ini": {
           "version": "1.3.5",
-          "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
-          "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
+          "resolved": ""
         },
         "int53": {
           "version": "1.0.0",
@@ -17638,8 +17637,7 @@
         },
         "path-parse": {
           "version": "1.0.6",
-          "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
-          "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
+          "resolved": ""
         },
         "path-type": {
           "version": "3.0.0",
@@ -19255,52 +19253,6 @@
             "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.7",
+  "version": "0.2.8",
   "description": "SNH-Oasis Project Network GUI",
   "repository": {
     "type": "git",

+ 6 - 0
src/index.js

@@ -748,6 +748,9 @@ router
   .get("/peers", async (ctx) => {
     const theme = ctx.cookies.get("theme") || config.theme;
     const getMeta = async ({ theme }) => {
+    const supports = require("./supports.js").supporting;
+    const blocks = require("./supports.js").blocking;
+    const recommends = require("./supports.js").recommending;
     const peers = await meta.connectedPeers();
     const peersWithNames = await Promise.all(
     peers.map(async ([key, value]) => {
@@ -756,6 +759,9 @@ router
      }))
     return peersView({
       peers: peersWithNames,
+      supports: supports,
+      blocks: blocks,
+      recommends: recommends,
     });
    };
     ctx.body = await getMeta({ theme });

+ 1 - 0
src/supports.js

@@ -59,6 +59,7 @@ async function getNameByIdRecommended(recommended){
           var supportingValue = "true";
         }
     }
+
     if (supportingValue === "true") {
       var arr = [];
       var keys = Object.keys(supporting);

+ 3 - 6
src/views/index.js

@@ -12,10 +12,6 @@ const prettyMs = require("pretty-ms");
 
 const updater = require("../updater.js");
 
-const supports = require("../supports.js").supporting;
-const blocks = require("../supports.js").blocking;
-const recommends = require("../supports.js").recommending;
-
 global.updaterequired = "";
 global.ck = updater.getRemoteVersion(async function(checkversion){
   if (checkversion === "required"){
@@ -1018,7 +1014,7 @@ exports.previewView = ({ previewData, contentWarning }) => {
   return exports.publishView(preview, previewData.text, contentWarning);
 };
 
-exports.peersView = async ({ peers }) => {
+exports.peersView = async ({ peers, supports, blocks, recommends }) => {
 
  const startButton = form(
     { action: "/settings/conn/start", method: "post" },
@@ -1051,9 +1047,10 @@ exports.peersView = async ({ peers }) => {
     .filter(([, data]) => data.state === "connected")
     .map(([, data]) => {
       return li(
+          data.name, br,
         a(
           { href: `/author/${encodeURIComponent(data.key)}` },
-          data.name || data.host || data.key
+          data.key, br, br
         )
       );
    });