New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

splint-cli

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

splint-cli - npm Package Compare versions

Comparing version
0.2.0
to
0.3.0
+52
-1
cli.js

@@ -193,4 +193,49 @@ #!/usr/bin/env node

}
function savePet(p) { fs.writeFileSync(SAVE_PATH, JSON.stringify(p, null, 2)); }
function savePet(p) { fs.writeFileSync(SAVE_PATH, JSON.stringify(p, null, 2)); syncToServer(p); }
// ===== SERVER SYNC =====
const SERVER_URL = 'https://greene-brake-looking-healing.trycloudflare.com';
const https = require('https');
const http = require('http');
function serverPost(endpoint, data) {
return new Promise((resolve) => {
try {
const body = JSON.stringify(data);
const url = new URL(SERVER_URL + endpoint);
const mod = url.protocol === 'https:' ? https : http;
const req = mod.request({
hostname: url.hostname, port: url.port, path: url.pathname,
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }
}, res => {
let d = '';
res.on('data', c => d += c);
res.on('end', () => { try { resolve(JSON.parse(d)); } catch { resolve(null); } });
});
req.on('error', () => resolve(null));
req.setTimeout(5000, () => { req.destroy(); resolve(null); });
req.write(body);
req.end();
} catch { resolve(null); }
});
}
function syncToServer(p) {
if (!p || !p.id) return;
serverPost('/api/update', {
id: p.id, name: p.name, hunger: p.hunger, happiness: p.happiness,
energy: p.energy, health: p.health, level: p.level
}).catch(() => {});
}
async function registerPet(p) {
const res = await serverPost('/api/register', {
id: p.id, name: p.name, species: p.species, owner: p.owner || 'anonymous',
hunger: p.hunger, happiness: p.happiness, energy: p.energy, health: p.health, level: p.level
});
if (res && res.ok) return true;
return false;
}
// ===== STATE =====

@@ -262,3 +307,9 @@ let pet = null;

pet.name = inputBuffer.trim();
pet.id = pet.id || require('crypto').randomUUID();
pet.species = pet.animal;
pet.health = pet.hp;
savePet(pet);
registerPet(pet).then(ok => {
if (ok) setMsg(`${pet.name} joined the neighborhood!`);
});
mode = 'living';

@@ -265,0 +316,0 @@ process.stdout.write(CLEAR);

+1
-1
{
"name": "splint-cli",
"version": "0.2.0",
"version": "0.3.0",
"description": "raise AI creatures in a living pixel world. DNA, evolution, mutations — all in your terminal.",

@@ -5,0 +5,0 @@ "main": "cli.js",