New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unrecognized feature: 'ambient-light-sensor' #298
Comments
It works for me! I just tried with django 4.0.4 and django-permissions-policy 4.10.0, and the below single file app: #!/usr/bin/env python
import html
import os
import sys
from django.conf import settings
from django.core.wsgi import get_wsgi_application
from django.http import HttpResponse
from django.urls import path
settings.configure(
# Dangerous: disable host header validation
ALLOWED_HOSTS=["*"],
# Use DEBUG=1 to enable debug mode
DEBUG=(os.environ.get("DEBUG", "") == "1"),
# Make this module the urlconf
ROOT_URLCONF=__name__,
PERMISSIONS_POLICY={
"accelerometer": [],
"ambient-light-sensor": [],
"autoplay": [],
"camera": [],
"display-capture": [],
"document-domain": [],
"encrypted-media": [],
"fullscreen": [],
"geolocation": [],
"gyroscope": [],
"magnetometer": [],
"microphone": [],
"midi": [],
"payment": [],
"usb": [],
},
MIDDLEWARE=["django_permissions_policy.PermissionsPolicyMiddleware"],
)
def index(request):
name = request.GET.get("name", "World")
return HttpResponse(f"Hello, {html.escape(name)}!")
urlpatterns = [
path("", index),
]
app = get_wsgi_application()
if __name__ == "__main__":
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
I would say this is not about Django or django-permissions-policy and more about Chrome (or other browsers). Just tried again running:
in the Chrome Console (Versión 102.0.5005.61 (Build oficial) (x86_64)) The ambient-light-sensor is not there. After searching for a while, you need to have activated the chrome://flags
After that, the featurePolicy is allowed. So probably doesnt set ambient-light-sensor in the examples is enough, or probably this doesnt need action at all. |
Oh right, I missed that the error was from Chrome, I thought it was the check built in to the package. I update the list of known features every quarter, I will do that now and update the example. |
Huh, with Chrome Dev 104 I don't need to change a flag to see |
It's just a warning in the Console. I'm sure mantaining such a list is not gonna be a easy task, too many versions/variables. |
If it's jsut a warning, it doesn't break anything, and it's kind of inevitable between browser versions. I'm adding a note in the docs about this in #298. |
Python Version
3.8
Django Version
3.2
Package Version
latest
Description
After setting the example:
Chrome shows:
The text was updated successfully, but these errors were encountered: