Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jabis Sevón
/
gun-multiserver
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
1ac87c7e
authored
2020-05-04 21:45:16 +0200
by
Jabis Sevón
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
gunshit
1 parent
3306413d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
node_modules/gun/gun.js
node_modules/gun/lib/nomem.js
server.js
node_modules/gun/gun.js
View file @
1ac87c7
...
...
@@ -1413,7 +1413,7 @@
if
(
cat
.
jam
){
return
cat
.
jam
.
push
([
cb
,
as
])
}
cat
.
jam
=
[[
cb
,
as
]];
gun
.
get
(
function
go
(
msg
,
eve
){
if
(
u
===
msg
.
put
&&
(
tmp
=
Object
.
keys
(
cat
.
root
.
opt
.
peers
).
length
)
&&
++
acks
<=
tmp
){
if
(
u
===
msg
.
put
&&
!
cat
.
root
.
opt
.
super
&&
(
tmp
=
Object
.
keys
(
cat
.
root
.
opt
.
peers
).
length
)
&&
++
acks
<=
tmp
){
return
;
}
eve
.
rid
(
msg
);
...
...
@@ -1811,7 +1811,7 @@
}
if
((
tmp
=
eve
.
wait
)
&&
(
tmp
=
tmp
[
at
.
id
])){
clearTimeout
(
tmp
)
}
eve
.
ack
=
(
eve
.
ack
||
0
)
+
1
;
if
(
!
to
&&
u
===
data
&&
eve
.
ack
<=
(
opt
.
acks
||
Object
.
keys
(
at
.
root
.
opt
.
peers
).
length
)){
return
}
if
(
!
to
&&
u
===
data
&&
!
at
.
root
.
opt
.
super
&&
eve
.
ack
<=
(
opt
.
acks
||
Object
.
keys
(
at
.
root
.
opt
.
peers
).
length
)){
return
}
if
((
!
to
&&
(
u
===
data
||
at
.
soul
||
at
.
link
||
(
link
&&
!
(
0
<
link
.
ack
))))
||
(
u
===
data
&&
(
tmp
=
Object
.
keys
(
at
.
root
.
opt
.
peers
).
length
)
&&
(
!
to
&&
(
link
||
at
).
ack
<
tmp
))){
tmp
=
(
eve
.
wait
=
{})[
at
.
id
]
=
setTimeout
(
function
(){
...
...
@@ -1819,7 +1819,7 @@
},
opt
.
wait
||
99
);
return
;
}
if
(
link
&&
u
===
link
.
put
&&
(
tmp
=
rel
.
is
(
data
))){
data
=
Gun
.
node
.
ify
({},
tmp
)
}
if
(
link
&&
u
===
link
.
put
&&
!
at
.
root
.
opt
.
super
&&
(
tmp
=
rel
.
is
(
data
))){
data
=
Gun
.
node
.
ify
({},
tmp
)
}
eve
.
rid
?
eve
.
rid
(
msg
)
:
eve
.
off
();
opt
.
ok
.
call
(
gun
||
opt
.
$
,
data
,
msg
.
get
);
}
...
...
@@ -2062,7 +2062,7 @@
Gun
.
log
(
err
=
(
e
||
"localStorage failure"
)
+
" Consider using GUN's IndexedDB plugin for RAD for more storage space, https://gun.eco/docs/RAD#install"
);
root
.
on
(
'localStorage:error'
,
{
err
:
err
,
file
:
opt
.
prefix
,
flush
:
disk
,
retry
:
flush
});
}
//
if(!err && !Gun.obj.empty(opt.peers)){ return } // only ack if there are no peers.
if
(
!
err
&&
!
Gun
.
obj
.
empty
(
opt
.
peers
)){
return
}
// only ack if there are no peers.
Gun
.
obj
.
map
(
ack
,
function
(
yes
,
id
){
if
(
yes
){
if
(
yes
.
more
){
acks
[
id
]
=
yes
;
return
}
...
...
node_modules/gun/lib/nomem.js
View file @
1ac87c7
function
Nomem
(){
var
opt
=
{},
u
;
opt
.
put
=
function
(
file
,
data
,
cb
){
cb
(
null
,
-
9
)
};
// dev/null!
opt
.
get
=
function
(
file
,
cb
){
cb
(
null
,
-
9
)
};
opt
.
get
=
function
(
file
,
cb
){
cb
(
null
)
};
return
opt
;
}
if
(
typeof
window
!==
"undefined"
){
...
...
server.js
View file @
1ac87c7
...
...
@@ -6,11 +6,11 @@
const
no
=
require
(
'gun/lib/nomem'
)();
// no-memory storage adapter for RAD
const
fs
=
require
(
"fs"
);
const
url
=
require
(
"url"
);
const
Gun
=
require
(
"gun"
);
// load defaults
const
Gun
=
require
(
"
../multigungun/
gun"
);
// load defaults
//require("./gun-ws.js"); // required to allow external websockets into gun constructor
//require("./mem.js"); // disable to allow file writing for debug
require
(
"gun/sea"
);
require
(
"gun/lib/then"
);
//
require("gun/sea");
//
require("gun/lib/then");
const
SEA
=
Gun
.
SEA
;
const
http
=
require
(
"http"
);
const
https
=
require
(
"https"
);
...
...
@@ -79,7 +79,7 @@ server.on("upgrade", async function(request, socket, head) {
let
peers
=
[];
// relaypeers.split(',').map(function(p){ return p+relaypath; });
if
(
debug
)
console
.
log
(
"peers"
,
peers
);
let
g
=
gun
.
gun
=
Gun
({
axe
:
false
,
//
axe:false,
peers
:
peers
,
// should we use self as peer?
localStorage
:
false
,
store
:
no
,
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment