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

Cleanup: Renamed *_TRANSFORMED* to *_HTML*

This commit is contained in:
Philipp Schafft 2018-06-29 15:25:12 +00:00
parent c7910fb8bf
commit 1a426f7f81
5 changed files with 61 additions and 61 deletions

View File

@ -67,34 +67,34 @@
#define COMMAND_ANY ADMIN_COMMAND_ANY #define COMMAND_ANY ADMIN_COMMAND_ANY
#define FALLBACK_RAW_REQUEST "fallbacks" #define FALLBACK_RAW_REQUEST "fallbacks"
#define FALLBACK_TRANSFORMED_REQUEST "fallbacks.xsl" #define FALLBACK_HTML_REQUEST "fallbacks.xsl"
#define SHOUTCAST_METADATA_REQUEST "admin.cgi" #define SHOUTCAST_METADATA_REQUEST "admin.cgi"
#define METADATA_RAW_REQUEST "metadata" #define METADATA_RAW_REQUEST "metadata"
#define METADATA_TRANSFORMED_REQUEST "metadata.xsl" #define METADATA_HTML_REQUEST "metadata.xsl"
#define LISTCLIENTS_RAW_REQUEST "listclients" #define LISTCLIENTS_RAW_REQUEST "listclients"
#define LISTCLIENTS_TRANSFORMED_REQUEST "listclients.xsl" #define LISTCLIENTS_HTML_REQUEST "listclients.xsl"
#define STATS_RAW_REQUEST "stats" #define STATS_RAW_REQUEST "stats"
#define STATS_TRANSFORMED_REQUEST "stats.xsl" #define STATS_HTML_REQUEST "stats.xsl"
#define QUEUE_RELOAD_RAW_REQUEST "reloadconfig" #define QUEUE_RELOAD_RAW_REQUEST "reloadconfig"
#define QUEUE_RELOAD_TRANSFORMED_REQUEST "reloadconfig.xsl" #define QUEUE_RELOAD_HTML_REQUEST "reloadconfig.xsl"
#define LISTMOUNTS_RAW_REQUEST "listmounts" #define LISTMOUNTS_RAW_REQUEST "listmounts"
#define LISTMOUNTS_TRANSFORMED_REQUEST "listmounts.xsl" #define LISTMOUNTS_HTML_REQUEST "listmounts.xsl"
#define STREAMLIST_RAW_REQUEST "streamlist" #define STREAMLIST_RAW_REQUEST "streamlist"
#define STREAMLIST_TRANSFORMED_REQUEST "streamlist.xsl" #define STREAMLIST_HTML_REQUEST "streamlist.xsl"
#define STREAMLIST_PLAINTEXT_REQUEST "streamlist.txt" #define STREAMLIST_PLAINTEXT_REQUEST "streamlist.txt"
#define MOVECLIENTS_RAW_REQUEST "moveclients" #define MOVECLIENTS_RAW_REQUEST "moveclients"
#define MOVECLIENTS_TRANSFORMED_REQUEST "moveclients.xsl" #define MOVECLIENTS_HTML_REQUEST "moveclients.xsl"
#define KILLCLIENT_RAW_REQUEST "killclient" #define KILLCLIENT_RAW_REQUEST "killclient"
#define KILLCLIENT_TRANSFORMED_REQUEST "killclient.xsl" #define KILLCLIENT_HTML_REQUEST "killclient.xsl"
#define KILLSOURCE_RAW_REQUEST "killsource" #define KILLSOURCE_RAW_REQUEST "killsource"
#define KILLSOURCE_TRANSFORMED_REQUEST "killsource.xsl" #define KILLSOURCE_HTML_REQUEST "killsource.xsl"
#define ADMIN_XSL_RESPONSE "response.xsl" #define ADMIN_XSL_RESPONSE "response.xsl"
#define MANAGEAUTH_RAW_REQUEST "manageauth" #define MANAGEAUTH_RAW_REQUEST "manageauth"
#define MANAGEAUTH_TRANSFORMED_REQUEST "manageauth.xsl" #define MANAGEAUTH_HTML_REQUEST "manageauth.xsl"
#define UPDATEMETADATA_RAW_REQUEST "updatemetadata" #define UPDATEMETADATA_RAW_REQUEST "updatemetadata"
#define UPDATEMETADATA_TRANSFORMED_REQUEST "updatemetadata.xsl" #define UPDATEMETADATA_HTML_REQUEST "updatemetadata.xsl"
#define DEFAULT_RAW_REQUEST "" #define DEFAULT_RAW_REQUEST ""
#define DEFAULT_TRANSFORMED_REQUEST "" #define DEFAULT_HTML_REQUEST ""
#define BUILDM3U_RAW_REQUEST "buildm3u" #define BUILDM3U_RAW_REQUEST "buildm3u"
typedef struct { typedef struct {
@ -118,37 +118,37 @@ static void command_updatemetadata (client_t *client, source_t *source, adm
static void command_buildm3u (client_t *client, source_t *source, admin_format_t response); static void command_buildm3u (client_t *client, source_t *source, admin_format_t response);
static const admin_command_handler_t handlers[] = { static const admin_command_handler_t handlers[] = {
{ "*", ADMINTYPE_GENERAL, ADMIN_FORMAT_TRANSFORMED, NULL }, /* for ACL framework */ { "*", ADMINTYPE_GENERAL, ADMIN_FORMAT_HTML, NULL }, /* for ACL framework */
{ FALLBACK_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_fallback }, { FALLBACK_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_fallback },
{ FALLBACK_TRANSFORMED_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_TRANSFORMED, command_fallback }, { FALLBACK_HTML_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_HTML, command_fallback },
{ METADATA_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_metadata }, { METADATA_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_metadata },
{ METADATA_TRANSFORMED_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_TRANSFORMED, command_metadata }, { METADATA_HTML_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_HTML, command_metadata },
{ SHOUTCAST_METADATA_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_TRANSFORMED, command_shoutcast_metadata }, { SHOUTCAST_METADATA_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_HTML, command_shoutcast_metadata },
{ LISTCLIENTS_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_show_listeners }, { LISTCLIENTS_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_show_listeners },
{ LISTCLIENTS_TRANSFORMED_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_TRANSFORMED, command_show_listeners }, { LISTCLIENTS_HTML_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_HTML, command_show_listeners },
{ STATS_RAW_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_RAW, command_stats }, { STATS_RAW_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_RAW, command_stats },
{ STATS_TRANSFORMED_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_TRANSFORMED, command_stats }, { STATS_HTML_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_HTML, command_stats },
{ "stats.xml", ADMINTYPE_HYBRID, ADMIN_FORMAT_RAW, command_stats }, { "stats.xml", ADMINTYPE_HYBRID, ADMIN_FORMAT_RAW, command_stats },
{ QUEUE_RELOAD_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_queue_reload }, { QUEUE_RELOAD_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_queue_reload },
{ QUEUE_RELOAD_TRANSFORMED_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_TRANSFORMED, command_queue_reload }, { QUEUE_RELOAD_HTML_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_HTML, command_queue_reload },
{ LISTMOUNTS_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_list_mounts }, { LISTMOUNTS_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_list_mounts },
{ LISTMOUNTS_TRANSFORMED_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_TRANSFORMED, command_list_mounts }, { LISTMOUNTS_HTML_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_HTML, command_list_mounts },
{ STREAMLIST_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_list_mounts }, { STREAMLIST_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_list_mounts },
{ STREAMLIST_PLAINTEXT_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_PLAINTEXT, command_list_mounts }, { STREAMLIST_PLAINTEXT_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_PLAINTEXT, command_list_mounts },
{ STREAMLIST_TRANSFORMED_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_TRANSFORMED, command_list_mounts }, { STREAMLIST_HTML_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_HTML, command_list_mounts },
{ MOVECLIENTS_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_move_clients }, { MOVECLIENTS_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_move_clients },
{ MOVECLIENTS_TRANSFORMED_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_TRANSFORMED, command_move_clients }, { MOVECLIENTS_HTML_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_HTML, command_move_clients },
{ KILLCLIENT_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_kill_client }, { KILLCLIENT_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_kill_client },
{ KILLCLIENT_TRANSFORMED_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_TRANSFORMED, command_kill_client }, { KILLCLIENT_HTML_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_HTML, command_kill_client },
{ KILLSOURCE_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_kill_source }, { KILLSOURCE_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_kill_source },
{ KILLSOURCE_TRANSFORMED_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_TRANSFORMED, command_kill_source }, { KILLSOURCE_HTML_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_HTML, command_kill_source },
{ MANAGEAUTH_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_manageauth }, { MANAGEAUTH_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_manageauth },
{ MANAGEAUTH_TRANSFORMED_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_TRANSFORMED, command_manageauth }, { MANAGEAUTH_HTML_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_HTML, command_manageauth },
{ UPDATEMETADATA_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_updatemetadata }, { UPDATEMETADATA_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_updatemetadata },
{ UPDATEMETADATA_TRANSFORMED_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_TRANSFORMED, command_updatemetadata }, { UPDATEMETADATA_HTML_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_HTML, command_updatemetadata },
{ BUILDM3U_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_buildm3u }, { BUILDM3U_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_buildm3u },
{ DEFAULT_TRANSFORMED_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_TRANSFORMED, command_stats }, { DEFAULT_HTML_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_HTML, command_stats },
{ DEFAULT_RAW_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_TRANSFORMED, command_stats } { DEFAULT_RAW_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_HTML, command_stats }
}; };
static admin_command_table_t command_tables[ADMIN_MAX_COMMAND_TABLES] = { static admin_command_table_t command_tables[ADMIN_MAX_COMMAND_TABLES] = {
@ -451,7 +451,7 @@ void admin_send_response(xmlDocPtr doc,
client->respcode = 200; client->respcode = 200;
fserve_add_client (client, NULL); fserve_add_client (client, NULL);
} }
if (response == ADMIN_FORMAT_TRANSFORMED) { if (response == ADMIN_FORMAT_HTML) {
char *fullpath_xslt_template; char *fullpath_xslt_template;
size_t fullpath_xslt_template_len; size_t fullpath_xslt_template_len;
ice_config_t *config = config_get_config(); ice_config_t *config = config_get_config();
@ -605,7 +605,7 @@ static void command_move_clients(client_t *client,
if (!parameters_passed) { if (!parameters_passed) {
doc = admin_build_sourcelist(source->mount); doc = admin_build_sourcelist(source->mount);
admin_send_response(doc, client, response, admin_send_response(doc, client, response,
MOVECLIENTS_TRANSFORMED_REQUEST); MOVECLIENTS_HTML_REQUEST);
xmlFreeDoc(doc); xmlFreeDoc(doc);
return; return;
} }
@ -738,7 +738,7 @@ static void command_show_listeners(client_t *client,
admin_add_listeners_to_mount(source, srcnode, client->mode); admin_add_listeners_to_mount(source, srcnode, client->mode);
admin_send_response(doc, client, response, admin_send_response(doc, client, response,
LISTCLIENTS_TRANSFORMED_REQUEST); LISTCLIENTS_HTML_REQUEST);
xmlFreeDoc(doc); xmlFreeDoc(doc);
} }
@ -914,7 +914,7 @@ static void command_manageauth(client_t *client, source_t *source, admin_format_
auth_release(auth); auth_release(auth);
admin_send_response(doc, client, response, admin_send_response(doc, client, response,
MANAGEAUTH_TRANSFORMED_REQUEST); MANAGEAUTH_HTML_REQUEST);
free(message); free(message);
xmlFreeDoc(doc); xmlFreeDoc(doc);
return; return;
@ -1132,7 +1132,7 @@ static void command_stats(client_t *client, source_t *source, admin_format_t res
ICECAST_LOG_DEBUG("Stats request, sending xml stats"); ICECAST_LOG_DEBUG("Stats request, sending xml stats");
doc = stats_get_xml(1, mount, client->mode); doc = stats_get_xml(1, mount, client->mode);
admin_send_response(doc, client, response, STATS_TRANSFORMED_REQUEST); admin_send_response(doc, client, response, STATS_HTML_REQUEST);
xmlFreeDoc(doc); xmlFreeDoc(doc);
return; return;
} }
@ -1186,7 +1186,7 @@ static void command_list_mounts(client_t *client, source_t *source, admin_format
avl_tree_unlock(global.source_tree); avl_tree_unlock(global.source_tree);
admin_send_response(doc, client, response, admin_send_response(doc, client, response,
LISTMOUNTS_TRANSFORMED_REQUEST); LISTMOUNTS_HTML_REQUEST);
xmlFreeDoc(doc); xmlFreeDoc(doc);
} }
} }
@ -1205,6 +1205,6 @@ static void command_updatemetadata(client_t *client,
xmlDocSetRootElement(doc, node); xmlDocSetRootElement(doc, node);
admin_send_response(doc, client, response, admin_send_response(doc, client, response,
UPDATEMETADATA_TRANSFORMED_REQUEST); UPDATEMETADATA_HTML_REQUEST);
xmlFreeDoc(doc); xmlFreeDoc(doc);
} }

View File

@ -252,8 +252,8 @@ static inline void _client_send_error(client_t *client, const icecast_error_t *e
case ADMIN_FORMAT_RAW: case ADMIN_FORMAT_RAW:
xslt = NULL; xslt = NULL;
break; break;
case ADMIN_FORMAT_TRANSFORMED: case ADMIN_FORMAT_HTML:
xslt = CLIENT_DEFAULT_ERROR_XSL_TRANSFORMED; xslt = CLIENT_DEFAULT_ERROR_XSL_HTML;
break; break;
case ADMIN_FORMAT_PLAINTEXT: case ADMIN_FORMAT_PLAINTEXT:
xslt = CLIENT_DEFAULT_ERROR_XSL_PLAINTEXT; xslt = CLIENT_DEFAULT_ERROR_XSL_PLAINTEXT;
@ -435,8 +435,8 @@ void client_send_reportxml(client_t *client, reportxml_t *report, document_domai
case ADMIN_FORMAT_RAW: case ADMIN_FORMAT_RAW:
/* noop, we don't need to set xsl */ /* noop, we don't need to set xsl */
break; break;
case ADMIN_FORMAT_TRANSFORMED: case ADMIN_FORMAT_HTML:
xsl = CLIENT_DEFAULT_REPORT_XSL_TRANSFORMED; xsl = CLIENT_DEFAULT_REPORT_XSL_HTML;
break; break;
case ADMIN_FORMAT_PLAINTEXT: case ADMIN_FORMAT_PLAINTEXT:
xsl = CLIENT_DEFAULT_REPORT_XSL_PLAINTEXT; xsl = CLIENT_DEFAULT_REPORT_XSL_PLAINTEXT;
@ -563,7 +563,7 @@ admin_format_t client_get_admin_format_by_content_negotiation(client_t *client)
if (strcmp(pref, "text/xml") == 0) { if (strcmp(pref, "text/xml") == 0) {
return ADMIN_FORMAT_RAW; return ADMIN_FORMAT_RAW;
} else if (strcmp(pref, "text/html") == 0) { } else if (strcmp(pref, "text/html") == 0) {
return ADMIN_FORMAT_TRANSFORMED; return ADMIN_FORMAT_HTML;
} else if (strcmp(pref, "text/plain") == 0) { } else if (strcmp(pref, "text/plain") == 0) {
return ADMIN_FORMAT_PLAINTEXT; return ADMIN_FORMAT_PLAINTEXT;
} else { } else {

View File

@ -27,11 +27,11 @@
#include "refbuf.h" #include "refbuf.h"
#include "module.h" #include "module.h"
#define CLIENT_DEFAULT_REPORT_XSL_TRANSFORMED "report-html.xsl" #define CLIENT_DEFAULT_REPORT_XSL_HTML "report-html.xsl"
#define CLIENT_DEFAULT_REPORT_XSL_PLAINTEXT "report-plaintext.xsl" #define CLIENT_DEFAULT_REPORT_XSL_PLAINTEXT "report-plaintext.xsl"
#define CLIENT_DEFAULT_ERROR_XSL_TRANSFORMED "error-html.xsl" #define CLIENT_DEFAULT_ERROR_XSL_HTML "error-html.xsl"
#define CLIENT_DEFAULT_ERROR_XSL_PLAINTEXT "error-plaintext.xsl" #define CLIENT_DEFAULT_ERROR_XSL_PLAINTEXT "error-plaintext.xsl"
#define CLIENT_DEFAULT_ADMIN_FORMAT ADMIN_FORMAT_TRANSFORMED #define CLIENT_DEFAULT_ADMIN_FORMAT ADMIN_FORMAT_HTML
typedef enum _document_domain_tag { typedef enum _document_domain_tag {
DOCUMENT_DOMAIN_WEB, DOCUMENT_DOMAIN_WEB,

View File

@ -506,7 +506,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
*eol = '\0'; *eol = '\0';
doc = stats_get_xml (0, reference, httpclient->mode); doc = stats_get_xml (0, reference, httpclient->mode);
free (reference); free (reference);
admin_send_response (doc, httpclient, ADMIN_FORMAT_TRANSFORMED, xslt_playlist_requested); admin_send_response (doc, httpclient, ADMIN_FORMAT_HTML, xslt_playlist_requested);
xmlFreeDoc(doc); xmlFreeDoc(doc);
free (fullpath); free (fullpath);
return 0; return 0;

View File

@ -32,7 +32,7 @@ typedef int32_t admin_command_id_t;
typedef enum { typedef enum {
ADMIN_FORMAT_AUTO, ADMIN_FORMAT_AUTO,
ADMIN_FORMAT_RAW, ADMIN_FORMAT_RAW,
ADMIN_FORMAT_TRANSFORMED, ADMIN_FORMAT_HTML,
ADMIN_FORMAT_PLAINTEXT ADMIN_FORMAT_PLAINTEXT
} admin_format_t; } admin_format_t;