* Change image name

* add fingerprint
This commit is contained in:
Benedikt Brückmann 2021-01-25 11:25:49 +01:00
parent 4d464051ff
commit 8d51566a70
2 changed files with 51 additions and 35 deletions

View file

@ -3769,6 +3769,7 @@ def is_repo_file(filename):
b'index_unsigned.jar', b'index_unsigned.jar',
b'index.xml', b'index.xml',
b'index.html', b'index.html',
b'index.png',
b'index-v1.jar', b'index-v1.jar',
b'index-v1.json', b'index-v1.json',
b'categories.txt', b'categories.txt',

View file

@ -134,48 +134,66 @@ def make(apps, apks, repodir, archive):
def make_website(apps, repodir, repodict): def make_website(apps, repodir, repodict):
_, repo_pubkey_fingerprint = extract_pubkey()
repo_pubkey_fingerprint_stripped = repo_pubkey_fingerprint.replace(" ", "")
link = repodict["address"]
link_fingerprinted = "{link}?fingerprint={fingerprint}".format(link=link, fingerprint=repo_pubkey_fingerprint_stripped)
if not os.path.exists(repodir): if not os.path.exists(repodir):
os.makedirs(repodir) os.makedirs(repodir)
html_name = 'index.html' html_name = 'index.html'
link = repodict["address"]
html_file = os.path.join(repodir, html_name) html_file = os.path.join(repodir, html_name)
with open(html_file, 'w') as f: with open(html_file, 'w') as f:
name = repodict["name"] name = repodict["name"]
description = repodict["description"] description = repodict["description"]
f.write("""<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> f.write("""<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<HTML><HEAD> <HTML>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'/> <HEAD>
<META NAME="viewport" CONTENT="width=device-width; initial-scale=1.0; minimum-scale=0.5; maximum-scale=2.0; user-scalable=1;" /> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'/>
<TITLE>{name}</TITLE> <META NAME="viewport" CONTENT="width=device-width; initial-scale=1.0; minimum-scale=0.5; maximum-scale=2.0; user-scalable=1;" />
<BASE HREF='index.html'/> <TITLE>{name}</TITLE>
<LINK REL='stylesheet' TYPE='text/css' HREF='index.css' /> <BASE HREF='index.html'/>
<LINK REL='icon' HREF='icons/fdroid-icon.png' TYPE='image/png' /> <LINK REL='stylesheet' TYPE='text/css' HREF='index.css' />
<LINK REL='shortcut icon' HREF='icons/fdroid-icon.png' TYPE='image/png' /> <LINK REL='icon' HREF='icons/fdroid-icon.png' TYPE='image/png' />
<META property="og:site_name" content="{name}" /> <LINK REL='shortcut icon' HREF='icons/fdroid-icon.png' TYPE='image/png' />
<META property="og:title" content="{name}" /> <META property="og:site_name" content="{name}" />
<META property="og:determiner" content="" /> <META property="og:title" content="{name}" />
<META property="og:description" content="{description}" /> <META property="og:determiner" content="" />
<META NAME='robots' CONTENT='index,nofollow'/> <META property="og:description" content="{description}" />
</HEAD><BODY> <META NAME='robots' CONTENT='index,nofollow'/>
<h2>{name}</h2> </HEAD>
<div id='intro'> <BODY>
<p style='margin-bottom:.2em;'><span style='float:right;width:100px;margin-left:.5em;'> <h2>{name}</h2>
<a href='images/fdroid_repo_qr.png' title='QR: {name}'><img src='images/fdroid_repo_qr.png' alt='QR: {name}' width='100'></a> <div id='intro'>
</span> <p style='margin-bottom:.2em;'>
{description}<br/> <span style='float:right;width:100px;margin-left:.5em;'>
{details}</p> <a href='index.png' title='QR: {name}'><img src='index.png' alt='QR: {name}' width='100'></a>
<p class="center" style="margin-top:.5em"> </span>
<a href="{link}"> {description}
<code style="color:#000000;font-weight:bold;">{link}</code> <br/>
</a> <br/>
</p> {details}
</div> </p>
</BODY>""".format(name=name, <p class="center" style="margin-top:.5em">
<a href="{link_fingerprinted}">
<code style="color:#000000;font-weight:bold;">
{link}
</code>
</a>
</p>
<p>If you would like to manually verify the fingerprint (SHA-256) of the repository signing key, here it is:<br/>
<blockcode style="color:#000000;font-weight:bold;">
{fingerprint}
</blockcode>
</p>
</div>
</BODY>""".format(name=name,
description=description, description=description,
details="Currently it serves <kbd>{}</kbd> apps. To add it to your F-Droid client, scan the QR code (click it to enlarge) or use this URL:".format(len(apps)), details="Currently it serves <kbd>{}</kbd> apps. To add it to your F-Droid client, scan the QR code (click it to enlarge) or use this URL:".format(len(apps)),
link=link)) fingerprint=repo_pubkey_fingerprint,
link=link,
link_fingerprinted=link_fingerprinted))
css_file = os.path.join(repodir, "index.css") css_file = os.path.join(repodir, "index.css")
with open(css_file, "w") as f: with open(css_file, "w") as f:
@ -290,10 +308,7 @@ fieldset select, fieldset input, #reposelect select, #reposelect input { font-si
.appdetailcell { display:block; float:left; line-height:1.5em; } .appdetailcell { display:block; float:left; line-height:1.5em; }
}""") }""")
images_dir = os.path.join(repodir, "images") qrcode.make(link_fingerprinted).save(os.path.join(repodir, "index.png"))
if not os.path.exists(images_dir):
os.makedirs(images_dir)
qrcode.make(link).save(os.path.join(images_dir, "fdroid_repo_qr.png"))
def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_fingerprints): def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_fingerprints):