Removing open group blocklist code.

This commit is contained in:
warrickct 2022-03-08 13:17:25 +11:00
parent 0c7bca4322
commit 4ee51b4ee9
5 changed files with 1 additions and 53 deletions

View File

@ -51,15 +51,6 @@ jobs:
- name: Install Dependencies
run: yarn install --frozen-lockfile --network-timeout 600000
- name: Fetch open group blocklist
uses: actions/checkout@v3
with:
repository: oxen-io/blocklist
path: blocklist
# - name: Output blocklist location
# run: find / -name "blocklist" 2>/dev/null
- name: Generate and concat files
run: yarn generate

View File

@ -273,7 +273,6 @@
},
"files": [
"package.json",
"blocklist/blocklist.txt",
"config/default.json",
"config/${env.SIGNAL_ENV}.json",
"config/local-${env.SIGNAL_ENV}.json",

View File

@ -6,7 +6,6 @@ const { webFrame, remote, clipboard, ipcRenderer } = require('electron');
const { app } = remote;
const url = require('url');
const fs = require('fs');
const config = url.parse(window.location.toString(), true).query;
@ -214,23 +213,6 @@ window.clipboard = clipboard;
window.getSeedNodeList = () => JSON.parse(config.seedNodeList);
window.getOpenGroupBlockList = () => {
// const blocklist = url.parse(window.location.toString(), true).query;
if (!window.groupBlockList) {
try {
const blockList = fs
.readFileSync(path.resolve(__dirname, 'blocklist', 'blocklist.txt'), 'utf8')
.toString()
.split('\n');
// TODO: trim whitespace
window.groupBlockList = blockList;
} catch (e) {
return [];
}
}
return window.groupBlockList;
};
const { locale: localFromEnv } = config;
window.i18n = i18n.setup(localFromEnv, localeMessages);

View File

@ -1,6 +1,5 @@
import { getV2OpenGroupRoomByRoomId, OpenGroupV2Room } from '../../../../data/opengroups';
import { getConversationController } from '../../../conversations';
import { getSodium } from '../../../crypto';
import { PromiseUtils, ToastUtils } from '../../../utils';
import { forceSyncConfigurationNowIfNeeded } from '../../../utils/syncUtils';
import {
@ -45,24 +44,6 @@ export function parseOpenGroupV2(urlWithPubkey: string): OpenGroupV2Room | undef
return undefined;
}
/**
* Checks if the group pubkey (hashed as blake2b) is in the list of blocked groups (also hashed)
* @param serverPubKey PubKey of the open group being evaluated
* @returns true - group is in the blocklist, false - the group is not in the blocklist
*/
export const isGroupInBlockList = async (serverPubKey: string): Promise<boolean> => {
const blockList = window?.getOpenGroupBlockList();
window?.log?.warn({ blockList });
if (!blockList || !blockList.length) {
return false;
}
const sodium = await getSodium();
// generic hash is blake2b
const serverPubKeyBlake2bHash = sodium.crypto_generichash(32, serverPubKey, null, 'hex');
return blockList.includes(serverPubKeyBlake2bHash);
};
/**
* Join an open group using the v2 logic.
*
@ -77,10 +58,6 @@ async function joinOpenGroupV2(room: OpenGroupV2Room, fromConfigMessage: boolean
return;
}
if (await isGroupInBlockList(room.serverPublicKey)) {
return;
}
const serverUrl = room.serverUrl.toLowerCase();
const roomId = room.roomId.toLowerCase();
const publicKey = room.serverPublicKey.toLowerCase();

View File

@ -15,7 +15,6 @@ import { OpenGroupServerPoller } from './OpenGroupServerPoller';
import _ from 'lodash';
import autoBind from 'auto-bind';
import { isGroupInBlockList } from './JoinOpenGroupV2';
let instance: OpenGroupManagerV2 | undefined;
@ -128,7 +127,7 @@ export class OpenGroupManagerV2 {
[...allRoomInfos.values()].map(async infos => {
try {
const roomConvoId = getOpenGroupV2ConversationId(infos.serverUrl, infos.roomId);
if (!allConvos.get(roomConvoId) || (await isGroupInBlockList(infos.serverPublicKey))) {
if (!allConvos.get(roomConvoId)) {
// remove the roomInfos locally for this open group room
await removeV2OpenGroupRoom(roomConvoId);
getOpenGroupManager().removeRoomFromPolledRooms(infos);