Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
webui: add build time and configure options to status page
  • Loading branch information
stbenz authored and perexg committed Jun 9, 2015
1 parent 97e8041 commit 8d6cb72
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 27 deletions.
18 changes: 17 additions & 1 deletion Makefile
Expand Up @@ -415,6 +415,8 @@ ifeq ($(CONFIG_HDHOMERUN_STATIC),yes)
DEPS += ${BUILDDIR}/libhdhomerun_stamp
endif

SRCS += build.c timestamp.c

#
# Build Rules
#
Expand Down Expand Up @@ -451,7 +453,7 @@ ${BUILDDIR}/%.so: ${SRCS_EXTRA}

# Clean
clean:
rm -rf ${BUILDDIR}/src ${BUILDDIR}/bundle*
rm -rf ${BUILDDIR}/src ${BUILDDIR}/bundle* ${BUILDDIR}/build.o ${BUILDDIR}/timestamp.*
find . -name "*~" | xargs rm -f
$(MAKE) -f Makefile.webui clean

Expand All @@ -476,6 +478,20 @@ src/webui/extjs.c: make_webui
# Include OS specific targets
include ${ROOTDIR}/support/${OSENV}.mk

# Build files
$(BUILDDIR)/timestamp.c: FORCE
@mkdir -p $(dir $@)
@echo '#include "build.h"' > $@
@echo 'const char* build_timestamp = "'`date -Iseconds`'";' >> $@

$(BUILDDIR)/timestamp.o: $(BUILDDIR)/timestamp.c
@mkdir -p $(dir $@)
$(CC) -c -o $@ $<

$(BUILDDIR)/build.o: $(BUILDDIR)/build.c
@mkdir -p $(dir $@)
$(CC) -c -o $@ $<

# Bundle files
$(BUILDDIR)/bundle.o: $(BUILDDIR)/bundle.c
@mkdir -p $(dir $@)
Expand Down
54 changes: 28 additions & 26 deletions src/webui/extjs.c
Expand Up @@ -203,32 +203,34 @@ page_about(http_connection_t *hc, const char *remain, void *opaque)
{
htsbuf_queue_t *hq = &hc->hc_reply;

htsbuf_qprintf(hq,
"<center>"
"<div class=\"about-title\">"
"HTS Tvheadend %s"
"</div><br>"
"&copy; 2006 - 2015 Andreas \303\226man, et al.<br><br>"
"<img src=\"docresources/tvheadendlogo.png\"><br>"
"<a href=\"https://tvheadend.org\">"
"https://tvheadend.org</a><br><br>"
"Based on software from "
"<a target=\"_blank\" href=\"http://www.extjs.com/\">ExtJS</a>. "
"Icons from "
"<a target=\"_blank\" href=\"http://www.famfamfam.com/lab/icons/silk/\">"
"FamFamFam</a>"
"<br><br>"
"Build: %s"
"<p>"
"If you'd like to support the project, please consider a donation."
"<br/>"
"All proceeds are used to support server infrastructure and buy test "
"equipment."
"<br/>"
"<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3Z87UEHP3WZK2'><img src='https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif' alt='' /></a>"
"</center>",
tvheadend_version,
tvheadend_version);
htsbuf_qprintf(hq,
"<center>"
"<div class=\"about-title\">HTS Tvheadend %s</div>"
"<p>&copy; 2006 - 2015 Andreas \303\226man, et al.</p>"
"<p><img src=\"docresources/tvheadendlogo.png\"></p>"
"<p><a href=\"https://tvheadend.org\">https://tvheadend.org</a></p>"
"<p>Based on software from "
"<a target=\"_blank\" href=\"http://www.extjs.com/\">ExtJS</a>. "
"Icons from "
"<a target=\"_blank\" href=\"http://www.famfamfam.com/lab/icons/silk/\">"
"FamFamFam</a>"
"</p>"
"<p>Build: %s (%s) <a href=\"javascript:void(0)\" "
"onclick=\"Ext.get('textarea_build_config').setVisibilityMode(Ext.Element.DISPLAY).toggle()\">Toggle details</a></p>"
"<textarea id=\"textarea_build_config\" rows=\"20\" cols=\"80\" readonly "
"style=\"display: none; margin: 5px auto 10px\">"
"%s"
"</textarea>"
"<p>"
"If you'd like to support the project, please consider a donation.<br/>"
"All proceeds are used to support server infrastructure and buy test equipment."
"</p>"
"<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3Z87UEHP3WZK2'><img src='https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif' alt='' /></a>"
"</center>",
tvheadend_version,
tvheadend_version,
build_timestamp,
build_config_str);

http_output_html(hc);
return 0;
Expand Down
24 changes: 24 additions & 0 deletions support/configure.inc
Expand Up @@ -510,5 +510,29 @@ CONFIG_${k} = no
EOF
fi
done

# Add build config string declaration
cat >> "${CONFIG_H}" <<EOF
extern const char* build_config_str;
extern const char* build_timestamp;
EOF

# Create C source
CONFIG_C="${BUILDDIR}/build.c"
cat > "${CONFIG_C}" <<EOF
// Automatically generated by configure - DO NOT EDIT!
#include "build.h"
const char* build_config_str =
EOF

# Add configure command
echo " \"Configure arguments:\\n\"" >> "${CONFIG_C}"
echo " ${CONFIGURE_ARGS}" | sed -e 's/"/\\"/g' | sed -e 's/.*/ "\0" "\\n"/g' >> "${CONFIG_C}"

# Add build config string
print_config | sed -e 's/"/\\"/g' | sed -e 's/.*/ "\0" "\\n"/g' >> "${CONFIG_C}"
echo ' "";' >> "${CONFIG_C}"
}

0 comments on commit 8d6cb72

Please sign in to comment.