Added to Show chat room details Type & Security fields

This commit is contained in:
defnax 2026-07-26 12:27:54 +02:00
parent 70f5fd9975
commit dd66e7e1ff
3 changed files with 54 additions and 2 deletions

View File

@ -936,6 +936,46 @@ const ChatConversationView = () => {
// ***************************** Page Layouts ****************************** // ***************************** Page Layouts ******************************
function getLobbyPrivacyInfo(room) {
if (!room) return { type: 'Public', security: 'Anonymous IDs accepted' };
const flags =
room.lobby_privacy_type !== undefined
? room.lobby_privacy_type
: room.lobby_privacy_level !== undefined
? room.lobby_privacy_level
: room.privacy_type !== undefined
? room.privacy_type
: room.lobby_privacy !== undefined
? room.lobby_privacy
: room.privacy_level !== undefined
? room.privacy_level
: room.lobby_flags !== undefined
? room.lobby_flags
: 0;
let isPublic =
(flags & 4) !== 0 ||
(flags & 1) !== 0 ||
ChatHubState.selectedRoomType === 'public' ||
room.is_public === true;
if (flags === 1 || flags === 2) {
if ((flags & 1) === 1 && (flags & 4) === 0 && ChatHubState.selectedRoomType !== 'public') {
isPublic = false;
}
}
const typeStr = isPublic ? 'Public' : 'Private';
const isAuthOnly = (flags & 8) !== 0;
const securityStr = isAuthOnly ? 'No anonymous IDs' : 'Anonymous IDs accepted';
return {
type: typeStr,
security: securityStr,
};
}
const ChatRoomDetailView = () => { const ChatRoomDetailView = () => {
return { return {
view: () => { view: () => {
@ -976,6 +1016,8 @@ const ChatRoomDetailView = () => {
participantNames.sort((a, b) => a.localeCompare(b)); participantNames.sort((a, b) => a.localeCompare(b));
const lobbyHexId = rs.idToHex(room.lobby_id); const lobbyHexId = rs.idToHex(room.lobby_id);
const privacy = getLobbyPrivacyInfo(room);
return m('.chat-room-detail-view', [ return m('.chat-room-detail-view', [
m('.detail-section', [ m('.detail-section', [
@ -985,6 +1027,10 @@ const ChatRoomDetailView = () => {
m('.info-value', room.lobby_name || '<unnamed>'), m('.info-value', room.lobby_name || '<unnamed>'),
m('.info-label', 'Topic'), m('.info-label', 'Topic'),
m('.info-value', room.lobby_topic || 'None'), m('.info-value', room.lobby_topic || 'None'),
m('.info-label', 'Type'),
m('.info-value', privacy.type),
m('.info-label', 'Security'),
m('.info-value', privacy.security),
m('.info-label', 'Participants'), m('.info-label', 'Participants'),
m('.info-value', participantCount + ' users'), m('.info-value', participantCount + ' users'),
m('.info-label', 'Your Identity'), m('.info-label', 'Your Identity'),
@ -1020,6 +1066,7 @@ const ChatRoomJoinView = () => {
const lobbyHexId = rs.idToHex(room.lobby_id); const lobbyHexId = rs.idToHex(room.lobby_id);
const participantCount = room.total_number_of_peers || 0; const participantCount = room.total_number_of_peers || 0;
const privacy = getLobbyPrivacyInfo(room);
return m('.chat-room-detail-view', [ return m('.chat-room-detail-view', [
m('.detail-section', [ m('.detail-section', [
@ -1029,11 +1076,16 @@ const ChatRoomJoinView = () => {
m('.info-value', room.lobby_name || '<unnamed>'), m('.info-value', room.lobby_name || '<unnamed>'),
m('.info-label', 'Topic'), m('.info-label', 'Topic'),
m('.info-value', room.lobby_topic || 'None'), m('.info-value', room.lobby_topic || 'None'),
m('.info-label', 'Type'),
m('.info-value', privacy.type),
m('.info-label', 'Security'),
m('.info-value', privacy.security),
m('.info-label', 'Participants'), m('.info-label', 'Participants'),
m('.info-value', participantCount + ' users'), m('.info-value', participantCount + ' users'),
]), ]),
]), ]),
m('.detail-section', [ m('.detail-section', [
m('h3', 'Join Room'), m('h3', 'Join Room'),
m('p.join-description', 'Select an identity to join this chat room:'), m('p.join-description', 'Select an identity to join this chat room:'),

View File

@ -499,7 +499,7 @@ textarea.chatMsg {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #ffffff; color: #ffffff;
font-size: 0.85rem; font-size: 1.35rem;
} }
&.public-room .room-icon { &.public-room .room-icon {

View File

@ -1010,7 +1010,7 @@ h1{font-size:3rem}h2{font-size:2.25rem}h3{font-size:1.875rem}h4{font-size:1.5rem
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #ffffff; color: #ffffff;
font-size: 0.85rem; font-size: 1.35rem;
} }
.chat-room-list-item.public-room .room-icon { .chat-room-list-item.public-room .room-icon {