mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
check admin pubkey while changing threshold
This commit is contained in:
parent
ab5f451929
commit
3e40e690c5
1 changed files with 3 additions and 1 deletions
|
|
@ -15,9 +15,11 @@ import * as pipeline from '@/pipeline.ts';
|
||||||
import { RelayError } from '@/RelayError.ts';
|
import { RelayError } from '@/RelayError.ts';
|
||||||
import { Storages } from '@/storages.ts';
|
import { Storages } from '@/storages.ts';
|
||||||
import { prometheusParams } from '@/db/KyselyLogger.ts';
|
import { prometheusParams } from '@/db/KyselyLogger.ts';
|
||||||
|
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
||||||
|
|
||||||
/** Limit of initial events returned for a subscription. */
|
/** Limit of initial events returned for a subscription. */
|
||||||
const FILTER_LIMIT = 100;
|
const FILTER_LIMIT = 100;
|
||||||
|
const adminPubkey = await new AdminSigner().getPublicKey();
|
||||||
|
|
||||||
/** Set up the Websocket connection. */
|
/** Set up the Websocket connection. */
|
||||||
function connectStream(socket: WebSocket) {
|
function connectStream(socket: WebSocket) {
|
||||||
|
|
@ -53,7 +55,7 @@ function connectStream(socket: WebSocket) {
|
||||||
handleReq(msg);
|
handleReq(msg);
|
||||||
return;
|
return;
|
||||||
case 'EVENT':
|
case 'EVENT':
|
||||||
if (msg[1].kind === 13314) {
|
if (msg[1].kind === 13314 && msg[1].pubkey === adminPubkey) {
|
||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(msg[1].content);
|
const parsed = JSON.parse(msg[1].content);
|
||||||
if (parsed.threshold) prometheusParams.threshold = parsed.threshold;
|
if (parsed.threshold) prometheusParams.threshold = parsed.threshold;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue