Oasis 0.9.5 con Karvan para escritorio
Rama de desarrollo experimental sobre el Oasis de epsylon, sin afiliacion con el proyecto original. Base: 0.9.5. Trae el modulo Karvan —salas efimeras en memoria con autodestruccion por TTL, chat que funciona sin JavaScript y llamadas de audio y video sobre WebRTC— con el enlace en el menu lateral por el mismo patron que el resto de modulos: renderKarvanLink calcado de renderPollsLink, entrada en modules_view y en la lista de /modules. Los estilos del modulo van en su propia hoja, styles/karvan.css, siguiendo el patron de highlight.css: asi se ve igual con cualquier tema, sin depender del tema movil. Sin servidores ICE de terceros: no hay STUN de fabrica, porque un STUN aprende la IP publica y el momento de cada llamada. Solo candidatos host salvo que se configure un TURN propio en oasis-config.json, con credenciales efimeras por el mecanismo REST de coturn. El codigo propio vive separado —views/fork/, backend/fork_routes.js, models/karvan_model.js y translations/fork/— de modo que sobre los ficheros de upstream solo hay enganches de una linea y cada version nueva se integra sin arrastrar nada. Respecto al arbol de Android: fuera el wrapper y main.js, que es su arranque; el tema vuelve a Dark-SNH y se restauran los modulos que en movil se recortan por peso. Verificado arrancando sin OASIS_MOBILE: nueve rutas OK, menu lateral de upstream con 27 grupos y el enlace de Karvan, cero rastro de la interfaz movil (ni hexagonos, ni topbar, ni barra inferior), y una sala creada y servida.
This commit is contained in:
commit
ddd2787b73
286 changed files with 157145 additions and 0 deletions
91
scripts/oasis-pub.js
Normal file
91
scripts/oasis-pub.js
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/env node
|
||||
const path = require('path');
|
||||
const ssbConfig = require(path.join(__dirname, '..', 'src', 'server', 'ssb_config'));
|
||||
const ssbClient = require(path.join(__dirname, '..', 'src', 'server', 'node_modules', 'ssb-client'));
|
||||
|
||||
const socketPath = path.join(ssbConfig.path, 'socket');
|
||||
const publicInteger = (ssbConfig.keys.public || '').replace('.ed25519', '');
|
||||
const remote = `unix:${socketPath}~noauth:${publicInteger}`;
|
||||
|
||||
const cmd = process.argv[2];
|
||||
const args = process.argv.slice(3);
|
||||
|
||||
const usage = () => {
|
||||
console.error('Usage: sh oasis.sh <command> [args]');
|
||||
console.error('');
|
||||
console.error('PUB admin commands (sbot must be running: sh oasis.sh server):');
|
||||
console.error(' whoami Print this PUB id');
|
||||
console.error(' invite [N] Create an invite code (default uses=1)');
|
||||
console.error(' name <text> Set PUB display name');
|
||||
console.error(' announce <host> [port] Publish a pub address (default port=8008)');
|
||||
console.error(' follow <feedId> Follow another PUB');
|
||||
console.error(' status Show peer / replication status');
|
||||
console.error(' gossip List known gossip peers');
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
if (!cmd) usage();
|
||||
|
||||
const call = (fn, ...a) => new Promise((res, rej) => fn(...a, (e, r) => e ? rej(e) : res(r)));
|
||||
|
||||
ssbClient(ssbConfig.keys, { remote, caps: ssbConfig.caps }).then(async (ssb) => {
|
||||
try {
|
||||
switch (cmd) {
|
||||
case 'whoami': {
|
||||
const r = await call(ssb.whoami.bind(ssb));
|
||||
console.log(JSON.stringify(r, null, 2));
|
||||
break;
|
||||
}
|
||||
case 'invite': {
|
||||
const uses = Math.max(1, parseInt(args[0] || '1', 10));
|
||||
const code = await call(ssb.invite.create.bind(ssb.invite), uses);
|
||||
console.log(code);
|
||||
break;
|
||||
}
|
||||
case 'name': {
|
||||
const text = String(args[0] || '');
|
||||
if (!text) { console.error('Missing name'); process.exit(1); }
|
||||
const me = await call(ssb.whoami.bind(ssb));
|
||||
const r = await call(ssb.publish.bind(ssb), { type: 'about', about: me.id, name: text });
|
||||
console.log(JSON.stringify(r, null, 2));
|
||||
break;
|
||||
}
|
||||
case 'announce': {
|
||||
const host = args[0];
|
||||
const port = parseInt(args[1] || '8008', 10);
|
||||
if (!host) { console.error('Missing host'); process.exit(1); }
|
||||
const me = await call(ssb.whoami.bind(ssb));
|
||||
const r = await call(ssb.publish.bind(ssb), { type: 'pub', address: { key: me.id, host, port } });
|
||||
console.log(JSON.stringify(r, null, 2));
|
||||
break;
|
||||
}
|
||||
case 'follow': {
|
||||
const feedId = args[0];
|
||||
if (!feedId) { console.error('Missing feedId'); process.exit(1); }
|
||||
const r = await call(ssb.publish.bind(ssb), { type: 'contact', contact: feedId, following: true });
|
||||
console.log(JSON.stringify(r, null, 2));
|
||||
break;
|
||||
}
|
||||
case 'status': {
|
||||
const r = await call(ssb.status.bind(ssb));
|
||||
console.log(JSON.stringify(r, null, 2));
|
||||
break;
|
||||
}
|
||||
case 'gossip': {
|
||||
const r = await call(ssb.conn.dbPeers.bind(ssb.conn));
|
||||
console.log(JSON.stringify(r, null, 2));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
ssb.close();
|
||||
} catch (e) {
|
||||
console.error('Error:', e.message || e);
|
||||
process.exit(1);
|
||||
}
|
||||
}).catch((e) => {
|
||||
console.error('Connection error:', e.message || e);
|
||||
console.error('Is the Oasis sbot running? (sh oasis.sh server)');
|
||||
process.exit(1);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue