added new subDomain to valid list for Discord WebHooks, closed #578

This commit is contained in:
Mark Friedrich
2018-02-17 13:35:37 +01:00
parent 23749eb78c
commit e3c7c25562
2 changed files with 4 additions and 4 deletions

View File

@@ -377,13 +377,13 @@ class MapModel extends AbstractMapTrackingModel {
$valid = true;
if( !empty($val) ){
$hosts = [
'slack' => 'hooks.slack.com',
'discord' => 'discordapp.com'
'slack' => ['hooks.slack.com'],
'discord' => ['discordapp.com', 'ptb.discordapp.com']
];
if(
!\Audit::instance()->url($val) ||
parse_url($val, PHP_URL_HOST) !== $hosts[$type]
!in_array(parse_url($val, PHP_URL_HOST), $hosts[$type])
){
$valid = false;
$this->throwValidationException($key);

View File

@@ -227,7 +227,7 @@
</label>
<div class="col-sm-9 col-md-8">
<div class="input-group" {{^discordRallyEnabled}}title="Globally disabled for this map type"{{/discordRallyEnabled}}>
<input name="discordWebHookURLRally" type="url" class="form-control" id="{{discordWebHookURLRallyId}}" value="{{discordWebHookURLRally}}" placeholder="https://discordapp.com/api/webhooks/XXXYYYZZZ" data-type-error="No valid URL" pattern="^https://discordapp.com/.*" data-pattern-error="Wrong domain. https://discordapp.com/)" {{^discordRallyEnabled}}disabled{{/discordRallyEnabled}}>
<input name="discordWebHookURLRally" type="url" class="form-control" id="{{discordWebHookURLRallyId}}" value="{{discordWebHookURLRally}}" placeholder="https://discordapp.com/api/webhooks/XXXYYYZZZ" data-type-error="No valid URL" pattern="^https://(\w+\.)?discordapp.com/.*" data-pattern-error="Wrong domain. https://discordapp.com/)" {{^discordRallyEnabled}}disabled{{/discordRallyEnabled}}>
<div class="input-group-btn">
<a class="btn btn-default" href="//support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks" target="_blank">
add… <i class="fas fa-fw fa-external-link-alt"></i>