#5047 -- Extend to include Shoutcast too.
This commit is contained in:
parent
df46e7e030
commit
2001cd3aef
|
@ -111,7 +111,7 @@
|
|||
</template>
|
||||
</b-wrapped-form-group>
|
||||
|
||||
<b-wrapped-form-group v-if="!isShoutcastFrontend" id="edit_form_frontend_banned_user_agents"
|
||||
<b-wrapped-form-group id="edit_form_frontend_banned_user_agents"
|
||||
:field="form.frontend_config.banned_user_agents" input-type="textarea"
|
||||
:input-attrs="{class: 'text-preformatted'}" advanced>
|
||||
<template #label="{lang}">
|
||||
|
|
|
@ -179,6 +179,23 @@ abstract class AbstractFrontend extends AbstractAdapter
|
|||
return false;
|
||||
}
|
||||
|
||||
protected function writeUserAgentBansFile(Entity\Station $station): string
|
||||
{
|
||||
$bannedUserAgents = array_filter(
|
||||
array_map(
|
||||
'trim',
|
||||
explode("\n", $station->getFrontendConfig()->getBannedUserAgents() ?? '')
|
||||
)
|
||||
);
|
||||
|
||||
$configDir = $station->getRadioConfigDir();
|
||||
$bansFile = $configDir . '/user_agent_bans.txt';
|
||||
|
||||
file_put_contents($bansFile, implode("\n", $bannedUserAgents));
|
||||
|
||||
return $bansFile;
|
||||
}
|
||||
|
||||
protected function writeIpBansFile(Entity\Station $station): string
|
||||
{
|
||||
$ips = [];
|
||||
|
|
|
@ -293,23 +293,6 @@ class Icecast extends AbstractFrontend
|
|||
return substr($configString, strpos($configString, "\n") + 1);
|
||||
}
|
||||
|
||||
protected function writeUserAgentBansFile(Entity\Station $station): string
|
||||
{
|
||||
$bannedUserAgents = array_filter(
|
||||
array_map(
|
||||
'trim',
|
||||
explode("\n", $station->getFrontendConfig()->getBannedUserAgents() ?? '')
|
||||
)
|
||||
);
|
||||
|
||||
$configDir = $station->getRadioConfigDir();
|
||||
$bansFile = $configDir . '/user_agent_bans.txt';
|
||||
|
||||
file_put_contents($bansFile, implode("\n", $bannedUserAgents));
|
||||
|
||||
return $bansFile;
|
||||
}
|
||||
|
||||
public function getCommand(Entity\Station $station): ?string
|
||||
{
|
||||
if ($binary = $this->getBinary()) {
|
||||
|
|
|
@ -123,6 +123,7 @@ class Shoutcast extends AbstractFrontend
|
|||
'logfile' => $configPath . '/sc_serv.log',
|
||||
'w3clog' => $configPath . '/sc_w3c.log',
|
||||
'banfile' => $this->writeIpBansFile($station),
|
||||
'agentfile' => $this->writeUserAgentBansFile($station),
|
||||
'ripfile' => $configPath . '/sc_serv.rip',
|
||||
'maxuser' => $frontendConfig->getMaxListeners() ?? 250,
|
||||
'portbase' => $frontendConfig->getPort(),
|
||||
|
|
Loading…
Reference in New Issue