aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-04-26 18:15:16 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-04-26 18:15:16 -0400
commit0a374a3dd1008864cb4d6ea0c67a5080f2427b28 (patch)
tree2c4c127af6de4036abb6bd8ec7569449db7476ae /lib
parent039e8c8727f4da40ff29e37f753284dad7e98454 (diff)
downloadpatchfoo-0a374a3dd1008864cb4d6ea0c67a5080f2427b28.tar.gz
patchfoo-0a374a3dd1008864cb4d6ea0c67a5080f2427b28.zip
simplified, does not ensure blobs anymore
Diffstat (limited to 'lib')
-rw-r--r--lib/channels-lib.js32
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/channels-lib.js b/lib/channels-lib.js
index e70bb2b..327ec38 100644
--- a/lib/channels-lib.js
+++ b/lib/channels-lib.js
@@ -1,9 +1,6 @@
var pull = require("pull-stream");
var Pushable = require("pull-pushable");
var many = require("./pull-many-v2");
-const fs = require("fs");
-const home = require("os").homedir();
-const path = require("path");
// Change to 'true' to get debugging output
DEBUG = false
@@ -12,10 +9,6 @@ FRIENDS_POLL_TIME = 1 // ms
GRAPH_TYPE = "follow"
MAX_HOPS = 1
-SBOT_ROOT = path.join(home, ".ssb");
-SBOT_BLOB_DIR = path.join(SBOT_ROOT, "blobs");
-SBOT_BLOBS_FILE = path.join(SBOT_BLOB_DIR, "allowed_blobs");
-
class StreamData {
constructor() {
this.finished = false,
@@ -33,7 +26,6 @@ class StreamController {
constructor(client, opts) {
this.client = client,
this.outputStream = Pushable(),
- this.allowedBlobs = [],
this.streamData = {
channelStream: new StreamData(),
hashtagStream: new StreamData(),
@@ -73,10 +65,6 @@ class StreamController {
}
this.pushNewlySafeMessages();
- fs.writeFile(SBOT_BLOBS_FILE, this.allowedBlobs.join("\n"), function(err) {
- debug("Failed to write allowed blobs to file: \n" + err);
- });
-
this.outputStream.end();
},
this.requestBlobs = function(msg) {
@@ -96,8 +84,6 @@ class StreamController {
}
}
this.getBlob = function(blobId) {
- this.allowedBlobs.push(blobId);
-
debug("Ensuring existence of blob with ID " + blobId);
client.blobs.has(blobId, function(err, has) {
if(err) {
@@ -116,7 +102,6 @@ class StreamController {
module.exports = {
getMessages: function(client, channelName, opts, preserve, cb, hops=MAX_HOPS) {
- ensureFiles();
client.friends.hops({
dunbar: Number.MAX_SAFE_INTEGER,
max: hops
@@ -192,23 +177,6 @@ function createChannelStream(client, channelName, opts) {
return query;
}
-function ensureFiles() {
- if (!fs.existsSync(SBOT_ROOT)) {
- debug("no ~/.ssb folder detected, creating it...");
- fs.mkdirSync(SBOT_ROOT);
- }
-
- if (!fs.existsSync(SBOT_BLOB_DIR)) {
- debug("no blobs folder detected, creating it...");
- fs.mkdirSync(SBOT_BLOB_DIR);
- }
-
- if (!fs.existsSync(SBOT_BLOBS_FILE)) {
- debug("no metadata file found, creating it...");
- fs.writeFileSync(SBOT_BLOBS_FILE, "");
- }
-}
-
function debug(message) {
if(DEBUG) {
var timestamp = new Date();