Skip to content

Commit

Permalink
Merge pull request #331 from szepeviktor/byte-level-care
Browse files Browse the repository at this point in the history
Byte level care
  • Loading branch information
mnot authored Oct 25, 2023
2 parents eb48ae6 + 1d8297a commit 95c4629
Show file tree
Hide file tree
Showing 42 changed files with 273 additions and 278 deletions.
10 changes: 5 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ omit = setup.py

[report]
exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if __name__ == .__main__.:
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if __name__ == .__main__.:
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ README.md
Dockerfile
LICENSE

# From .gitingore
# From .gitingore
*.pyc
__pycache__
.DS_Store
Expand Down
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ indent_size = 2

[*.html]
max_line_length = unset

[redbot/assets/**]
max_line_length = unset
insert_final_newline = unset

[src/package-lock.json]
indent_size = 2
1 change: 0 additions & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ env:
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
publish-docker-image:

Expand Down
6 changes: 3 additions & 3 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ include:
Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
professional setting

## Our Responsibilities

Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributing to REDbot

Contributions - in the form of code, bugs, or ideas - are very welcome!
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ homepage = "https://redbot.org/project/"
[project.optional-dependencies]
systemd = ["cysystemd"]
dev = ["mypy", "black", "pylint", "pytest", "pytest-md", "validate-pyproject", "build",
"playwright", "types-Markdown"]

"playwright", "types-Markdown"]

[project.scripts]
redbot = "redbot.cli:main"
Expand Down Expand Up @@ -73,7 +72,6 @@ warn_unreachable = true
strict_optional = false
show_error_codes = true


[tool.pylint.basic]
function-rgx = "[a-z_][a-z0-9_]{1,30}$"
variable-rgx = "[a-z_][a-z0-9_]{1,30}$"
Expand Down
Empty file modified redbot/assets/logo/apple-touch-icon-144x144.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified redbot/assets/logo/apple-touch-icon-152x152.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified redbot/assets/logo/favicon-16x16.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified redbot/assets/logo/favicon-32x32.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified redbot/assets/logo/favicon.ico
100755 → 100644
Empty file.
Empty file modified redbot/assets/logo/mstile-144x144.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified redbot/cache_file.py
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions redbot/formatter/__init__.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ def relative_time(utime: float, now: float = None, show_sign: int = 1) -> str:
"""
Given two times, return a string that explains how far apart they are.
show_sign can be:
0 - don't show
1 - ago / from now [DEFAULT]
2 - early / late
0 - don't show
1 - ago / from now [DEFAULT]
2 - early / late
"""

signs = {
Expand Down
Empty file modified redbot/formatter/har.py
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions redbot/formatter/html.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ def format_header_description(self, header_name: str) -> Markup:
class HeaderPresenter:
"""
Present a HTTP header in the Web UI. By default, it will:
- Escape HTML sequences to avoid XSS attacks
- Wrap long lines
- Escape HTML sequences to avoid XSS attacks
- Wrap long lines
However if a method is present that corresponds to the header's
field-name, that method will be run instead to represent the value.
"""
Expand Down
6 changes: 3 additions & 3 deletions redbot/formatter/html_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ def format_extra(self, etype: str = ".html") -> Markup:
"""
Show extra content from the extra_dir, if any. MUST be UTF-8.
Type controls the extension included; currently supported:
- '.html': shown only on start page, after input block
- '.js': javascript block (with script tag surrounding)
included on every page view.
- '.html': shown only on start page, after input block
- '.js': javascript block (with script tag surrounding)
included on every page view.
"""
out = []
if self.config.get("extra_dir", "") and os.path.isdir(self.config["extra_dir"]):
Expand Down
Empty file modified redbot/formatter/slack.py
100755 → 100644
Empty file.
34 changes: 17 additions & 17 deletions redbot/formatter/templates/footer.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<br/>
<br/>

<div class="footer">
<p class="navigation">
<a href="https://REDbot.org/about/">about</a> |
<script type="text/javascript" nonce="{{ nonce }}">
document.write('<a href="#help" id="help"><strong>help</strong></a> |')
</script>
<span class="help hidden">Drag the bookmarklet to your bookmark bar - it makes checking easy!</span>
<a href="javascript:(function(){window.open('{{ baseuri }}?uri='+encodeURIComponent(location))})();"
title="drag me to your toolbar to use REDbot any time.">REDbot</a> bookmarklet
</p>
<div class="footer">
<p class="navigation">
<a href="https://REDbot.org/about/">about</a> |
<script type="text/javascript" nonce="{{ nonce }}">
document.write('<a href="#help" id="help"><strong>help</strong></a> |')
</script>
<span class="help hidden">Drag the bookmarklet to your bookmark bar - it makes checking easy!</span>
<a href="javascript:(function(){window.open('{{ baseuri }}?uri='+encodeURIComponent(location))})();"
title="drag me to your toolbar to use REDbot any time.">REDbot</a> bookmarklet
</p>

{% if captcha_provider == "hcaptcha" %}
<p class="btw">This site is protected by hCaptcha and its
<a href="https://hcaptcha.com/privacy">Privacy Policy</a> and
<a href="https://hcaptcha.com/terms">Terms of Service</a> apply.</p>
{% endif %}
</div>
{% if captcha_provider == "hcaptcha" %}
<p class="btw">This site is protected by hCaptcha and its
<a href="https://hcaptcha.com/privacy">Privacy Policy</a> and
<a href="https://hcaptcha.com/terms">Terms of Service</a> apply.</p>
{% endif %}
</div>

</body></html>
162 changes: 81 additions & 81 deletions redbot/formatter/templates/response_finish.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,91 +7,91 @@
{%- endmacro %}

<div id="left_column">
{% for nonfinal_response in resource.nonfinal_responses %}
<pre class='nonfinal_response'>{{ format_response(nonfinal_response) }}</pre>
{% endfor %}

<span class="help hidden">
These are the response headers; hover over each one for an explanation of what it does.
</span>

<pre id='response'>{{ format_response(resource.response) }}</pre>

<div class="options">
<span class='help hidden'>
Here, you can see the response body, a HAR document for the request, and when appropriate,
validate the response or check its assets (such as referenced images, stylesheets and scripts).
</span>

<span class='option' title='How large the response headers are, including the status line'>response headers: {{ resource.response_header_length|f_num }} bytes</span>

<span class='option' title='How large the response content is'>content: {{ resource.response.content_length|f_num }} bytes</span>

{% if resource.response.transfer_length - resource.response.content_length > 0 -%}
<span class='option' title='How much using chunked encoding adds to the response size'>transfer overhead: {{ (resource.response.transfer_length - resource.response.content_length)|f_num }} bytes</span>
{%- endif %}

<br/>

<div class='option' title='View this response content (with any gzip compression removed)'>
<script type="text/javascript" nonce="{{ nonce }}">
document.write("<a href='#' id='body_view' accesskey='b'>view content</a>")
</script>
</div>

{% if is_resource %}
<div class='option'>
{{ har_link }}
</div>
{% endif %}

{% if not is_saved %}
{% if allow_save %}
<div class='option' title='Save these results for future reference'>
<a href='#' id='save' accesskey='s'>save</a>
</div>
{% endif %}

{% if validator_link %}
<div class='option' title='Validate the response body with a third party service'>
<a href='{{ validator_link }}' accesskey='v'>validate content</a>
</div>
{% endif %}

{% if is_resource and resource.link_count > 0 %}
<div class='option'>
{{ descend_link }}
</div>
{% endif %}
{% endif %}
</div>
</div>

<div id="right_column">
<div id='details'>
<span class='help right hidden'>These notes explain what REDbot has found about your URL; hover over each one for a detailed explanation.</span>

{% for category in formatter.note_categories %}
{% for note in resource.notes if note.category == category %}
{% if loop.first %}
<h3>{{ category.value }}{{ category|subrequest_messages }}</h3>
<ul>
{% endif %}
<li class='{{ note.level.value }} note' data-subject='{{ note.subject }}'>
<span>{{ note.summary }}<span class='tip'>{{ note.detail }}</span></span>
</li>
{% if loop.last %}
</ul>
{% endif %}
{% endfor %}
{% for nonfinal_response in resource.nonfinal_responses %}
<pre class='nonfinal_response'>{{ format_response(nonfinal_response) }}</pre>
{% endfor %}

<span class="help hidden">
These are the response headers; hover over each one for an explanation of what it does.
</span>

<pre id='response'>{{ format_response(resource.response) }}</pre>

<div class="options">
<span class='help hidden'>
Here, you can see the response body, a HAR document for the request, and when appropriate,
validate the response or check its assets (such as referenced images, stylesheets and scripts).
</span>

<span class='option' title='How large the response headers are, including the status line'>response headers: {{ resource.response_header_length|f_num }} bytes</span>

<span class='option' title='How large the response content is'>content: {{ resource.response.content_length|f_num }} bytes</span>

{% if resource.response.transfer_length - resource.response.content_length > 0 -%}
<span class='option' title='How much using chunked encoding adds to the response size'>transfer overhead: {{ (resource.response.transfer_length - resource.response.content_length)|f_num }} bytes</span>
{%- endif %}

<br/>

<div class='option' title='View this response content (with any gzip compression removed)'>
<script type="text/javascript" nonce="{{ nonce }}">
document.write("<a href='#' id='body_view' accesskey='b'>view content</a>")
</script>
</div>

{% if is_resource %}
<div class='option'>
{{ har_link }}
</div>
{% endif %}

{% if not is_saved %}
{% if allow_save %}
<div class='option' title='Save these results for future reference'>
<a href='#' id='save' accesskey='s'>save</a>
</div>
{% endif %}

{% if validator_link %}
<div class='option' title='Validate the response body with a third party service'>
<a href='{{ validator_link }}' accesskey='v'>validate content</a>
</div>
{% endif %}

{% if is_resource and resource.link_count > 0 %}
<div class='option'>
{{ descend_link }}
</div>
{% endif %}
{% endif %}
</div>
</div>

<span class="help hidden">If something doesn't seem right, feel free to <a href="https://github.com/mnot/redbot/issues/new">file an issue</a>!</span>
</div>
<div id="right_column">
<div id='details'>
<span class='help right hidden'>These notes explain what REDbot has found about your URL; hover over each one for a detailed explanation.</span>

{% for category in formatter.note_categories %}
{% for note in resource.notes if note.category == category %}
{% if loop.first %}
<h3>{{ category.value }}{{ category|subrequest_messages }}</h3>
<ul>
{% endif %}
<li class='{{ note.level.value }} note' data-subject='{{ note.subject }}'>
<span>{{ note.summary }}<span class='tip'>{{ note.detail }}</span></span>
</li>
{% if loop.last %}
</ul>
{% endif %}
{% endfor %}
{% endfor %}
</div>

<span class="help hidden">If something doesn't seem right, feel free to <a href="https://github.com/mnot/redbot/issues/new">file an issue</a>!</span>
</div>

<br />
<br />

<div id='body' class="hidden">{{ body }}</div>
<div id='body' class="hidden">{{ body }}</div>

{% include 'footer.html' %}
Loading

0 comments on commit 95c4629

Please sign in to comment.