void gss_program_get_resource (GssTransaction * t) { GssProgram *program = (GssProgram *) t->resource->priv; GString *s = g_string_new (""); t->s = s; gss_html_header (t); GSS_P ("<h1>%s</h1>\n", GSS_OBJECT_SAFE_TITLE (program)); gss_program_add_video_block (program, t, 0); GSS_P ("<br>%s", program->safe_description); GSS_A ("<br>"); gss_program_add_stream_table (program, s); if (t->session && t->session->is_admin) { gss_config_append_config_block (G_OBJECT (program), t, FALSE); } gss_html_footer (t); }
void gss_transaction_error_not_found (GssTransaction * t, const char *reason) { char *content; t->debug_message = reason; if (t->server->enable_public_interface) { GString *s; t->s = g_string_new (""); s = t->s; gss_html_header (t); GSS_A ("<h1>Error 404: Not found</h1>\n"); gss_html_footer (t); content = g_string_free (s, FALSE); soup_message_set_response (t->msg, GSS_TEXT_HTML, SOUP_MEMORY_TAKE, content, strlen (content)); t->s = NULL; } else { content = g_strdup_printf ("404 Not found\n"); soup_message_set_response (t->msg, GSS_TEXT_PLAIN, SOUP_MEMORY_TAKE, content, strlen (content)); } soup_message_set_status (t->msg, SOUP_STATUS_NOT_FOUND); }
static void gss_server_resource_main_page (GssTransaction * t) { GString *s; GList *g; s = t->s = g_string_new (""); gss_html_header (t); GSS_P ("<ul class='thumbnails'>\n"); for (g = t->server->programs; g; g = g_list_next (g)) { GssProgram *program = g->data; if (program->is_archive) continue; GSS_P ("<li class='span4'>\n"); GSS_P ("<div class='thumbnail'>\n"); GSS_P ("<a href=\"/%s%s%s\">", GSS_OBJECT_NAME (program), t->session ? "?session_id=" : "", t->session ? t->session->session_id : ""); gss_program_add_jpeg_block (program, t); GSS_P ("</a>\n"); GSS_P ("<h5>%s</h5>\n", GSS_OBJECT_SAFE_TITLE (program)); GSS_P ("</div>\n"); GSS_P ("</li>\n"); } GSS_P ("</ul>\n"); if (t->server->enable_vod) { GSS_P ("<ul class='thumbnails'>\n"); for (g = t->server->programs; g; g = g_list_next (g)) { GssProgram *program = g->data; if (!program->is_archive) continue; GSS_P ("<li class='span4'>\n"); GSS_P ("<div class='thumbnail'>\n"); GSS_P ("<a href=\"/%s%s%s\">", GSS_OBJECT_NAME (program), t->session ? "?session_id=" : "", t->session ? t->session->session_id : ""); gss_program_add_jpeg_block (program, t); GSS_P ("</a>\n"); GSS_P ("<h5>%s</h5>\n", GSS_OBJECT_SAFE_TITLE (program)); GSS_P ("</div>\n"); GSS_P ("</li>\n"); } GSS_P ("</ul>\n"); } gss_html_footer (t); }
static void gss_server_get_resource (GssTransaction * t) { GssServer *server = GSS_SERVER (t->resource->priv); GString *s = g_string_new (""); t->s = s; gss_html_header (t); g_string_append (s, "<h1>Server Configuration</h1><br>\n"); gss_config_append_config_block (G_OBJECT (server), t, FALSE); gss_html_footer (t); }
void gss_transaction_error (GssTransaction * t, const char *message) { GString *s = g_string_new (""); t->s = s; gss_html_header (t); g_string_append (s, "<h1>Configuration Failed</h1><hr>\n"); g_string_append (s, "<p>Invalid configuration options were provided.\n" "Please return to previous page and retry.</p>\n"); gss_html_footer (t); soup_message_set_status (t->msg, SOUP_STATUS_BAD_REQUEST); }
void gss_html_error_404 (GssServer * server, SoupMessage * msg) { char *content; GString *s; GssTransaction t = { 0 }; s = g_string_new (""); t.s = s; t.server = server; t.msg = msg; gss_html_header (&t); GSS_A ("<h1>Error 404: Page not found</h1>\n"); gss_html_footer (&t); content = g_string_free (s, FALSE); soup_message_set_response (msg, GSS_TEXT_HTML, SOUP_MEMORY_TAKE, content, strlen (content)); soup_message_set_status (msg, SOUP_STATUS_NOT_FOUND); }
static void gss_program_get_resource (GssTransaction * t) { GssProgram *program = (GssProgram *) t->resource->priv; GString *s = g_string_new (""); t->s = s; gss_html_header (t); GSS_P ("<h1>%s</h1>\n", GST_OBJECT_NAME (program)); gss_program_add_video_block (program, t, 0); gss_html_append_break (s); gss_program_add_stream_table (program, s); if (t->session && t->session->is_admin) { gss_config_append_config_block (G_OBJECT (program), t, FALSE); } gss_html_footer (t); }
static void gss_server_resource_about (GssTransaction * t) { GString *s; s = t->s = g_string_new (""); gss_html_header (t); GSS_P ("<h2>About</h2>\n"); GSS_P ("<p>GStreamer Streaming Server is based on the work of many\n"); GSS_P ("open source projects, some of which are listed below.\n"); GSS_P ("</p>\n"); GSS_P ("<h3>GStreamer Streaming Server</h3>\n"); GSS_P ("<pre>\n"); GSS_P ("Copyright (C) 2009-2012 Entropy Wave Inc <[email protected]>\n"); GSS_P ("Copyright (C) 2009-2012 David Schleef <[email protected]>\n"); GSS_P ("Copyright (C) 2012 Jan Schmidt <[email protected]>\n"); GSS_P ("Copyright (C) 2013 Rdio Inc <[email protected]>\n"); GSS_P ("\n"); GSS_P ("This library is free software; you can redistribute it and/or\n"); GSS_P ("modify it under the terms of the GNU Library General Public\n"); GSS_P ("License as published by the Free Software Foundation; either\n"); GSS_P ("version 2 of the License, or (at your option) any later version.\n"); GSS_P ("\n"); GSS_P ("This library is distributed in the hope that it will be useful,\n"); GSS_P ("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); GSS_P ("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"); GSS_P ("Library General Public License for more details.\n"); GSS_P ("\n"); GSS_P ("You should have received a copy of the GNU Library General Public\n"); GSS_P ("License along with this library; if not, write to the\n"); GSS_P ("Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n"); GSS_P ("Boston, MA 02110-1301, USA.\n"); GSS_P ("</pre>\n"); GSS_P ("<h3>Twitter Bootstrap</h3>\n"); GSS_P ("<pre>\n"); GSS_A ("Copyright 2012 Twitter, Inc\n"); GSS_A ("Licensed under the Apache License v2.0\n"); GSS_A ("http://www.apache.org/licenses/LICENSE-2.0\n"); GSS_A ("\n"); GSS_A ("Designed and built with all the love in the world @twitter by @mdo and @fat.\n"); GSS_P ("</pre>\n"); GSS_P ("<h3>GStreamer</h3>\n"); GSS_P ("<p>Includes gstreamer, gst-plugins-base, gst-plugins-good, \n"); GSS_P ("gst-plugins-bad, and gst-rtsp-server.</p>\n"); GSS_P ("<pre>\n"); GSS_P ("Copyright (C) 1999-2012 GStreamer contributors\n"); GSS_P ("\n"); GSS_P ("This library is free software; you can redistribute it and/or\n"); GSS_P ("modify it under the terms of the GNU Library General Public\n"); GSS_P ("License as published by the Free Software Foundation; either\n"); GSS_P ("version 2 of the License, or (at your option) any later version.\n"); GSS_P ("\n"); GSS_P ("This library is distributed in the hope that it will be useful,\n"); GSS_P ("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); GSS_P ("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"); GSS_P ("Library General Public License for more details.\n"); GSS_P ("\n"); GSS_P ("You should have received a copy of the GNU Library General Public\n"); GSS_P ("License along with this library; if not, write to the\n"); GSS_P ("Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n"); GSS_P ("Boston, MA 02110-1301, USA.\n"); GSS_P ("</pre>\n"); GSS_P ("<h3>Libsoup</h3>\n"); GSS_P ("<pre>\n"); GSS_P ("Copyright (C) 2009, 2010 Red Hat, Inc.\n"); GSS_A ("Copyright 1999-2003 Ximian, Inc.\n"); GSS_A ("Copyright (C) 2000-2003, Ximian, Inc.\n"); GSS_A ("Copyright (C) 2001-2007 Novell, Inc.\n"); GSS_A ("Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.\n"); GSS_A ("Copyright (C) 2008 Diego Escalante Urrelo\n"); GSS_A ("Copyright (C) 2009, 2011 Collabora Ltd.\n"); GSS_A ("Copyright (C) 2009 Gustavo Noronha Silva.\n"); GSS_A ("Copyright (C) 2009, 2010 Igalia S.L.\n"); GSS_P ("\n"); GSS_P ("This library is free software; you can redistribute it and/or\n"); GSS_P ("modify it under the terms of the GNU Library General Public\n"); GSS_P ("License as published by the Free Software Foundation; either\n"); GSS_P ("version 2 of the License, or (at your option) any later version.\n"); GSS_P ("\n"); GSS_P ("This library is distributed in the hope that it will be useful,\n"); GSS_P ("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); GSS_P ("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"); GSS_P ("Library General Public License for more details.\n"); GSS_P ("\n"); GSS_P ("You should have received a copy of the GNU Library General Public\n"); GSS_P ("License along with this library; if not, write to the\n"); GSS_P ("Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n"); GSS_P ("Boston, MA 02110-1301, USA.\n"); GSS_P ("</pre>\n"); GSS_P ("<h3>JSON-Glib</h3>\n"); GSS_P ("<pre>\n"); GSS_P ("Copyright (C) 1997, 1998 Tim Janik\n"); GSS_P ("Copyright (C) 2007, 2008, 2009 OpenedHand Ltd.\n"); GSS_P ("Copyright (C) 2009, 2010, 2011 Intel Corp.\n"); GSS_P ("Copyright (C) 2010 Luca Bruno <[email protected]>\n"); GSS_P ("\n"); GSS_P ("This library is free software; you can redistribute it and/or\n"); GSS_P ("modify it under the terms of the GNU Lesser General Public\n"); GSS_P ("License as published by the Free Software Foundation; either\n"); GSS_P ("version 2.1 of the License, or (at your option) any later version.\n"); GSS_P ("\n"); GSS_P ("This library is distributed in the hope that it will be useful,\n"); GSS_P ("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); GSS_P ("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"); GSS_P ("Library General Public License for more details.\n"); GSS_P ("\n"); GSS_P ("You should have received a copy of the GNU Library General Public\n"); GSS_P ("License along with this library; if not, write to the\n"); GSS_P ("Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n"); GSS_P ("Boston, MA 02110-1301, USA.\n"); GSS_P ("</pre>\n"); GSS_P ("<h3>dashif.org DASH player</h3>\n"); GSS_P ("<pre>\n"); GSS_P ("The copyright in this software is being made available under\n"); GSS_P ("the BSD License,\n"); GSS_P ("included below. This software may be subject to other third\n"); GSS_P ("party and contributor rights, including patent rights, and no\n"); GSS_P ("such rights are granted under this license.\n"); GSS_P ("\n"); GSS_P ("Copyright (c) 2013, Digital Primates\n"); GSS_P ("All rights reserved.\n"); GSS_P ("\n"); GSS_P ("Redistribution and use in source and binary forms, with or\n"); GSS_P ("without modification, are permitted provided that the following\n"); GSS_P ("conditions are met:\n"); GSS_P ("Redistributions of source code must retain the above copyright\n"); GSS_P ("notice, this list of conditions and the following disclaimer.\n"); GSS_P ("Redistributions in binary form must reproduce the above copyright\n"); GSS_P ("notice, this list of conditions and the following disclaimer in\n"); GSS_P ("the documentation and/or other materials provided with the\n"); GSS_P ("distribution.\n"); GSS_P ("Neither the name of the Digital Primates nor the names of its\n"); GSS_P ("contributors may be used to endorse or promote products derived\n"); GSS_P ("from this software without specific prior written permission.\n"); GSS_P ("\n"); GSS_P ("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n"); GSS_P ("CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n"); GSS_P ("INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n"); GSS_P ("MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n"); GSS_P ("DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n"); GSS_P ("CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n"); GSS_P ("SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n"); GSS_P ("LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n"); GSS_P ("USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n"); GSS_P ("AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n"); GSS_P ("LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n"); GSS_P ("IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n"); GSS_P ("THE POSSIBILITY OF SUCH DAMAGE.\n"); GSS_P ("\n"); GSS_P ("</pre>\n"); gss_html_footer (t); }
static void gss_config_get_resource (GssTransaction * t) { GString *s = g_string_new (""); GList *g; t->s = s; gss_html_header (t); g_string_append (s, "<h1>Configuration</h1>\n"); g_string_append (s, "<br>\n"); /* FIXME do not work */ gss_html_append_button (s, "Download", "download", "download"); gss_html_append_button (s, "Upload", "upload", "upload"); gss_html_append_button (s, "Reset", "reset", "reset"); g_string_append (s, "<br>\n"); g_string_append (s, "<table class='table table-striped table-bordered " "table-condensed'>\n"); g_string_append (s, "<thead>\n"); g_string_append (s, "<tr>\n"); g_string_append (s, "<th>Parameter</th>\n"); g_string_append (s, "<th>Value</th>\n"); g_string_append (s, "</tr>\n"); g_string_append (s, "</thead>\n"); g_string_append (s, "<tbody>\n"); for (g = config_list; g; g = g_list_next (g)) { GObject *object = g->data; GParamSpec **pspecs; int n_properties; int i; pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), (guint *) & n_properties); for (i = 0; i < n_properties; i++) { const GParamSpec *pspec = pspecs[i]; char *value_string; char *safe; gboolean is_default; if (!(pspec->flags & G_PARAM_WRITABLE)) continue; if (!(pspec->flags & G_PARAM_READABLE)) continue; if (strcmp (pspec->name, "name") == 0) continue; is_default = g_object_property_is_default (object, pspec); g_string_append (s, "<tr>\n"); g_string_append (s, "<td>\n"); if (!is_default) g_string_append (s, "<b>"); g_string_append_printf (s, "%s.%s\n", GST_OBJECT_NAME (object), pspec->name); g_string_append (s, "</td>\n"); if (!is_default) g_string_append (s, "</b>"); g_string_append (s, "<td>"); if (!is_default) g_string_append (s, "<b>"); g_string_append (s, "<pre class='pre-table'>"); value_string = g_object_get_as_string (object, pspec); safe = gss_html_sanitize_entity (value_string); g_string_append (s, safe); g_free (safe); g_free (value_string); g_string_append (s, "</pre>"); if (!is_default) g_string_append (s, "</b>"); g_string_append (s, "</td>\n"); g_string_append (s, "</tr>\n"); } g_free (pspecs); } g_string_append (s, "</tbody>\n"); g_string_append (s, "</table>\n"); gss_html_footer (t); }