remove json as a global

This commit is contained in:
2025-12-18 11:20:39 -06:00
parent 04a648a73e
commit aa18a8c8d2
16 changed files with 43 additions and 52 deletions

View File

@@ -101,7 +101,7 @@ $_.receiver(function(msg) {
break;
case 'status':
log.console(`got status request. current is ${json.encode(get_status())}`)
log.console(`got status request. current is ${get_status()}`)
send(msg, {
type: 'status_response',
...get_status()

View File

@@ -10,11 +10,11 @@ var match_id = 0;
$_.portal(e => {
log.console("NAT server: received connection request");
if (!is_actor(e.actor))
if (!isa(e.actor, actor))
send(e, {reason: "Must provide the actor you want to connect."});
if (waiting_client) {
log.console(`sending out messages! to ${json.encode(e.actor)} and ${json.encode(waiting_client.actor)}`)
log.console(`sending out messages! to ${e.actor} and ${waiting_client.actor}`)
send(waiting_client, e.actor)
send(e, waiting_client.actor)
@@ -25,5 +25,5 @@ $_.portal(e => {
waiting_client = e
log.console(`actor ${json.encode(e.actor)} is waiting ...`)
log.console(`actor ${e.actor} is waiting ...`)
}, 4000);

View File

@@ -2,10 +2,10 @@ log.console(`nat client starting`)
$_.contact((actor, reason) => {
if (actor) {
log.console(`trying to message ${json.encode(actor)}`)
log.console(`trying to message ${actor}`)
send(actor, {type:"greet"})
} else {
log.console(json.encode(reason))
log.console(reason)
}
}, {
address: "108.210.60.32", // NAT server's public IP