add Liberapay: field with username as data

Liberapay was originally included using a numeric ID, since they had
not yet finalized the public URLs.  Now it is a username.  So this
logic prefers the username in Liberapay: field, and keeps the old
LiberapayID: to ease migration.  LiberapayID: will not override
Liberapay:.  Clients are expected to prefer Liberapay: over LiberapayID:
This commit is contained in:
Hans-Christoph Steiner 2020-06-16 14:39:46 +02:00
parent 0183592526
commit 62c8fd5999
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA
13 changed files with 28 additions and 4 deletions

View File

@ -36,7 +36,7 @@ metadata_v0:
- cd fdroiddata - cd fdroiddata
- ../tests/dump_internal_metadata_format.py - ../tests/dump_internal_metadata_format.py
- sed -i - sed -i
-e '/kivy:\sfalse/d' -e '/Liberapay:/d'
-e '/OpenCollective/d' -e '/OpenCollective/d'
metadata/dump_*/*.yaml metadata/dump_*/*.yaml
- diff -uw metadata/dump_* - diff -uw metadata/dump_*

View File

@ -141,9 +141,11 @@ regex_checks = {
], ],
'Donate': http_checks + [ 'Donate': http_checks + [
(re.compile(r'.*flattr\.com'), (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'), (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, 'Changelog': http_checks,
'Author Name': [ 'Author Name': [

View File

@ -77,6 +77,7 @@ app_fields = set([
'Changelog', 'Changelog',
'Donate', 'Donate',
'FlattrID', 'FlattrID',
'Liberapay',
'LiberapayID', 'LiberapayID',
'OpenCollective', 'OpenCollective',
'Bitcoin', 'Bitcoin',
@ -121,6 +122,7 @@ yaml_app_field_order = [
'Changelog', 'Changelog',
'Donate', 'Donate',
'FlattrID', 'FlattrID',
'Liberapay',
'LiberapayID', 'LiberapayID',
'OpenCollective', 'OpenCollective',
'Bitcoin', 'Bitcoin',
@ -181,6 +183,7 @@ class App(dict):
self.Changelog = '' self.Changelog = ''
self.Donate = None self.Donate = None
self.FlattrID = None self.FlattrID = None
self.Liberapay = None
self.LiberapayID = None self.LiberapayID = None
self.OpenCollective = None self.OpenCollective = None
self.Bitcoin = None self.Bitcoin = None
@ -454,6 +457,10 @@ valuetypes = {
r'^[0-9a-z]+$', r'^[0-9a-z]+$',
['FlattrID']), ['FlattrID']),
FieldValidator("Liberapay",
VALID_USERNAME_REGEX,
['Liberapay']),
FieldValidator("Liberapay ID", FieldValidator("Liberapay ID",
r'^[0-9]+$', r'^[0-9]+$',
['LiberapayID']), ['LiberapayID']),

View File

@ -927,6 +927,10 @@ def insert_funding_yml_donation_links(apps):
logging.error(e) logging.error(e)
if not data or type(data) != dict: if not data or type(data) != dict:
continue 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: if not app.get('OpenCollective') and 'open_collective' in data:
s = sanitize_funding_yml_name(data['open_collective']) s = sanitize_funding_yml_name(data['open_collective'])
if s: if s:

View File

@ -17,6 +17,7 @@ Disabled: null
Donate: null Donate: null
FlattrID: null FlattrID: null
IssueTracker: https://github.com/miguelvps/PoliteDroid/issues IssueTracker: https://github.com/miguelvps/PoliteDroid/issues
Liberapay: null
LiberapayID: null LiberapayID: null
License: GPL-3.0-only License: GPL-3.0-only
Litecoin: null Litecoin: null

View File

@ -40,7 +40,8 @@ Disabled: null
Donate: http://sufficientlysecure.org/index.php/adaway Donate: http://sufficientlysecure.org/index.php/adaway
FlattrID: '369138' FlattrID: '369138'
IssueTracker: https://github.com/dschuermann/ad-away/issues IssueTracker: https://github.com/dschuermann/ad-away/issues
LiberapayID: null Liberapay: null
LiberapayID: '1234567890'
License: GPL-3.0-only License: GPL-3.0-only
Litecoin: null Litecoin: null
MaintainerNotes: '' MaintainerNotes: ''

View File

@ -37,6 +37,7 @@ Disabled: null
Donate: null Donate: null
FlattrID: null FlattrID: null
IssueTracker: https://github.com/SMSSecure/SMSSecure/issues IssueTracker: https://github.com/SMSSecure/SMSSecure/issues
Liberapay: null
LiberapayID: null LiberapayID: null
License: GPL-3.0-only License: GPL-3.0-only
Litecoin: null Litecoin: null

View File

@ -24,6 +24,7 @@ Disabled: null
Donate: http://www.videolan.org/contribute.html#money Donate: http://www.videolan.org/contribute.html#money
FlattrID: null FlattrID: null
IssueTracker: http://www.videolan.org/support/index.html#bugs IssueTracker: http://www.videolan.org/support/index.html#bugs
Liberapay: null
LiberapayID: null LiberapayID: null
License: GPL-3.0-only License: GPL-3.0-only
Litecoin: null Litecoin: null

View File

@ -7,6 +7,7 @@ SourceCode: https://github.com/guardianproject/checkey
IssueTracker: https://dev.guardianproject.info/projects/checkey/issues IssueTracker: https://dev.guardianproject.info/projects/checkey/issues
Translation: https://www.transifex.com/otf/checkey Translation: https://www.transifex.com/otf/checkey
Bitcoin: 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk Bitcoin: 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk
Liberapay: GuardianProject
AutoName: Checkey AutoName: Checkey

View File

@ -3,6 +3,7 @@ Categories:
License: GPL-3.0-only License: GPL-3.0-only
SourceCode: https://github.com/eighthave/urzip SourceCode: https://github.com/eighthave/urzip
Bitcoin: 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk Bitcoin: 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk
Liberapay: 12334
AutoName: OBB Main Old Version AutoName: OBB Main Old Version

View File

@ -8,6 +8,7 @@ IssueTracker: https://github.com/dschuermann/ad-away/issues
Translation: https://www.transifex.com/dominikschuermann/adaway Translation: https://www.transifex.com/dominikschuermann/adaway
Donate: http://sufficientlysecure.org/index.php/adaway Donate: http://sufficientlysecure.org/index.php/adaway
FlattrID: '369138' FlattrID: '369138'
LiberapayID: '1234567890'
AutoName: AdAway AutoName: AdAway
Summary: Block advertisements Summary: Block advertisements

View File

@ -104,6 +104,7 @@
"Development" "Development"
], ],
"suggestedVersionCode": "99999999", "suggestedVersionCode": "99999999",
"liberapay": "12334",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"name": "OBB Main Old Version", "name": "OBB Main Old Version",
"sourceCode": "https://github.com/eighthave/urzip", "sourceCode": "https://github.com/eighthave/urzip",

View File

@ -36,6 +36,7 @@ from fdroidserver.common import FDroidPopen
DONATION_FIELDS = ( DONATION_FIELDS = (
'Donate', 'Donate',
'Liberapay',
'OpenCollective', 'OpenCollective',
) )
@ -1008,9 +1009,11 @@ class UpdateTest(unittest.TestCase):
for field in DONATION_FIELDS: for field in DONATION_FIELDS:
self.assertIsNotNone(app.get(field), field) self.assertIsNotNone(app.get(field), field)
self.assertEqual('LINK1', app.get('Donate')) self.assertEqual('LINK1', app.get('Donate'))
self.assertEqual('USERNAME', app.get('Liberapay'))
self.assertEqual('USERNAME', app.get('OpenCollective')) self.assertEqual('USERNAME', app.get('OpenCollective'))
app['Donate'] = 'keepme' app['Donate'] = 'keepme'
app['Liberapay'] = 'keepme'
app['OpenCollective'] = 'keepme' app['OpenCollective'] = 'keepme'
fdroidserver.update.insert_funding_yml_donation_links(apps) fdroidserver.update.insert_funding_yml_donation_links(apps)
for field in DONATION_FIELDS: for field in DONATION_FIELDS: