1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Feature: Support moving individual clients between mounts

This commit is contained in:
Philipp Schafft 2020-09-30 19:47:05 +00:00
parent 81bd709acc
commit 2bf77f2012
3 changed files with 26 additions and 3 deletions

View File

@ -36,7 +36,11 @@
<td><xsl:value-of select="role" /></td>
<td><xsl:value-of select="connected" /></td>
<td><xsl:value-of select="useragent" /></td>
<td><a href="killclient.xsl?mount={../@mount}&amp;id={id}">Kick</a></td>
<td>
<a href="killclient.xsl?mount={../@mount}&amp;id={id}">Kick</a>
&#160;
<a href="moveclients.xsl?mount={../@mount}&amp;id={id}">Move</a>
</td>
</tr>
</xsl:for-each>
</tbody>

View File

@ -17,7 +17,15 @@
</xsl:call-template>
<xsl:choose>
<xsl:when test="source">
<p>Choose the mountpoint to which you want to move the listeners to:</p>
<xsl:choose>
<xsl:when test="param-id">
<input type="hidden" name="id" value="{param-id}" />
<p>Choose the mountpoint to which you want to move the listener to:</p>
</xsl:when>
<xsl:otherwise>
<p>Choose the mountpoint to which you want to move the listeners to:</p>
</xsl:otherwise>
</xsl:choose>
<form method="post" action="moveclients.xsl">
<label for="moveto" class="hidden">
Move from <code><xsl:value-of select="current_source" /></code> to

View File

@ -617,6 +617,8 @@ static void command_move_clients(client_t *client,
admin_format_t response)
{
const char *dest_source;
const char *idtext = NULL;
connection_id_t id;
source_t *dest;
xmlDocPtr doc;
xmlNodePtr node;
@ -627,9 +629,18 @@ static void command_move_clients(client_t *client,
if((COMMAND_OPTIONAL(client, "destination", dest_source))) {
parameters_passed = 1;
}
if ((COMMAND_OPTIONAL(client, "id", idtext))) {
id = atoi(idtext);
} else {
idtext = NULL;
}
ICECAST_LOG_DEBUG("Done optional check (%d)", parameters_passed);
if (!parameters_passed) {
doc = admin_build_sourcelist(source->mount);
if (idtext) {
xmlNodePtr root = xmlDocGetRootElement(doc);
xmlNewTextChild(root, NULL, XMLSTR("param-id"), XMLSTR(idtext));
}
admin_send_response(doc, client, response,
MOVECLIENTS_HTML_REQUEST);
xmlFreeDoc(doc);
@ -659,7 +670,7 @@ static void command_move_clients(client_t *client,
node = admin_build_rootnode(doc, "iceresponse");
xmlDocSetRootElement(doc, node);
source_move_clients(source, dest, NULL);
source_move_clients(source, dest, idtext ? &id : NULL);
snprintf(buf, sizeof(buf), "Clients moved from %s to %s",
source->mount, dest_source);