|
@@ -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,
|