Browse Source

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:
merge-requests/769/merge
Hans-Christoph Steiner 5 months ago
parent
commit
62c8fd5999
No known key found for this signature in database GPG Key ID: 3E177817BA1B9BFA
13 changed files with 28 additions and 4 deletions
  1. +1
    -1
      .gitlab-ci.yml
  2. +4
    -2
      fdroidserver/lint.py
  3. +7
    -0
      fdroidserver/metadata.py
  4. +4
    -0
      fdroidserver/update.py
  5. +1
    -0
      tests/metadata/dump/com.politedroid.yaml
  6. +2
    -1
      tests/metadata/dump/org.adaway.yaml
  7. +1
    -0
      tests/metadata/dump/org.smssecure.smssecure.yaml
  8. +1
    -0
      tests/metadata/dump/org.videolan.vlc.yaml
  9. +1
    -0
      tests/metadata/info.guardianproject.checkey.yml
  10. +1
    -0
      tests/metadata/obb.main.oldversion.yml
  11. +1
    -0
      tests/metadata/org.adaway.yml
  12. +1
    -0
      tests/repo/index-v1.json
  13. +3
    -0
      tests/update.TestCase

+ 1
- 1
.gitlab-ci.yml View File

@ -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_*

+ 4
- 2
fdroidserver/lint.py View File

@ -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': [

+ 7
- 0
fdroidserver/metadata.py View File

@ -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']),

+ 4
- 0
fdroidserver/update.py View File

@ -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:

+ 1
- 0
tests/metadata/dump/com.politedroid.yaml View File

@ -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

+ 2
- 1
tests/metadata/dump/org.adaway.yaml View File

@ -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: ''

+ 1
- 0
tests/metadata/dump/org.smssecure.smssecure.yaml View File

@ -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

+ 1
- 0
tests/metadata/dump/org.videolan.vlc.yaml View File

@ -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

+ 1
- 0
tests/metadata/info.guardianproject.checkey.yml View File

@ -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

+ 1
- 0
tests/metadata/obb.main.oldversion.yml View File

@ -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

+ 1
- 0
tests/metadata/org.adaway.yml View File

@ -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

+ 1
- 0
tests/repo/index-v1.json View File

@ -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",

+ 3
- 0
tests/update.TestCase View File

@ -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:

Loading…
Cancel
Save