mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-13 05:54:40 +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
|
||||
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
|
||||
# # Control which HeroChat channel messages from web are directed to
|
||||
# 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) {
|
||||
// Accepts 'sendchat'-events to send chat messages to the server.
|
||||
$(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({
|
||||
type: 'POST',
|
||||
url: config.url.sendmessage,
|
||||
|
Loading…
Reference in New Issue
Block a user