Compare commits

..

No commits in common. "eedd6e7da5b619a94bee5f3608b44af1e596bdfd" and "9e480f1cfb8631cab139583d0aa6c5d0ec31f30c" have entirely different histories.

2 changed files with 5 additions and 10 deletions

View File

@ -127,16 +127,7 @@ const plugin: Plugin = {
api.registerMethod("get_peers", { api.registerMethod("get_peers", {
cacheable: false, cacheable: false,
async handler(): Promise<string[]> { async handler(): Promise<string[]> {
const pubkey = b4a return [...getRpcServer().cache.dhtCache.online];
.from(getRpcServer().cache.swarm.keyPair.publicKey)
.toString("hex");
const online = getRpcServer().cache.dhtCache.online;
if (online.has(pubkey)) {
online.delete(pubkey);
}
return [...online];
}, },
}); });
api.registerMethod("get_direct_peers", { api.registerMethod("get_direct_peers", {

View File

@ -10,6 +10,10 @@ import { get as getSwarm, SecretStream } from "./swarm.js";
import b4a from "b4a"; import b4a from "b4a";
export async function start() { export async function start() {
if (!config.str("pocket-app-id") || !config.str("pocket-app-key")) {
errorExit("Please set pocket-app-id and pocket-app-key config options.");
}
getSwarm().on("connection", (stream: SecretStream) => getSwarm().on("connection", (stream: SecretStream) =>
getRpcServer().setup(stream) getRpcServer().setup(stream)
); );