Skip to content

Commit

Permalink
# improve frontend style, add manual pass enter
Browse files Browse the repository at this point in the history
  • Loading branch information
ruocogito committed Jul 8, 2024
1 parent b637518 commit 6d2c082
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<div class="h" style="display:none"><span id="userNameLabel" style="order:1"></span><span id="userName" style="order:2"></span></div>
<select id="userIdCombo" required></select>
<label for="userIdCombo">User</label>
<input type="password" id="user-pass" />
<label for="user-pass">User pass, if empty - default</label>

<input type="text" id="server-field">
<label for="server-field">Matrix server</label>
Expand Down Expand Up @@ -207,7 +209,7 @@
min-height: 131px;
max-height: 800px;
width: 70%;
min-width: 800px;
min-width: 501px;
max-width: 1200px;
}

Expand Down
17 changes: 15 additions & 2 deletions js/matrix-conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
import {sleepRandom, streamInfo} from "/js/Utils.js";

export let actualServerURL = null
export let actualPass = testPass;

export let roomId;
export let currentRoom = null;
Expand Down Expand Up @@ -129,7 +130,7 @@ export function makeConnect(userId, token) {

let loginWithPass = (authClient) => {
return token == null && authClient
.loginWithPassword(userId, testPass)
.loginWithPassword(userId, testPass || ui.getEnteredPass() )
.then(onSuccess)
.catch(e=>{ui.showError(e.message);return false})
}
Expand Down Expand Up @@ -335,8 +336,20 @@ export let onMakeConference = ()=> {
) num++
let conferenceName = `Conferemce-${num}`

let usersToInvite = (()=>{
if(actualServerURL !== BASE_URL)
return client.getUsers().map(u=>u.userId)
return Object.values(testUsers).filter(u=>u!==client.getUserId())
})()

client
.createRoom({room_alias_name:`conference${Math.random() * Math.pow(10,17)}`, visibility:"private", name:conferenceName, preset:"trusted_private_chat", invite:Object.values(testUsers).filter(u=>u!==client.getUserId())})
.createRoom({
room_alias_name:`conference${Math.random() * Math.pow(10,17)}${utils.getRandomString(5)}`,
visibility:"private",
name:conferenceName,
preset:"trusted_private_chat",
invite:usersToInvite
})
.then(roomId => {
ui.addRoomForSelection(roomId, conferenceName)
ui.setSelectedRoom(roomId)
Expand Down
11 changes: 8 additions & 3 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ let messageInputField = null
let messageContainer = null
let clientContent = null
let controlsContainer = null
let userPass = null

export let videoElementsAppender = null

Expand Down Expand Up @@ -78,6 +79,7 @@ let initElementsVars = () => new Promise((resolve, reject) => {
messageContainer = document.getElementById("messageContainer")
clientContent = document.getElementById("clientContent")
controlsContainer = document.getElementById("controls")
userPass = document.getElementById("user-pass")

videoElementsAppender = new VideoElementsAppender(videoContainer, videoElementClassName);

Expand Down Expand Up @@ -524,7 +526,7 @@ function rgbToHex(r, g, b) {
}

function startBackgroundGradient() {
return
//return
let randomIndex = getRandomInt(0, backgroundColors.length) % backgroundColors.length
let colors = [backgroundColors[randomIndex][0], backgroundColors[randomIndex][1]]

Expand All @@ -544,7 +546,7 @@ function startBackgroundGradient() {
delta < 0 && colors[workColorIndex][workColor] > 120)) {

colors[workColorIndex][workColor] += delta
i++

} else if(colors[workColorIndex][workColor]>=255 && delta > 0 ||
colors[workColorIndex][workColor] <= 120 && delta < 0 ||
(i > 48 && getRandomInt(0,3) === 1)) {
Expand All @@ -556,6 +558,7 @@ function startBackgroundGradient() {
i = 0
}

i++
let color1 = rgbToHex( colors[0].r , colors[0].g, colors[0].b);
let color2 = rgbToHex( colors[1].r , colors[1].g, colors[1].b);

Expand All @@ -564,4 +567,6 @@ function startBackgroundGradient() {
}, 41.67); // Change every 1/24 second
}


export function getEnteredPass() {
return userPass.value
}

0 comments on commit 6d2c082

Please sign in to comment.