don't require connection to view guild
This commit is contained in:
parent
afd2939fa1
commit
59856ca197
@ -20,7 +20,6 @@ const MessageList: FC<MessageListProps> = (props: MessageListProps) => {
|
|||||||
|
|
||||||
const scrollToBottomFunc = useCallback(() => {
|
const scrollToBottomFunc = useCallback(() => {
|
||||||
if (!infiniteScrollElementRef.current) return;
|
if (!infiniteScrollElementRef.current) return;
|
||||||
console.log('scrolling to bottom');
|
|
||||||
infiniteScrollElementRef.current.scrollTop = 0; // Keep in mind that this is reversed for flex-flow: column-reverse
|
infiniteScrollElementRef.current.scrollTop = 0; // Keep in mind that this is reversed for flex-flow: column-reverse
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -223,35 +223,23 @@ export default class CombinedGuild extends EventEmitter<Connectable & Conflictab
|
|||||||
resourceRAMCache: ResourceRAMCache,
|
resourceRAMCache: ResourceRAMCache,
|
||||||
personalDB: PersonalDB
|
personalDB: PersonalDB
|
||||||
) {
|
) {
|
||||||
|
if (guildMetadata.memberId === null) {
|
||||||
|
throw new Error('trying to launch guild that we have never verified with');
|
||||||
|
}
|
||||||
const socket = socketio.connect(socketConfig.url, {
|
const socket = socketio.connect(socketConfig.url, {
|
||||||
forceNew: true,
|
forceNew: true,
|
||||||
ca: socketConfig.cert
|
ca: socketConfig.cert
|
||||||
});
|
});
|
||||||
return new Promise<CombinedGuild>((resolve, reject) => {
|
|
||||||
const connectFail = (err: unknown) => {
|
|
||||||
socket.off('connect', connectSucceed);
|
|
||||||
reject(new Error('unable to connect: ' + (err as Error).message));
|
|
||||||
}
|
|
||||||
const connectSucceed = async () => {
|
|
||||||
socket.off('connect_error', connectFail);
|
|
||||||
const socketVerifier = new SocketVerifier(socket, socketConfig.publicKey, socketConfig.privateKey);
|
const socketVerifier = new SocketVerifier(socket, socketConfig.publicKey, socketConfig.privateKey);
|
||||||
const memberId = await socketVerifier.verify();
|
return new CombinedGuild(
|
||||||
if (guildMetadata.memberId && memberId !== guildMetadata.memberId) {
|
|
||||||
reject(new Error('Verified member differs from original member'));
|
|
||||||
}
|
|
||||||
resolve(new CombinedGuild(
|
|
||||||
guildMetadata.id,
|
guildMetadata.id,
|
||||||
memberId,
|
guildMetadata.memberId,
|
||||||
socket,
|
socket,
|
||||||
socketVerifier,
|
socketVerifier,
|
||||||
messageRAMCache,
|
messageRAMCache,
|
||||||
resourceRAMCache,
|
resourceRAMCache,
|
||||||
personalDB
|
personalDB
|
||||||
));
|
);
|
||||||
}
|
|
||||||
socket.once('connect', connectSucceed);
|
|
||||||
socket.once('connect_error', connectFail);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public isSocketVerified(): boolean {
|
public isSocketVerified(): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user