Skip to content

Commit

Permalink
update docs-infra
Browse files Browse the repository at this point in the history
  • Loading branch information
superstes committed Dec 7, 2024
1 parent 87eeba7 commit 97847fa
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 7 deletions.
76 changes: 76 additions & 0 deletions docs/html_infra.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

if [ -z "$1" ]
then
DEST_DIR='build'
else
DEST_DIR="$1"
fi

set -euo pipefail

function log() {
msg="$1"
echo ''
echo "### ${msg} ###"
echo ''
}

cd "$(dirname "$0")"

SRC_DIR="$(pwd)"

TS="$(date +%s)"
TMP_DIR="/tmp/${TS}"
mkdir -p "${TMP_DIR}"

VENV_BIN='/tmp/.ag-opnsense-venv/bin/activate'
if [ -f "$VENV_BIN" ]
then
source "$VENV_BIN"
fi

log 'BUILDING DOCS'
export PYTHONWARNINGS='ignore'
sphinx-build -b html source/ "${TMP_DIR}/" >/dev/null

log 'PATCHING METADATA'
cp "${SRC_DIR}/meta/"* "${TMP_DIR}/"

HTML_META_SRC="<meta charset=\"utf-8\" />"
HTML_META="${HTML_META_SRC}<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self'; img-src 'self' https://files.oxl.at; style-src 'self' https://files.oxl.at 'unsafe-inline'; script-src 'self' https://files.oxl.at 'unsafe-inline' 'unsafe-eval'; connect-src 'self';\">"
HTML_META="${HTML_META}<link rel=\"icon\" type=\"image/webp\" href=\"https://files.oxl.at/img/oxl3_sm.webp\">"
HTML_META_EN="${HTML_META}" # <link rel=\"alternate\" href=\"https://docs.o-x-l.at\" hreflang=\"de\">
# HTML_LOGO_LINK_SRC='href=".*Go to homepage"'
# HTML_LOGO_LINK_EN='href="https://www.o-x-l.com" class="oxl-nav-logo" title="OXL IT Services Website"'
HTML_TITLE_BAD_EN='Ansible Collection OPNSense documentation'
HTML_TITLE_OK='OPNSense Ansible Collection'
HTML_LANG_NONE='<html'
HTML_LANG_EN='html lang="en"'

cd "${TMP_DIR}/"

sed -i "s|$HTML_META_SRC|$HTML_META_EN|g" *.html
sed -i "s|$HTML_META_SRC|$HTML_META_EN|g" */*.html
# sed -i "s|$HTML_LOGO_LINK_SRC|$HTML_LOGO_LINK_EN|g" *.html
# sed -i "s|$HTML_LOGO_LINK_SRC|$HTML_LOGO_LINK_EN|g" */*.html
sed -i "s|$HTML_LANG_NONE|<$HTML_LANG_EN|g" *.html
sed -i "s|$HTML_LANG_NONE|<$HTML_LANG_EN|g" */*.html
sed -i "s|$HTML_TITLE_BAD_EN|$HTML_TITLE_OK|g" *.html
sed -i "s|$HTML_TITLE_BAD_EN|$HTML_TITLE_OK|g" */*.html

log 'ACTIVATING'
cd "$SRC_DIR"
if [ -d "$DEST_DIR" ]
then
rm -r "$DEST_DIR"
fi
mkdir -p "${DEST_DIR}/"

mv "${TMP_DIR}/"* "${DEST_DIR}/"

touch "${DEST_DIR}/${TS}"

rm -rf "$TMP_DIR"

log 'FINISHED'
27 changes: 27 additions & 0 deletions docs/meta/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
User-agent: anthropic-ai
Disallow: /

User-agent: Claude-Web
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: PerplexityBot
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: GPTBot
Disallow: /

User-agent: ChatGPT-User
Disallow: /

User-agent: *
Disallow:
Sitemap: sitemap.xml
52 changes: 52 additions & 0 deletions docs/meta/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://opnsense.ansibleguy.net/en/latest/</loc></url>

<url><loc>https://opnsense.ansibleguy.net/en/latest/usage/1_install.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/usage/2_basic.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/usage/3_troubleshoot.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/usage/4_develop.html</loc></url>

<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/1_basic.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/2_list.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/2_reload.html</loc></url>

<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/alias.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/alias_multi.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/bind.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/cron.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/dhcp.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/dhcrelay_relay.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/frr_bfd.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/frr_bgp.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/frr_diagnostic.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/frr_general.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/frr_ospf.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/frr_rip.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/ids.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/interface.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/ipsec.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/monit.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/nginx.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/openvpn.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/package.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/route.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/rule.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/rule_interface_group.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/rule_multi.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/savepoint.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/service.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/shaper.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/source_nat.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/syslog.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/system.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/unbound_acl.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/unbound_dnsbl.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/unbound_dot.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/unbound_forwarding.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/unbound_general.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/unbound_host.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/unbound_host_alias.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/webproxy.html</loc></url>
<url><loc>https://opnsense.ansibleguy.net/en/latest/modules/wireguard.html</loc></url>
</urlset>
Binary file added docs/source/_static/img/savepoint_rollback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
exclude_patterns = []
html_theme = 'piccolo_theme'
html_static_path = ['_static']
html_logo = 'https://opnsense.org/wp-content/themes/OPNsense/assets/img/opnsense.png'
html_logo = 'https://files.oxl.at/logos/opnsense.png'
html_favicon = '_static/img/favicon.ico'
html_css_files = ['css/main.css']
html_js_files = ['https://files.oxl.at/js/feedback.js']
html_css_files = ['css/main.css', 'https://files.oxl.at/css/feedback.css']
master_doc = 'index'
display_version = True
sticky_navigation = True
Expand All @@ -22,6 +23,7 @@
}
html_theme_options = {
'banner_text': '<a href="https://github.com/ansibleguy/collection_opnsense">Repository on GitHub</a> | '
'<a href="https://github.com/ansibleguy/collection_opnsense/issues/new/choose">Report errors</a>'
'<a href="https://github.com/ansibleguy/collection_opnsense/issues/new/choose">Report Errors</a> | '
'<a href="https://www.o-x-l.com">Get Support</a>'
}
html_short_title = 'Ansible OPNSense'
2 changes: 1 addition & 1 deletion docs/source/modules/savepoint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. include:: ../_include/head.rst

.. |rollback_process| image:: https://docs.opnsense.org/_images/blockdiag-43422f611798118832d099ed58decb1437fb76a0.png
.. |rollback_process| image:: ../../_static/img/savepoint_rollback.png

==================
Firewall Savepoint
Expand Down
6 changes: 3 additions & 3 deletions docs/source/modules/unbound_dnsbl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

.. include:: ../_include/head.rst

======================
Unbound DNS-Blocklists
======================
==========================
DNS - Unbound - Blocklists
==========================

**STATE**: unstable

Expand Down
12 changes: 12 additions & 0 deletions docs/venv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "$0")"

VENV_PATH='/tmp/.ag-opnsense-venv'

python3 -m virtualenv "$VENV_PATH"
source "${VENV_PATH}/bin/activate"

pip install -r requirements.txt >/dev/null

0 comments on commit 97847fa

Please sign in to comment.