From a7a053c4f5d9d316dcf1c5a7b84fcb72b288c012 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 16 Feb 2016 23:36:27 +0100 Subject: [PATCH 1/3] use utf-8 as default encoding for config.py This makes it easy to add all languages to the description. --- examples/config.py | 1 + tests/metadata/info.guardianproject.urzip.txt | 25 +++++++++++++++++++ tests/run-tests | 16 ++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests/metadata/info.guardianproject.urzip.txt diff --git a/examples/config.py b/examples/config.py index 2aaaed10..339e9960 100644 --- a/examples/config.py +++ b/examples/config.py @@ -1,4 +1,5 @@ #!/usr/bin/env python2 +# -*- coding: utf-8 -*- # Copy this file to config.py, then amend the settings below according to # your system configuration. diff --git a/tests/metadata/info.guardianproject.urzip.txt b/tests/metadata/info.guardianproject.urzip.txt new file mode 100644 index 00000000..c7348959 --- /dev/null +++ b/tests/metadata/info.guardianproject.urzip.txt @@ -0,0 +1,25 @@ +Categories:Development,GuardianProject +License:GPLv3 +Web Site:https://dev.guardianproject.info/projects/urzip +Source Code:https://github.com/guardianproject/urzip +Issue Tracker:https://dev.guardianproject.info/projects/urzip/issues +Bitcoin:1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk + +Auto Name:Urzip:本地应用的信息 +Summary:一个实用工具,获取已安装在您的设备上的应用的有关信息 +Description: +It’s Urzip 是一个获得已安装 APK 相关信息的实用工具。它从您的设备上已安装的所有应用开始,一键触摸即可显示 APK 的指纹,并且提供到达 virustotal.com 和 androidobservatory.org 的快捷链接,让您方便地了解特定 APK 的档案。它还可以让您导出签名证书和生成 ApkSignaturePin Pin 文件供 TrustedIntents 库使用。 + +★ Urzip 支持下列语言: Deutsch, English, español, suomi, 日本語, 한국어, Norsk, português (Portugal), Русский, Slovenščina, Türkçe +没看到您的语言?帮忙翻译本应用吧: +https://www.transifex.com/projects/p/urzip + +★ 致用户:我们还缺少你喜欢的功能?发现了一个 bug?请告诉我们!我们乐于听取您的意见。请发送电子邮件至: support@guardianproject.info 或者加入我们的聊天室 https://guardianproject.info/contact +. + +Repo Type:git +Repo:https://github.com/guardianproject/urzip.git + + + +Current Version Code:9999999 diff --git a/tests/run-tests b/tests/run-tests index 243fbf4c..dfdda5ad 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -121,6 +121,22 @@ if [ `uname -s` == "Linux" ]; then fi +#------------------------------------------------------------------------------# +echo_header "test UTF-8 metadata" + +REPOROOT=`create_test_dir` +cd $REPOROOT + +$fdroid init +sed -i.tmp 's,^ *repo_description.*,repo_description = """获取已安装在您的设备上的应用的,' config.py +mkdir metadata +cp $WORKSPACE/tests/urzip.apk repo/ +cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.txt metadata/ + +$fdroid readmeta +$fdroid update + + #------------------------------------------------------------------------------# echo_header "test metadata checks" From 3967a0068be79efa77db90e80224049a4bada712 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 16 Feb 2016 23:43:23 +0100 Subject: [PATCH 2/3] added 'mirrors' option to config for giving official mirror URLs serverwebroot has long supported uploading to multiple servers, this bit of metadata communicates those official mirrors to the client so that it can automatically do something useful with that information. closes #14 https://gitlab.com/fdroid/fdroidserver/issues/14 --- examples/config.py | 12 ++++++++++++ fdroidserver/update.py | 18 +++++++++++++++++- tests/run-tests | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/examples/config.py b/examples/config.py index 339e9960..54c326fe 100644 --- a/examples/config.py +++ b/examples/config.py @@ -149,6 +149,18 @@ The repository of older versions of applications from the main demo repository. # 'bar.info:/var/www/fdroid', # } +# Any mirrors of this repo, for example all of the servers declared in +# serverwebroot, will automatically be used by the client. If one +# mirror is not working, then the client will try another. If the +# client has Tor enabled, then the client will prefer mirrors with +# .onion addresses. This base URL will be used for both the main repo +# and the archive, if it is enabled. So these URLs should end in the +# 'fdroid' base of the F-Droid part of the web server like serverwebroot. +# +# mirrors = { +# 'https://foo.bar/fdroid', +# 'http://foobarfoobarfoobar.onion/fdroid', +# } # optionally specific which identity file to use when using rsync over SSH # diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 6bbf0fae..bf264121 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -27,6 +27,7 @@ import socket import zipfile import hashlib import pickle +import urlparse from datetime import datetime, timedelta from xml.dom.minidom import Document from argparse import ArgumentParser @@ -760,6 +761,15 @@ def make_index(apps, sortedids, apks, repodir, archive, categories): repoel = doc.createElement("repo") + mirrorcheckfailed = False + for mirror in config.get('mirrors', []): + base = os.path.basename(urlparse.urlparse(mirror).path.rstrip('/')) + if config.get('nonstandardwebroot') is not True and base != 'fdroid': + logging.error("mirror '" + mirror + "' does not end with 'fdroid'!") + mirrorcheckfailed = True + if mirrorcheckfailed: + sys.exit(1) + if archive: repoel.setAttribute("name", config['archive_name']) if config['repo_maxage'] != 0: @@ -767,6 +777,9 @@ def make_index(apps, sortedids, apks, repodir, archive, categories): repoel.setAttribute("icon", os.path.basename(config['archive_icon'])) repoel.setAttribute("url", config['archive_url']) addElement('description', config['archive_description'], doc, repoel) + urlbasepath = os.path.basename(urlparse.urlparse(config['archive_url']).path) + for mirror in config.get('mirrors', []): + addElement('mirror', urlparse.urljoin(mirror, urlbasepath), doc, repoel) else: repoel.setAttribute("name", config['repo_name']) @@ -775,8 +788,11 @@ def make_index(apps, sortedids, apks, repodir, archive, categories): repoel.setAttribute("icon", os.path.basename(config['repo_icon'])) repoel.setAttribute("url", config['repo_url']) addElement('description', config['repo_description'], doc, repoel) + urlbasepath = os.path.basename(urlparse.urlparse(config['repo_url']).path) + for mirror in config.get('mirrors', []): + addElement('mirror', urlparse.urljoin(mirror, urlbasepath), doc, repoel) - repoel.setAttribute("version", "14") + repoel.setAttribute("version", "15") repoel.setAttribute("timestamp", str(int(time.time()))) nosigningkey = False diff --git a/tests/run-tests b/tests/run-tests index dfdda5ad..de9c9a15 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -129,6 +129,7 @@ cd $REPOROOT $fdroid init sed -i.tmp 's,^ *repo_description.*,repo_description = """获取已安装在您的设备上的应用的,' config.py +echo "mirrors = {'https://foo.bar/fdroid', 'http://secret.onion/fdroid'}" >> config.py mkdir metadata cp $WORKSPACE/tests/urzip.apk repo/ cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.txt metadata/ From e0312897c7fd3af1d8d0989fc426cceddbe4419e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 17 Feb 2016 00:11:22 +0100 Subject: [PATCH 3/3] make "Current Version Code" default to most recent APK closes #36 https://gitlab.com/fdroid/fdroidserver/issues/36 --- fdroidserver/metadata.py | 2 +- fdroidserver/update.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index dc0055f2..bc8708df 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -132,7 +132,7 @@ class App(): self.UpdateCheckName = None self.UpdateCheckData = None self.CurrentVersion = '' - self.CurrentVersionCode = '0' + self.CurrentVersionCode = None self.NoSourceSince = '' self.id = None diff --git a/fdroidserver/update.py b/fdroidserver/update.py index bf264121..7c5f8e28 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -1284,6 +1284,8 @@ def main(): if app.Name is None: app.Name = bestapk['name'] app.icon = bestapk['icon'] if 'icon' in bestapk else None + if app.CurrentVersionCode is None: + app.CurrentVersionCode = str(bestver) # Sort the app list by name, then the web site doesn't have to by default. # (we had to wait until we'd scanned the apks to do this, because mostly the