diff --git a/fdroidserver/index.py b/fdroidserver/index.py index c2d287db..52dee442 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -129,7 +129,47 @@ def make(apps, apks, repodir, archive): fdroid_signing_key_fingerprints) make_v1(sortedapps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fingerprints) + make_website(sortedapps, repodir, repodict) +def make_website(apps, repodir, repodict): + website_dir = os.path.join(repodir, "www") + if not os.path.exists(website_dir): + os.makedirs(website_dir) + html_name = 'index.html' + + html_file = os.path.join(website_dir, html_name) + with open(html_file, 'w') as f: + name = repodict["name"] + description = repodict["description"] + f.write(""" + + + + {name} + + + + + + + + + + +

{name}

+
+

+QR: {name} + +{description}
+{details}

+{link} +
+""".format(name=name, +description=description, +details="Currently it serves {} 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=repodict["address"] +)) def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_fingerprints): @@ -230,41 +270,6 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ else: json.dump(output, fp, default=_index_encoder_default) - html_name = 'index.html' - html_file = os.path.join(repodir, html_name) - with open(html_file, 'w') as f: - name = repodict["name"] - description = repodict["description"] - f.write(""" - - - - {name} - - - - - - - - - - -

{name}

-
-

-QR: {name} - -{description}
-{details}

-{link} -
-""".format(name=name, -description=description, -details="Currently it serves {} apps. To add it to your F-Droid client, scan the QR code (click it to enlarge) or use this URL:".format(len(output['apps'])), -link=repodict["address"] -)) - if common.options.nosign: logging.debug(_('index-v1 must have a signature, use `fdroid signindex` to create it!')) else: