Skip to content

Commit 2421b1e

Browse files
committed
0.4.0: Improved comment tree loading, new sorts, improved peer configs
1 parent c1e05a2 commit 2421b1e

25 files changed

+290
-127
lines changed

KNOWN_PEERS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,20 @@ These are all the public peers known to exist on the notabug network.
1313
This list does not represent an endorsement of these peers.
1414

1515
Different peers may maintain a more or less restrictive content policy and differing featuresets.
16+
17+
18+
## Peer Setup
19+
20+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
21+
nvm use 10 && npm install -g yarn forever && git clone https://github.com/notabugio/notabug.git && cd notabug
22+
yarn start
23+
24+
This will give you a basic ram only peer connected to notabug.io serving the UI on 0.0.0.0:3001
25+
26+
See https://github.com/notabugio/notabug/tree/master/peer-configs for more config examples.
27+
28+
For a more full featured peer:
29+
30+
yarn server
31+
32+
This will give you 3 scoring ram peers on ports 3001, 3002, 3003 suitable for hosting behind nginx or another reverse proxy.

package.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "notabug",
3-
"version": "0.3.3.3",
3+
"version": "0.4.0",
44
"private": true,
55
"dependencies": {
66
"babel-cli": "^6.26.0",
@@ -21,7 +21,7 @@
2121
"freactal": "^2.0.3",
2222
"gun": "^0.9.9991",
2323
"lodash": "^4.17.10",
24-
"notabug-peer": "https://github.com/notabugio/notabug-peer.git#0.3.0",
24+
"notabug-peer": "https://github.com/notabugio/notabug-peer.git",
2525
"qs": "^6.5.2",
2626
"ramda": "^0.25.0",
2727
"raw-loader": "^0.5.1",
@@ -41,20 +41,26 @@
4141
"slugify": "^1.2.9",
4242
"snew-classic-ui": "https://github.com/notabugio/snew-classic-ui.git#0.2.0",
4343
"snuownd": "https://github.com/JordanMilne/snuownd.git",
44+
"text-encoding": "^0.6.4",
4445
"urllite": "^0.5.0",
4546
"uuid": "^3.2.1",
4647
"worker-loader": "^1.1.1"
4748
},
4849
"scripts": {
4950
"ui": "NODE_PATH=src/ react-app-rewired start",
50-
"uidev": "concurrently \"yarn rampeer\" \"yarn ui\"",
51-
"rampeer": "node server.js --score --peer https://notabug.io/gun --port 3333",
52-
"legacy": "node server.js --persist --score --peer https://notabug.io/gun --port 3333 --host 0.0.0.0",
51+
"uidev": "concurrently \"yarn basicaccesspeer\" \"yarn ui\"",
52+
"legacy": "node server.js --persist --score --peer http://notabug.io/gun --port 3333 --host 0.0.0.0",
53+
"basic": "forever peer-configs/basic.json",
54+
"accesspeer": "forever peer-configs/access.json",
55+
"relaypeer": "forever peer-configs/relay.json",
56+
"persistpeer": "forever peer-configs/persist.json",
5357
"status": "forever list",
5458
"stop": "forever stopall",
5559
"restart": "forever restartall",
56-
"start": "forever server-config.json",
57-
"server": "yarn build && forever server-config.json",
60+
"start": "yarn && yarn build && yarn stop && yarn basic",
61+
"upgrade": "git stash && git pull origin master && yarn && git stash pop",
62+
"superpeer": "yarn && yarn build && yarn stop && yarn server",
63+
"server": "concurrently \"yarn accesspeer\" \"yarn relaypeer \" \"yarn persistpeer\"",
5864
"build": "NODE_PATH=src/ react-app-rewired build",
5965
"test": "NODE_PATH=src/ react-app-rewired test --env=jsdom"
6066
},
@@ -69,7 +75,7 @@
6975
},
7076
"proxy": {
7177
"/gun": {
72-
"target": "http://localhost:3333",
78+
"target": "http://localhost:3001",
7379
"secure": false,
7480
"ws": true,
7581
"pathRewrite": {

peer-configs/access.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
{
3+
"uid": "ram1",
4+
"command": "node --max_old_space_size=4096",
5+
"script": "server.js",
6+
"args": [
7+
"--score",
8+
"--port", "3001"
9+
]
10+
}, {
11+
"uid": "ram2",
12+
"command": "node --max_old_space_size=4096",
13+
"script": "server.js",
14+
"args": [
15+
"--score",
16+
"--port", "3002"
17+
]
18+
}, {
19+
"uid": "ram3",
20+
"command": "node --max_old_space_size=4096",
21+
"script": "server.js",
22+
"args": [
23+
"--score",
24+
"--port", "3003"
25+
]
26+
}, {
27+
"uid": "internalrelay",
28+
"script": "server.js",
29+
"args": [
30+
"--port", "3333",
31+
"--debug",
32+
"--peer", "http://localhost:3001/gun",
33+
"--peer", "http://localhost:3002/gun",
34+
"--peer", "http://localhost:3003/gun"
35+
]
36+
}
37+
]

peer-configs/basic.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"uid": "basicaccess",
4+
"command": "node --max_old_space_size=4096",
5+
"script": "server.js",
6+
"args": [
7+
"--score",
8+
"--debug",
9+
"--host", "0.0.0.0",
10+
"--port", "3001",
11+
"--peer", "http://notabug.io/gun"
12+
]
13+
}
14+
]

