流星浏览器策略本地摄像机不允许 [英] Meteor browser-policy local camera not allowed

查看:110
本文介绍了流星浏览器策略本地摄像机不允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Uploadcare在应用程序中上传图像和文件,并且还在使用浏览器策略软件包来确保内容安全。我最近注意到相机上传功能无法正常工作,无法弄清楚如何允许它。

I'm using Uploadcare to upload images and files in my application and am also using the browser-policy package for content security. I noticed recently that the camera upload feature was not working and couldn't figure out how to allow it.


拒绝从 blob:http%3A /// localhost%3A3000 / e44633a7-227f-40e2-a3bd-9efd211f677d',因为它违反了以下内容安全策略指令: default-src'self'(我的允许来源...)。请注意,未明确设置 media-src,因此将 default-src用作备用。

Refused to load media from 'blob:http%3A//localhost%3A3000/e44633a7-227f-40e2-a3bd-9efd211f677d' because it violates the following Content Security Policy directive: "default-src 'self' (My Allowed Origins ...) ". Note that 'media-src' was not explicitly set, so 'default-src' is used as a fallback.

我能够使它起作用的唯一方法是使用:
BrowserPolicy.content.allowOriginForAll('blob:');

It seems the only way I've been able to get this to work is by using: BrowserPolicy.content.allowOriginForAll('blob:');

有更好的方法吗?使用当前方法,我似乎收到了不安全评估 blob:警告。我已经尝试过的事情:

BrowserPolicy.content.allowDataUrlForAll();
BrowserPolicy.content.allowBlobDataUrl (); 无效
BrowserPolicy.content.allowOriginForAll('blob:http:// localhost3000 *');
BrowserPolicy.content.allowOriginForAll('http:// localhost3000 *');

Is there a better way? It looks like I'm getting an 'unsafe-eval' blob: warning using the current method. Things I've tried already:
BrowserPolicy.content.allowDataUrlForAll(); BrowserPolicy.content.allowBlobDataUrl(); Not valid BrowserPolicy.content.allowOriginForAll('blob:http://localhost3000*'); BrowserPolicy.content.allowOriginForAll('http://localhost3000*');

推荐答案

我们在程序包中使用以下策略:

We use this policy in our package:

BrowserPolicy.content.allowImageOrigin( blob:);
var ConstructedCsp = BrowserPolicy.content._constructCsp();
BrowserPolicy.content.setPolicy(constructedCsp + media-src blob :;);

如果您只是想即插即用,请访问: https://github.com/smalljoys/meteor-uploadcare

If you just want to plug and play it's here: https://github.com/smalljoys/meteor-uploadcare

这篇关于流星浏览器策略本地摄像机不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