Skip to content

Commit

Permalink
Publish a .well-known/assetlinks.json
Browse files Browse the repository at this point in the history
This is required (in some cases? Because many seem to work) to publish
deep links on modern android versions. Basically we tie in the
publishing certificate we use in the play store to our domain, thereby
allowing it to "capture" those links directly.

Per complaints from the play console, and their suggested fix.
  • Loading branch information
mhagander committed Nov 27, 2023
1 parent fbf46e6 commit 2fdbfb3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions postgresqleu/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@
# Monitoring endpoints
url(r'^monitor/git/$', postgresqleu.util.monitor.gitinfo),
url(r'^monitor/nagios/$', postgresqleu.util.monitor.nagios),

# Digital assets needed to do deep-linking in the android app.
url(r'^.well-known/assetlinks.json$', postgresqleu.util.views.assetlinks),
])

if settings.ENABLE_NEWS:
Expand Down
22 changes: 22 additions & 0 deletions postgresqleu/util/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from postgresqleu.util.messaging.twitter import process_twitter_webhook
from postgresqleu.util.markup import pgmarkdown

import json


# Anybody logged in can do a markdown preview, since it's a safe operation
# and this way we don't need any db access.
Expand All @@ -34,3 +36,23 @@ def messaging_webhook(request, providerid, token):
@csrf_exempt
def twitter_webhook(request):
return process_twitter_webhook(request)


# Assetlinks to confirm to Google Play that we are the authors of our Android app
# (contents of file are suggestions from google play console)
def assetlinks(request):
return HttpResponse(
json.dumps([
{
"relation": [
"delegate_permission/common.handle_all_urls"
],
"target": {
"namespace": "android_app",
"package_name": "eu.postgresql.android.conferencescanner",
"sha256_cert_fingerprints": [
"F3:F7:29:8B:4D:B4:2E:9E:B8:3B:C6:E3:8B:C0:69:FE:19:9E:2C:24:D4:6B:AE:C7:1E:83:D7:07:47:7E:CA:EB"
]
}
}
]), content_type='application/json')

0 comments on commit 2fdbfb3

Please sign in to comment.