Skip to content

Commit

Permalink
Merge pull request #2019 from holium/master
Browse files Browse the repository at this point in the history
hotfix-v0.17.4
  • Loading branch information
subnet-arts authored Aug 25, 2023
2 parents 01989b3 + ea9214a commit c6d8397
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
5 changes: 5 additions & 0 deletions app/.holium/configs/webpack.config.renderer.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ const configuration: webpack.Configuration = {
process.env.RELEASE_CHANNEL === 'hotfix'
? '~hostyv:realm'
: '~nimwyd-ramwyl-dozzod-hostyv:realm',
ROOMS_PROVIDER:
process.env.RELEASE_CHANNEL === 'latest' ||
process.env.RELEASE_CHANNEL === 'hotfix'
? 'litzod-dozzod-hostyv.holium.live'
: 'node-test.holium.live',
DEBUG_PROD: false,
SENTRY_DSN:
'https://56fbf5e600db48cf8a785931be1ca5e4@o1327359.ingest.sentry.io/4504310987358208',
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/apps/Notes/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const EditorPresenter = () => {
existingRoom &&
!existingRoom.present.includes(loggedInAccount.serverId)
) {
await roomsStore.joinRoom(existingRoom.rid);
await roomsStore.joinRoom(existingRoom.rid, RoomType.background);
} else {
// the way notes room ids get generated, using selectedNote.title
// was not genering unique room ids. to not impact other parts of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const NotesSidebarPresenter = () => {
.find((room) => room.path === noteRoomPath);
if (existingRoom) {
// JOIN ROOM
await roomsStore.joinRoom(existingRoom.rid);
await roomsStore.joinRoom(existingRoom.rid, RoomType.background);
} else {
// CREATE ROOM
const note = notesStore.getNote({ id });
Expand All @@ -125,7 +125,7 @@ const NotesSidebarPresenter = () => {
RoomType.background
);

await roomsStore.joinRoom(newRoomRid);
await roomsStore.joinRoom(newRoomRid, RoomType.background);
}

setConnectingToNoteRoom(false);
Expand Down
39 changes: 19 additions & 20 deletions app/src/renderer/apps/Rooms/store/RoomsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export class RoomsStore extends EventsEmitter {
>();
@observable chat: RoomChat[] = [];
@observable currentRid: string | null = null;
@observable ourRooms: string[] = [];
@observable isMuted = false;
@observable isSpeaking = false;
@observable isAudioAttached = false;
Expand Down Expand Up @@ -449,16 +450,8 @@ export class RoomsStore extends EventsEmitter {
this.provider = 'localhost:3030';
} else {
protocol = 'wss';
if (
process.env.RELEASE_CHANNEL === 'latest' ||
process.env.RELEASE_CHANNEL === 'hotfix'
) {
// production signaling/socket server
this.provider = 'litzod-dozzod-hostyv.holium.live';
} else {
// test signaling/socket server
this.provider = 'node-test.holium.live';
}
this.provider =
process.env.ROOMS_PROVIDER || 'litzod-dozzod-hostyv.holium.live';
}
const websocket = new WebSocket(
`${protocol}://${this.provider}/signaling?serverId=${this.ourId}`
Expand Down Expand Up @@ -536,17 +529,17 @@ export class RoomsStore extends EventsEmitter {
// eslint-disable-next-line no-case-declarations
const newRoom = new RoomModel(event.room);
newRoom.update(event.room);
this.rooms.set(event.room.rid, newRoom);
if (event.room.rtype === RoomType.media) {
this.currentRid = event.room.rid;
}
break;
case 'room-entered':
{
console.log('room entered', event);
if (!this.ourRooms.includes(event.room.rid)) return;
const room = this.rooms.get(event.room.rid);
if (room) {
room.update(event.room);
this.rooms.set(event.room.rid, new RoomModel(event.room));
// if (event.room.rid === this.currentRid) {
// if we entered a room, we need to create a peer for each user in the room
if (event.peer_id === this.ourId) {
Expand Down Expand Up @@ -617,6 +610,11 @@ export class RoomsStore extends EventsEmitter {
case 'room-deleted':
{
console.log('room-deleted: %o', event);
if (this.ourRooms.includes(event.rid)) {
this.ourRooms = this.ourRooms.filter(
(rid: string) => rid !== event.rid
);
}
const room = this.rooms.get(event.rid);
if (room) {
room.present.forEach((peerId: string) => {
Expand Down Expand Up @@ -733,6 +731,7 @@ export class RoomsStore extends EventsEmitter {
@action
deleteRoom(rid: string) {
console.log('deleteRoom: %o', rid);
this.ourRooms = this.ourRooms.filter((roomid) => roomid !== rid);
const room = this.rooms.get(rid);
if (room) {
this.rooms.delete(rid);
Expand Down Expand Up @@ -764,15 +763,14 @@ export class RoomsStore extends EventsEmitter {
}

@action
async joinRoom(rid: string) {
async joinRoom(rid: string, rtype: RoomType = RoomType.media) {
console.log('joinRoom: %o', [rid]);
const room = this.rooms.get(rid);
if (room) {
if (room.rtype === RoomType.media) {
this.setCurrentRoom(rid);
if (!this.ourPeer.audioStream) {
await this.ourPeer.enableAudio();
}
this.ourRooms.push(rid);

if (rtype === RoomType.media) {
this.setCurrentRoom(rid);
if (!this.ourPeer.audioStream) {
await this.ourPeer.enableAudio();
}
}
this.websocket.send(
Expand All @@ -781,6 +779,7 @@ export class RoomsStore extends EventsEmitter {
rid,
})
);
const room = this.rooms.get(rid);
// add us to the room
if (room) {
room.addPeer(this.ourId);
Expand Down

0 comments on commit c6d8397

Please sign in to comment.