-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de85d50
commit 5debc1e
Showing
4 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
from django.urls import path | ||
|
||
from core.views.app_links import AppLinksView | ||
|
||
urlpatterns = [ | ||
] | ||
path(".well-known/assetlinks.json", AppLinksView.as_view()) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
|
||
from django.conf import settings | ||
from django.http import JsonResponse | ||
from django.views import View | ||
|
||
|
||
class AppLinksView(View): | ||
|
||
def get(self, request, *args, **kwargs): | ||
assetlinks_path = settings.ASSETLINKS_FILE | ||
|
||
if not os.path.exists(assetlinks_path): | ||
return JsonResponse({'error': f"File assetlinks.json is missing. {assetlinks_path}"}, status=404) | ||
|
||
try: | ||
with open(assetlinks_path, 'r') as file: | ||
file_content = file.read() | ||
except Exception as e: | ||
return JsonResponse({'error': f"An error occurred: {e}"}, status=500) | ||
|
||
return JsonResponse({'file_content': file_content}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters