mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-03 22:20:28 +03:00 
			
		
		
		
	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:
		
							parent
							
								
									0183592526
								
							
						
					
					
						commit
						62c8fd5999
					
				
					 13 changed files with 28 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -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_*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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': [
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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']),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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: ''
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue