Skip to content

Instantly share code, notes, and snippets.

@arj03
Created January 31, 2021 20:06
Show Gist options
  • Save arj03/cedf85cff361ce0f08d151bd7b7d0adb to your computer and use it in GitHub Desktop.
Save arj03/cedf85cff361ce0f08d151bd7b7d0adb to your computer and use it in GitHub Desktop.
rooms wss
diff --git a/bin.js b/bin.js
old mode 100644
new mode 100755
diff --git a/config.js b/config.js
index 0b9c7ed..26f4a46 100644
--- a/config.js
+++ b/config.js
@@ -1,11 +1,9 @@
-const Config = require('ssb-config/inject');
+//const Config = require('ssb-config/inject');
const manifest = require('./manifest');
-const config = Config('ssb', {
+const config = {
manifest: manifest,
logging: {level: 'info'},
- port: 8008,
- host: '0.0.0.0',
replicate: {
legacy: true, // We don't need EBT because there is no pub-to-pub comms
},
@@ -14,12 +12,13 @@ const config = Config('ssb', {
},
connections: {
incoming: {
- net: [{scope: 'public', transform: 'shs', port: 8008, host: '0.0.0.0'}],
+ net: [{ port: 8888, host: "0.0.0.0", scope: "public", transform: "shs" }],
+ ws: [{ port: 9999, host: "::", scope: "public", transform: "shs", external: ["between-two-worlds.dk"], key: "/etc/letsencrypt/live/between-two-worlds.dk/privkey.pem", cert: "/etc/letsencrypt/live/between-two-worlds.dk/cert.pem" }],
},
outgoing: {
net: [{transform: 'shs'}],
},
},
-});
+}
module.exports = config;
diff --git a/index.js b/index.js
index 3bed3da..5300f72 100644
--- a/index.js
+++ b/index.js
@@ -1,11 +1,43 @@
const SecretStack = require('secret-stack');
+const manifest = require('./manifest');
+const dir = "/home/node/.ssb-room"
+const ssbKeys = require('ssb-keys')
+const path = require("path")
+const keys = ssbKeys.loadOrCreateSync(path.join(dir, 'secret'))
-SecretStack({appKey: require('ssb-caps').shs})
+
+SecretStack({
+ appKey: require('ssb-caps').shs,
+ keys,
+ timeout: 30e3,
+ timers: {
+ connection: 30e3,
+ reconnect: 30e3,
+ ping: 5*60e3,
+ handshake: 30e3
+ },
+ path: dir,
+ manifest: manifest,
+ logging: {level: 'info'},
+ replicate: {
+ legacy: true, // We don't need EBT because there is no pub-to-pub comms
+ },
+ connections: {
+ incoming: {
+ net: [{ port: 8888, host: "0.0.0.0", scope: "public", transform: "shs" }],
+ ws: [{ port: 9999, host: "::", scope: "public", transform: "shs", external: ["between-two-worlds.dk"], key: "/etc/letsencrypt/live/between-two-worlds.dk/privkey.pem", cert: "/etc/letsencrypt/live/between-two-worlds.dk/cert.pem" }],
+ },
+ outgoing: {
+ net: [{transform: 'shs'}],
+ },
+ }
+})
.use(require('ssb-master'))
.use(require('ssb-logging'))
+ .use(require('ssb-ws'))
.use(require('ssb-conn'))
.use(require('./invite'))
.use(require('./tunnel/server'))
.use(require('./http-server'))
.use(require('./ssb-shims'))
- .call(null, require('./config'));
+ .call(null); // , require('./config')
diff --git a/package.json b/package.json
index ef1d068..ad92960 100644
--- a/package.json
+++ b/package.json
@@ -24,14 +24,15 @@
"pull-pair": "~1.1.0",
"pull-stream": "~3.6.14",
"qr-image": "^3.2.0",
- "secret-stack": "6.3.0",
+ "secret-stack": "^6.3.0",
"ssb-caps": "~1.1.0",
"ssb-client": "~4.7.8",
- "ssb-config": "~3.3.2",
+ "ssb-config": "^3.3.3",
"ssb-conn": ">=0.11.0",
"ssb-logging": "~1.0.0",
"ssb-master": "~1.0.3",
- "ssb-ref": "~2.13.9"
+ "ssb-ref": "~2.13.9",
+ "ssb-ws": "^6.2.3"
},
"repository": {
"type": "git",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment