<commit_before>/**
 * @file scoreboard.go
 * @author <NAME> jollheef<AT>riseup.net
 * @license GNU GPLv3
 * @date September, 2015
 * @brief web security advisory
 *
 * Contain web ui and several helpers for show advisory results
 */

package scoreboard

import (
	"database/sql"
	"fmt"
	"golang.org/x/net/websocket"
	"time"
)

import "tinfoilhat/steward"

func AdvisoryToHtml(adv steward.Advisory) (html string) {

	html = fmt.Sprintf("<h3>IBST.PSU.CTF-%d-%03d</h3>",
		adv.Timestamp.Year(), adv.Id)

	html += "<br><h4>Summary:</h4>"

	html += adv.Text

	html += fmt.Sprintf("<h4>Published: %d.%d.%d %d:%d</h3>",
		adv.Timestamp.Day(),
		adv.Timestamp.Month(),
		adv.Timestamp.Year(),
		adv.Timestamp.Hour(),
		adv.Timestamp.Minute())

	html += fmt.Sprintf("<h4>Score: %d</h3><br>", adv.Score)

	return
}

var advisories string

func AdvisoryUpdater(db *sql.DB, update_timeout time.Duration) {

	for {
		var tmp_advisories string

		advs, err := steward.GetAdvisories(db)
		if err != nil {
			time.Sleep(update_timeout)<commit_msg>Wrap advisory text with <pre></pre> tag<commit_after>/**
 * @file scoreboard.go
 * @author <NAME> jollheef<AT>riseup.net
 * @license GNU GPLv3
 * @date September, 2015
 * @brief web security advisory
 *
 * Contain web ui and several helpers for show advisory results
 */

package scoreboard

import (
	"database/sql"
	"fmt"
	"golang.org/x/net/websocket"
	"time"
)

import "tinfoilhat/steward"

func AdvisoryToHtml(adv steward.Advisory) (html string) {

	html = fmt.Sprintf("<h3>IBST.PSU.CTF-%d-%04d</h3>",
		adv.Timestamp.Year(), adv.Id)

	html += "<br><h4>Summary:</h4>"

	html += `<pre style="background-color: #000084; color: #ffffff">` +
		adv.Text + "</pre>"

	html += fmt.Sprintf("<h4>Published: %d.%d.%d %d:%d</h3>",
		adv.Timestamp.Day(),
		adv.Timestamp.Month(),
		adv.Timestamp.Year(),
		adv.Timestamp.Hour(),
		adv.Timestamp.Minute())

	html += fmt.Sprintf("<h4>Score: %d</h3><br>", adv.Score)

	return
}

var advisories string

func AdvisoryUpdater(db *sql.DB, update_timeout time.Duration) {

	for {
		var tmp_advisories string

		advs, err := steward.GetAdvisories(db)
		if err != nil {
			time.Sleep(update_timeout)
{'fraction_non_alphanumeric': 0.17353077279037482, 'fraction_numerical': 0.016658954187875982, 'mean_word_length': 4.184652278177458, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2872865', 'n_tokens_mistral': 883, 'n_tokens_neox': 800, 'n_words': 172}