mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge d457c815471c7902d23cafb56098255cc7d29a3b into bb01f26f068b8e083e35fdf19dc9b36f8cf67068
This commit is contained in:
commit
d4c0870b86
@ -164,7 +164,7 @@ RED.multiplayer = (function () {
|
|||||||
$(this).show()
|
$(this).show()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (users.length < maxShown + 1) {
|
if (users.length < maxShown + 1) {
|
||||||
userCountIcon.hide()
|
userCountIcon.hide()
|
||||||
} else {
|
} else {
|
||||||
userCountSpan.text('+'+(users.length - maxShown))
|
userCountSpan.text('+'+(users.length - maxShown))
|
||||||
@ -365,12 +365,12 @@ RED.multiplayer = (function () {
|
|||||||
border.setAttribute("r",radius/2);
|
border.setAttribute("r",radius/2);
|
||||||
border.setAttribute("class", "red-ui-multiplayer-annotation-border")
|
border.setAttribute("class", "red-ui-multiplayer-annotation-border")
|
||||||
group.appendChild(border)
|
group.appendChild(border)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return group
|
return group
|
||||||
}
|
}
|
||||||
|
|
||||||
RED.view.annotations.register("red-ui-multiplayer",{
|
RED.view.annotations.register("red-ui-multiplayer",{
|
||||||
type: 'badge',
|
type: 'badge',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
@ -411,7 +411,7 @@ RED.multiplayer = (function () {
|
|||||||
// } else {
|
// } else {
|
||||||
log('Session ID', activeSessionId)
|
log('Session ID', activeSessionId)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
headerWidget = $('<li><ul id="red-ui-multiplayer-user-list"></ul></li>').prependTo('.red-ui-header-toolbar')
|
headerWidget = $('<li><ul id="red-ui-multiplayer-user-list"></ul></li>').prependTo('.red-ui-header-toolbar')
|
||||||
|
|
||||||
RED.comms.on('connect', () => {
|
RED.comms.on('connect', () => {
|
||||||
@ -422,6 +422,9 @@ RED.multiplayer = (function () {
|
|||||||
if (location.workspace !== 0) {
|
if (location.workspace !== 0) {
|
||||||
connectInfo.location = location
|
connectInfo.location = location
|
||||||
}
|
}
|
||||||
|
if (localStorage.getItem("multiplayer-name") !== undefined && localStorage.getItem("multiplayer-name").length >0) {
|
||||||
|
connectInfo.name = localStorage.getItem("multiplayer-name");
|
||||||
|
}
|
||||||
RED.comms.send('multiplayer/connect', connectInfo)
|
RED.comms.send('multiplayer/connect', connectInfo)
|
||||||
})
|
})
|
||||||
RED.comms.subscribe('multiplayer/#', (topic, msg) => {
|
RED.comms.subscribe('multiplayer/#', (topic, msg) => {
|
||||||
|
@ -42,7 +42,7 @@ module.exports = {
|
|||||||
let user = opts.user
|
let user = opts.user
|
||||||
if (!user || user.anonymous) {
|
if (!user || user.anonymous) {
|
||||||
user = user || { anonymous: true }
|
user = user || { anonymous: true }
|
||||||
user.username = `Anon ${Math.floor(Math.random()*100)}`
|
user.username = opts?.data?.name || `Anon ${Math.floor(Math.random()*100)}`
|
||||||
}
|
}
|
||||||
session = {
|
session = {
|
||||||
session: opts.data.session,
|
session: opts.data.session,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user