Compare commits

..

2 Commits

Author SHA1 Message Date
Derrick Hammer eedd6e7da5
*Remove pocket config check
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-06 07:22:03 -05:00
Derrick Hammer 8ea5a38b83
*Remove self from peers list 2022-12-05 15:38:58 -05:00
2 changed files with 10 additions and 5 deletions

View File

@ -127,7 +127,16 @@ const plugin: Plugin = {
api.registerMethod("get_peers", { api.registerMethod("get_peers", {
cacheable: false, cacheable: false,
async handler(): Promise<string[]> { async handler(): Promise<string[]> {
return [...getRpcServer().cache.dhtCache.online]; const pubkey = b4a
.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,10 +10,6 @@ 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)
); );