mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 13:15:30 +01:00
Add 'allowurlname' setting for 'chat' - permits web name set with playername= parameter
This commit is contained in:
parent
756202affd
commit
44106a799a
@ -44,6 +44,8 @@ components:
|
|||||||
|
|
||||||
- class: org.dynmap.SimpleWebChatComponent
|
- class: org.dynmap.SimpleWebChatComponent
|
||||||
allowchat: true
|
allowchat: true
|
||||||
|
# If true, web UI users can supply name for chat using 'playername' URL parameter. 'trustclientname' must also be set true.
|
||||||
|
allowurlname: false
|
||||||
#- class: org.dynmap.herochat.HeroWebChatComponent
|
#- class: org.dynmap.herochat.HeroWebChatComponent
|
||||||
# # Control which HeroChat channel messages from web are directed to
|
# # Control which HeroChat channel messages from web are directed to
|
||||||
# herochatwebchannel: Global
|
# herochatwebchannel: Global
|
||||||
|
@ -17,11 +17,16 @@ componentconstructors['chat'] = function(dynmap, configuration) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
var pname = null;
|
||||||
|
if(configuration.allowurlname) {
|
||||||
|
pname = dynmap.getParameterByName("playername");
|
||||||
|
if(pname == "") pname = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (dynmap.options.allowwebchat) {
|
if (dynmap.options.allowwebchat) {
|
||||||
// Accepts 'sendchat'-events to send chat messages to the server.
|
// Accepts 'sendchat'-events to send chat messages to the server.
|
||||||
$(dynmap).bind('sendchat', function(event, message) {
|
$(dynmap).bind('sendchat', function(event, message) {
|
||||||
var data = '{"name":'+JSON.stringify(ip?ip:"")+',"message":'+JSON.stringify(message)+'}';
|
var data = '{"name":'+JSON.stringify(pname?pname:(ip?ip:""))+',"message":'+JSON.stringify(message)+'}';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: config.url.sendmessage,
|
url: config.url.sendmessage,
|
||||||
|
Loading…
Reference in New Issue
Block a user