File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,11 @@ It is recommended to use [r8-example](https://github.com/mhils/r8-example) as a
107107and place challenges in a new separate repository. See ` r8.builtin_challenges ` and ` r8_example `
108108for challenge examples.
109109
110+ ## Customizing the HTML template
111+
112+ r8 provides some simple means to modify the default HTML template, for example to add a custom logo.
113+ An example can be found in the [ ` misc/custom-template ` ] ( misc/custom-template ) directory.
114+
110115## Architecture
111116
112117r8 consists of the following parts:
Original file line number Diff line number Diff line change 1+ # Customizing the HTML template
2+
3+ This repository shows an example on how the r8 HTML interface can be styled.
4+
5+ In short, r8's website is rendered from [ Jinja2] ( https://jinja.palletsprojects.com/en/3.0.x/templates/ ) templates.
6+ The ` static_dir ` setting governs which template directories are used. It is common to pass two directories: First your
7+ custom template directory and second r8's builtin template directory, from which most functionality is inherited.
8+
9+ ### Usage
10+
11+ New installation:
12+
13+ ``` shell
14+ r8 sql init --static-dir ./misc/custom-template --static-dir ./r8/static
15+ ```
16+
17+ Existing installation:
18+
19+ ``` shell
20+ r8 settings set static_dir /absolute/path/to/r8/misc/custom-template /absolute/path/to/r8/r8/static
21+ ```
Original file line number Diff line number Diff line change 1+ {% extends "_index.html" %}
2+
3+ {% block title %}Mountain CTF{% endblock %}
4+
5+ {% block logo %}
6+ function Logo() {
7+ return < img alt ="logo " src ="logo.svg " width ="32 " height ="32 "/> ;
8+ }
9+ {% endblock %}
10+
11+ {% block footer %}
12+ < footer class ="text-center m-4 ">
13+ Please reach out to foo@bar if you encounter any technical issues!
14+ </ footer >
15+ {% endblock %}
16+
17+ {# Style changes using builtin Bootstrap classes #}
18+ {% block navstyle %}navbar-light bg-light{% endblock %}
19+ {% block submitstyle %}bg-dark{% endblock %}
20+
21+ {% block easteregg %} // here's a free flag __flag__{123456}{% endblock %}
Original file line number Diff line number Diff line change 325325 }
326326
327327 render() {
328- return < section className = "text-center {% block submitstyle %}bg-dark {% endblock %}" >
328+ return < section className = "text-center {% block submitstyle %}bg-info {% endblock %}" >
329329 < form className = "container p-5" onSubmit = { this . onSubmit } >
330330 < div className = "form-group" >
331331 < input name = "flag" type = "text" className = "form-control text-center"
You can’t perform that action at this time.
0 commit comments