diff --git a/package/share/ahriman/build-status.jinja2 b/package/share/ahriman/build-status.jinja2
index 3d36e9d1..2355473c 100644
--- a/package/share/ahriman/build-status.jinja2
+++ b/package/share/ahriman/build-status.jinja2
@@ -1,7 +1,7 @@
-
ahriman
-
-
-
+
+
+
{% include "search-line.jinja2" %}
@@ -31,11 +31,11 @@
{% for package in packages %}
- {{ package.base|e }} |
+ {{ package.base }} |
{{ package.packages|join(" "|safe) }} |
- {{ package.version|e }} |
- {{ package.timestamp|e }} |
- {{ package.status|e }} |
+ {{ package.version }} |
+ {{ package.timestamp }} |
+ {{ package.status }} |
{% endfor %}
diff --git a/package/share/ahriman/repo-index.jinja2 b/package/share/ahriman/repo-index.jinja2
index daacaaac..23cb48df 100644
--- a/package/share/ahriman/repo-index.jinja2
+++ b/package/share/ahriman/repo-index.jinja2
@@ -1,7 +1,7 @@
-
{{ repository|e }}
+
{{ repository }}
{% include "style.jinja2" %}
@@ -18,13 +18,13 @@
{% if pgp_key is not none %}
- This repository is signed with {{ pgp_key|e }} by default.
+ This repository is signed with {{ pgp_key }} by default.
{% endif %}
$ cat /etc/pacman.conf
- [{{ repository|e }}]
- Server = {{ link_path|e }}
+ [{{ repository }}]
+ Server = {{ link_path }}
SigLevel = Database{% if has_repo_signed %}Required{% else %}Never{% endif %} Package{% if has_package_signed %}Required{% else %}Never{% endif %} TrustedOnly
@@ -44,11 +44,11 @@
{% for package in packages %}
- {{ package.name|e }} |
- {{ package.version|e }} |
- {{ package.archive_size|e }} |
- {{ package.installed_size|e }} |
- {{ package.build_date|e }} |
+ {{ package.name }} |
+ {{ package.version }} |
+ {{ package.archive_size }} |
+ {{ package.installed_size }} |
+ {{ package.build_date }} |
{% endfor %}
@@ -58,7 +58,7 @@
diff --git a/package/share/ahriman/search-line.jinja2 b/package/share/ahriman/search-line.jinja2
index cb685672..d612db3b 100644
--- a/package/share/ahriman/search-line.jinja2
+++ b/package/share/ahriman/search-line.jinja2
@@ -1,3 +1,3 @@
\ No newline at end of file
+
diff --git a/package/share/ahriman/search.jinja2 b/package/share/ahriman/search.jinja2
index a1c80092..0f2553eb 100644
--- a/package/share/ahriman/search.jinja2
+++ b/package/share/ahriman/search.jinja2
@@ -5,21 +5,22 @@
const tables = document.getElementsByClassName("search-table");
for (let i = 0; i < tables.length; i++) {
- const tr = tables[i].getElementsByTagName("tr");
+ const trs = tables[i].getElementsByTagName("tr");
// from 1 coz of header
- for (let i = 1; i < tr.length; i++) {
- let td = tr[i].getElementsByClassName("include-search");
+ for (let i = 1; i < trs.length; i++) {
+ let tr = trs[i].getElementsByClassName("include-search");
let display = "none";
- for (let j = 0; j < td.length; j++) {
- if (td[j].tagName.toLowerCase() === "td") {
- if (td[j].innerHTML.toLowerCase().indexOf(filter) > -1) {
+ for (let j = 0; j < tr.length; j++) {
+ if (tr[j].tagName.toLowerCase() === "td") {
+ let contains = (element) => tr[j].innerHTML.toLowerCase().indexOf(element) > -1
+ if (filter.some(contains)) {
display = "";
break;
}
}
}
- tr[i].style.display = display;
+ trs[i].style.display = display;
}
}
}
-
\ No newline at end of file
+
diff --git a/package/share/ahriman/sorttable.jinja2 b/package/share/ahriman/sorttable.jinja2
index 12a1f08a..5fa1267b 100644
--- a/package/share/ahriman/sorttable.jinja2
+++ b/package/share/ahriman/sorttable.jinja2
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/package/share/ahriman/style.jinja2 b/package/share/ahriman/style.jinja2
index 26291537..80a821c3 100644
--- a/package/share/ahriman/style.jinja2
+++ b/package/share/ahriman/style.jinja2
@@ -133,4 +133,4 @@
ul.navigation li a:hover {
background-color: rgba(var(--color-hover), 1.0);
}
-
\ No newline at end of file
+
diff --git a/src/ahriman/core/report/jinja_template.py b/src/ahriman/core/report/jinja_template.py
index 5e50ee2a..c5846e24 100644
--- a/src/ahriman/core/report/jinja_template.py
+++ b/src/ahriman/core/report/jinja_template.py
@@ -85,7 +85,7 @@ class JinjaTemplate:
"""
# idea comes from https://stackoverflow.com/a/38642558
loader = jinja2.FileSystemLoader(searchpath=self.template_path.parent)
- environment = jinja2.Environment(loader=loader)
+ environment = jinja2.Environment(loader=loader, autoescape=True)
template = environment.get_template(self.template_path.name)
content = [
diff --git a/tests/testresources/web/templates b/tests/testresources/web/templates
new file mode 120000
index 00000000..d2954d31
--- /dev/null
+++ b/tests/testresources/web/templates
@@ -0,0 +1 @@
+../../../package/share/ahriman
\ No newline at end of file
diff --git a/tests/testresources/web/templates/build-status.jinja2 b/tests/testresources/web/templates/build-status.jinja2
deleted file mode 100644
index 3d36e9d1..00000000
--- a/tests/testresources/web/templates/build-status.jinja2
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
{{ repository|e }}
-
- {% include "style.jinja2" %}
-
- {% include "sorttable.jinja2" %}
- {% include "search.jinja2" %}
-
-
-
-
-
ahriman
-
-
-
-
-
- {% include "search-line.jinja2" %}
-
-
-
-
-
- {% for package in packages %}
-
- {{ package.base|e }} |
- {{ package.packages|join(" "|safe) }} |
- {{ package.version|e }} |
- {{ package.timestamp|e }} |
- {{ package.status|e }} |
-
- {% endfor %}
-
-
-
-
-
-
-
-
diff --git a/tests/testresources/web/templates/repo-index.jinja2 b/tests/testresources/web/templates/repo-index.jinja2
deleted file mode 100644
index 3edbb86f..00000000
--- a/tests/testresources/web/templates/repo-index.jinja2
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
{{ repository|e }}
-
- {% include "style.jinja2" %}
-
- {% include "sorttable.jinja2" %}
- {% include "search.jinja2" %}
-
-
-
-
-
Archlinux user repository
-
-
- {% if pgp_key is not none %}
- This repository is signed with {{ pgp_key|e }} by default.
- {% endif %}
-
-
- $ cat /etc/pacman.conf
- [{{ repository|e }}]
- Server = {{ link_path|e }}
- SigLevel = Database{% if has_repo_signed %}Required{% else %}Never{% endif %} Package{% if has_package_signed %}Required{% else %}Never{% endif %} TrustedOnly
-
-
-
- {% include "search-line.jinja2" %}
-
-
-
-
-
- {% for package in packages %}
-
- {{ package.name|e }} |
- {{ package.version|e }} |
- {{ package.archive_size|e }} |
- {{ package.installed_size|e }} |
- {{ package.build_date|e }} |
-
- {% endfor %}
-
-
-
-
-
-
-
diff --git a/tests/testresources/web/templates/search-line.jinja2 b/tests/testresources/web/templates/search-line.jinja2
deleted file mode 100644
index cb685672..00000000
--- a/tests/testresources/web/templates/search-line.jinja2
+++ /dev/null
@@ -1,3 +0,0 @@
-
\ No newline at end of file
diff --git a/tests/testresources/web/templates/search.jinja2 b/tests/testresources/web/templates/search.jinja2
deleted file mode 100644
index a1c80092..00000000
--- a/tests/testresources/web/templates/search.jinja2
+++ /dev/null
@@ -1,25 +0,0 @@
-
\ No newline at end of file
diff --git a/tests/testresources/web/templates/sorttable.jinja2 b/tests/testresources/web/templates/sorttable.jinja2
deleted file mode 100644
index 12a1f08a..00000000
--- a/tests/testresources/web/templates/sorttable.jinja2
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/tests/testresources/web/templates/style.jinja2 b/tests/testresources/web/templates/style.jinja2
deleted file mode 100644
index 26291537..00000000
--- a/tests/testresources/web/templates/style.jinja2
+++ /dev/null
@@ -1,136 +0,0 @@
-
\ No newline at end of file