diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b5d96cd..a6480604 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ metadata_v0: - cd fdroiddata - ../tests/dump_internal_metadata_format.py - sed -i - -e '/kivy:\sfalse/d' + -e '/Liberapay:/d' -e '/OpenCollective/d' metadata/dump_*/*.yaml - diff -uw metadata/dump_* diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 4b7a8507..cf6a1119 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -141,9 +141,11 @@ regex_checks = { ], 'Donate': http_checks + [ (re.compile(r'.*flattr\.com'), - _("Flattr donation methods belong in the FlattrID flag")), + _("Flattr donation methods belong in the FlattrID: field")), (re.compile(r'.*liberapay\.com'), - _("Liberapay donation methods belong in the LiberapayID flag")), + _("Liberapay donation methods belong in the Liberapay: field")), + (re.compile(r'.*opencollective\.com'), + _("OpenCollective donation methods belong in the OpenCollective: field")), ], 'Changelog': http_checks, 'Author Name': [ diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index ac838593..a170699c 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -77,6 +77,7 @@ app_fields = set([ 'Changelog', 'Donate', 'FlattrID', + 'Liberapay', 'LiberapayID', 'OpenCollective', 'Bitcoin', @@ -121,6 +122,7 @@ yaml_app_field_order = [ 'Changelog', 'Donate', 'FlattrID', + 'Liberapay', 'LiberapayID', 'OpenCollective', 'Bitcoin', @@ -181,6 +183,7 @@ class App(dict): self.Changelog = '' self.Donate = None self.FlattrID = None + self.Liberapay = None self.LiberapayID = None self.OpenCollective = None self.Bitcoin = None @@ -454,6 +457,10 @@ valuetypes = { r'^[0-9a-z]+$', ['FlattrID']), + FieldValidator("Liberapay", + VALID_USERNAME_REGEX, + ['Liberapay']), + FieldValidator("Liberapay ID", r'^[0-9]+$', ['LiberapayID']), diff --git a/fdroidserver/update.py b/fdroidserver/update.py index c83e3f21..4c371da9 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -927,6 +927,10 @@ def insert_funding_yml_donation_links(apps): logging.error(e) if not data or type(data) != dict: continue + if not app.get('Liberapay') and 'liberapay' in data: + s = sanitize_funding_yml_name(data['liberapay']) + if s: + app['Liberapay'] = s if not app.get('OpenCollective') and 'open_collective' in data: s = sanitize_funding_yml_name(data['open_collective']) if s: diff --git a/tests/metadata/dump/com.politedroid.yaml b/tests/metadata/dump/com.politedroid.yaml index 48b4ac44..1fe59448 100644 --- a/tests/metadata/dump/com.politedroid.yaml +++ b/tests/metadata/dump/com.politedroid.yaml @@ -17,6 +17,7 @@ Disabled: null Donate: null FlattrID: null IssueTracker: https://github.com/miguelvps/PoliteDroid/issues +Liberapay: null LiberapayID: null License: GPL-3.0-only Litecoin: null diff --git a/tests/metadata/dump/org.adaway.yaml b/tests/metadata/dump/org.adaway.yaml index 00e59bd2..4732ad01 100644 --- a/tests/metadata/dump/org.adaway.yaml +++ b/tests/metadata/dump/org.adaway.yaml @@ -40,7 +40,8 @@ Disabled: null Donate: http://sufficientlysecure.org/index.php/adaway FlattrID: '369138' IssueTracker: https://github.com/dschuermann/ad-away/issues -LiberapayID: null +Liberapay: null +LiberapayID: '1234567890' License: GPL-3.0-only Litecoin: null MaintainerNotes: '' diff --git a/tests/metadata/dump/org.smssecure.smssecure.yaml b/tests/metadata/dump/org.smssecure.smssecure.yaml index 5fc47857..9587ce57 100644 --- a/tests/metadata/dump/org.smssecure.smssecure.yaml +++ b/tests/metadata/dump/org.smssecure.smssecure.yaml @@ -37,6 +37,7 @@ Disabled: null Donate: null FlattrID: null IssueTracker: https://github.com/SMSSecure/SMSSecure/issues +Liberapay: null LiberapayID: null License: GPL-3.0-only Litecoin: null diff --git a/tests/metadata/dump/org.videolan.vlc.yaml b/tests/metadata/dump/org.videolan.vlc.yaml index 5ab8783d..39d628d4 100644 --- a/tests/metadata/dump/org.videolan.vlc.yaml +++ b/tests/metadata/dump/org.videolan.vlc.yaml @@ -24,6 +24,7 @@ Disabled: null Donate: http://www.videolan.org/contribute.html#money FlattrID: null IssueTracker: http://www.videolan.org/support/index.html#bugs +Liberapay: null LiberapayID: null License: GPL-3.0-only Litecoin: null diff --git a/tests/metadata/info.guardianproject.checkey.yml b/tests/metadata/info.guardianproject.checkey.yml index 2a0119c4..78b75320 100644 --- a/tests/metadata/info.guardianproject.checkey.yml +++ b/tests/metadata/info.guardianproject.checkey.yml @@ -7,6 +7,7 @@ SourceCode: https://github.com/guardianproject/checkey IssueTracker: https://dev.guardianproject.info/projects/checkey/issues Translation: https://www.transifex.com/otf/checkey Bitcoin: 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk +Liberapay: GuardianProject AutoName: Checkey diff --git a/tests/metadata/obb.main.oldversion.yml b/tests/metadata/obb.main.oldversion.yml index 1d18e69c..a0792a3c 100644 --- a/tests/metadata/obb.main.oldversion.yml +++ b/tests/metadata/obb.main.oldversion.yml @@ -3,6 +3,7 @@ Categories: License: GPL-3.0-only SourceCode: https://github.com/eighthave/urzip Bitcoin: 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk +Liberapay: 12334 AutoName: OBB Main Old Version diff --git a/tests/metadata/org.adaway.yml b/tests/metadata/org.adaway.yml index 41bdb083..edfb2cd5 100644 --- a/tests/metadata/org.adaway.yml +++ b/tests/metadata/org.adaway.yml @@ -8,6 +8,7 @@ IssueTracker: https://github.com/dschuermann/ad-away/issues Translation: https://www.transifex.com/dominikschuermann/adaway Donate: http://sufficientlysecure.org/index.php/adaway FlattrID: '369138' +LiberapayID: '1234567890' AutoName: AdAway Summary: Block advertisements diff --git a/tests/repo/index-v1.json b/tests/repo/index-v1.json index bf6626d1..eef8b389 100644 --- a/tests/repo/index-v1.json +++ b/tests/repo/index-v1.json @@ -104,6 +104,7 @@ "Development" ], "suggestedVersionCode": "99999999", + "liberapay": "12334", "license": "GPL-3.0-only", "name": "OBB Main Old Version", "sourceCode": "https://github.com/eighthave/urzip", diff --git a/tests/update.TestCase b/tests/update.TestCase index 35932489..de2361f9 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -36,6 +36,7 @@ from fdroidserver.common import FDroidPopen DONATION_FIELDS = ( 'Donate', + 'Liberapay', 'OpenCollective', ) @@ -1008,9 +1009,11 @@ class UpdateTest(unittest.TestCase): for field in DONATION_FIELDS: self.assertIsNotNone(app.get(field), field) self.assertEqual('LINK1', app.get('Donate')) + self.assertEqual('USERNAME', app.get('Liberapay')) self.assertEqual('USERNAME', app.get('OpenCollective')) app['Donate'] = 'keepme' + app['Liberapay'] = 'keepme' app['OpenCollective'] = 'keepme' fdroidserver.update.insert_funding_yml_donation_links(apps) for field in DONATION_FIELDS: