Skip to content

Commit

Permalink
Add badge with version number to website logo
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1nb0rn committed Nov 9, 2024
1 parent 056a1a1 commit 9a80d4a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 5 deletions.
11 changes: 7 additions & 4 deletions web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
MAX_QUERY_LENGTH = 256
VULN_RESULTS_CACHE, CPE_SUGGESTIONS_CACHE = {}, {}
RECAPTCHA_THRESHOLD = 0.7
with open(os.path.join(PROJECT_DIR, 'version.txt')) as f:
SEARCH_VULNS_VERSION = f.read()


app = Flask(__name__, static_folder=STATIC_FOLDER, template_folder=TEMPLATE_FOLDER)
config = _load_config(CONFIG_FILE)
Expand Down Expand Up @@ -255,7 +258,7 @@ def index():

recaptcha_settings = {'recaptcha_site_key': config['RECAPTCHA_AND_API']['SITE_KEY_V3'],
'show_captcha': show_captcha}
return render_template("index.html", **recaptcha_settings)
return render_template("index.html", sv_version=SEARCH_VULNS_VERSION, **recaptcha_settings)


def style_converted_html(markdown_html, center_captions=False):
Expand Down Expand Up @@ -285,14 +288,14 @@ def about():
markdown_content = f.read()
license_html = style_converted_html(markdown.markdown(markdown_content), True)

return render_template("about.html", about_html=about_html, license_html=license_html)
return render_template("about.html", sv_version=SEARCH_VULNS_VERSION, about_html=about_html, license_html=license_html)


@app.route("/api/setup")
def api_setup():
recaptcha_settings = {'recaptcha_site_key': config['RECAPTCHA_AND_API']['SITE_KEY_V2'],
'show_captcha': config['RECAPTCHA_AND_API']['ENABLED']}
return render_template("api-setup.html", **recaptcha_settings)
return render_template("api-setup.html", sv_version=SEARCH_VULNS_VERSION, **recaptcha_settings)


@app.route("/api/generate-key", methods=['POST'])
Expand Down Expand Up @@ -361,7 +364,7 @@ def news():

changelog_html = style_converted_html(markdown.markdown(markdown_content), False)
changelog_html = changelog_html.replace('<h1 class="', '<h1 class="text-center ')
return render_template("news.html", news_html=changelog_html)
return render_template("news.html", sv_version=SEARCH_VULNS_VERSION, news_html=changelog_html)


def setup_api_db():
Expand Down
51 changes: 51 additions & 0 deletions web_server_files/static/css/daisyui.css
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,20 @@ html {
--alert-bg-mix: var(--fallback-b1,oklch(var(--b1)/1));
}

.badge-primary {
--tw-border-opacity: 1;
border-color: var(--fallback-p,oklch(var(--p)/var(--tw-border-opacity)));
--tw-bg-opacity: 1;
background-color: var(--fallback-p,oklch(var(--p)/var(--tw-bg-opacity)));
--tw-text-opacity: 1;
color: var(--fallback-pc,oklch(var(--pc)/var(--tw-text-opacity)));
}

.badge-outline.badge-primary {
--tw-text-opacity: 1;
color: var(--fallback-p,oklch(var(--p)/var(--tw-text-opacity)));
}

.btm-nav > *:where(.active) {
border-top-width: 2px;
--tw-bg-opacity: 1;
Expand Down Expand Up @@ -2693,10 +2707,19 @@ html {
z-index: 1;
}

.m-0 {
margin: 0px;
}

.m-1 {
margin: 0.25rem;
}

.mx-0 {
margin-left: 0px;
margin-right: 0px;
}

.mx-3 {
margin-left: 0.75rem;
margin-right: 0.75rem;
Expand Down Expand Up @@ -2994,6 +3017,14 @@ html {
border-radius: 0.5rem;
}

.rounded {
border-radius: 0.25rem;
}

.border {
border-width: 1px;
}

.border-none {
border-style: none;
}
Expand Down Expand Up @@ -3052,6 +3083,21 @@ html {
padding-right: 0.75rem;
}

.px-2 {
padding-left: 0.5rem;
padding-right: 0.5rem;
}

.py-1 {
padding-top: 0.25rem;
padding-bottom: 0.25rem;
}

.py-0 {
padding-top: 0px;
padding-bottom: 0px;
}

.pl-6 {
padding-left: 1.5rem;
}
Expand Down Expand Up @@ -3107,6 +3153,11 @@ html {
line-height: 1.75rem;
}

.text-xs {
font-size: 0.75rem;
line-height: 1rem;
}

.font-bold {
font-weight: 700;
}
Expand Down
3 changes: 2 additions & 1 deletion web_server_files/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
</ul>
</div>
<a class="btn btn-ghost text-xl" href="/"><i class="fa-solid fa-bug my-auto"></i>
search_vulns</a>
search_vulns<span class="ml-2 py-0 px-2 my-auto text-smxs rounded border">{{ sv_version }}</span>
</a>
</div>
<div class="navbar-center hidden md:flex">
<ul class="menu menu-horizontal px-1">
Expand Down

0 comments on commit 9a80d4a

Please sign in to comment.