peer-configs/persist.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"uid": "persist",
4+
"script": "server.js",
5+
"args": [
6+
"--debug",
7+
"--persist",
8+
"--score",
9+
"--peer", "http://localhost:3333/gun"
10+
]
11+
}
12+
]

peer-configs/relay.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[
2+
{
3+
"uid": "peer-relay",
4+
"script": "server.js",
5+
"args": [
6+
"--score",
7+
"--debug",
8+
"--peer", "http://localhost:3333/gun",
9+
"--peer", "https://blubit.space/gun",
10+
"--peer", "https://communard.org/gun",
11+
"--peer", "https://dontsuemebro.com/gun",
12+
"--peer", "http://notabug.io/gun",
13+
"--peer", "https://gun.redguardsaustin.com/gun"
14+
]
15+
}
16+
]

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
localStorage.clear();
3434
window.location.reload(true);
3535
}
36-
window.onerror = emptyLocalStorage;
36+
// window.onerror = emptyLocalStorage;
3737

3838

3939
function migrateCBCaccount(alias, pass){

server-config.json

Lines changed: 0 additions & 73 deletions
This file was deleted.

server.js

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var Gun = require("gun/gun");
2+
//require("./src/sea");
23
var compress = require("compression");
34
var commandLineArgs = require("command-line-args");
45
var blocked = require("./blocked");
@@ -9,9 +10,10 @@ var options = commandLineArgs([
910
{ name: "score", alias: "s", type: Boolean },
1011
{ name: "evict", alias: "e", type: Boolean },
1112
{ name: "debug", alias: "d", type: Boolean },
12-
{ name: "port", alias: "p", type: Number, defaultValue: 3333 },
13+
{ name: "port", alias: "p", type: Number, defaultValue: null },
1314
{ name: "host", alias: "h", type: String, defaultValue: "127.0.0.1" },
14-
{ name: "peer", alias: "c", multiple: true, type: String }
15+
{ name: "peer", alias: "c", multiple: true, type: String },
16+
{ name: "until", alias: "u", multiple: true, type: Number, defaultValue: 5000 }
1517
]);
1618

1719
process.env.GUN_ENV = process.env.GUN_ENV || options.debug ? "debug" : undefined;
@@ -39,23 +41,39 @@ var path = require("path");
3941
var express = require("express");
4042
var router = express.Router();
4143
var init = require("notabug-peer").default;
42-
var app = express();
43-
var web = app.listen(options.port, options.host);
44+
var web;
4445

45-
router.use(compress());
46-
router.use(express.static(path.join(__dirname, "build")));
47-
app.use(router);
46+
if (options.port) {
47+
var app = express();
48+
web = app.listen(options.port, options.host);
4849

49-
app.get("/*", function (req, res) {
50-
res.sendFile(path.join(__dirname, "build", "index.html"));
51-
});
50+
router.use(compress());
51+
router.use(express.static(path.join(__dirname, "build")));
52+
app.use(router);
53+
54+
app.get("/*", function (req, res) {
55+
res.sendFile(path.join(__dirname, "build", "index.html"));
56+
});
57+
}
5258

53-
init({
59+
var nab = init({
5460
blocked,
5561
peers: options.peer,
5662
persist: options.persist,
5763
disableValidation: options.disableValidation,
5864
scoreThingsForPeers: options.score,
65+
until: options.until,
5966
super: true,
6067
web
6168
});
69+
70+
if (options.persist || !options.port) {
71+
nab.watchListing({ days: 1 });
72+
setInterval(function() {
73+
nab.watchListing({ days: 1 });
74+
}, 1000*60*60);
75+
}
76+
77+
if(options.persist) {
78+
nab.gun.get("nab/things").map().get("data").on(function () { });
79+
}

src/components/notabug/App.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const TopicRoute = injectState(({
2929
<Subreddit
3030
Link={Link}
3131
SidebarTitlebox={SidebarTitlebox}
32-
FooterParent={FooterParent}
32+
FooterParent={() => null}
3333
SidebarSearch={() => null}
3434
LoginFormSide={LoginFormSide}
3535
RecentlyViewedLinks={() => null}
@@ -80,7 +80,8 @@ export const App = router(() => (
8080
<ScrollToTop>
8181
<Switch>
8282
<Route path="/t/:topic/chat" component={ChatPage} />
83-
<Route path="/t/:topic/:sort" component={TopicRoute} />
83+
<Route path="/t/:topic/comments/*/*" component={TopicRoute} />
84+
<Route path="/t/:topic/:sort/" component={TopicRoute} />
8485
<Route path="/t/:topic/*" component={TopicRoute} />
8586
<Route path="/t/:topic" component={TopicRoute} />
8687
<Route path="/domain/:domain/:sort" component={TopicRoute} />
@@ -95,6 +96,7 @@ export const App = router(() => (
9596
<Route path="/chat" component={() => null} />
9697
<Route path="/*" component={Chat} />
9798
</Switch>
99+
<FooterParent />
98100
<Notifications />
99101
</Provider>
100102
</Fragment>

0 commit comments

Comments
 (0)