如何使CSP不受限制地允许一切?

时间:2019-05-29 08:06:54

标签: cordova-plugins phonegap-build content-security-policy

我正在使用Adobe Phonegap Build构建一个android应用程序,它会从Discord API中获取数据。但是,问题是我无法获得诸如用户头像之类的图像以及诸如用户名之类的其他信息。

我已将cordova-pluging-whitelistcordova-plugin-csp-override添加到我的config.xml中,我尝试在Chrome浏览器中运行index.html,它运行良好。即使我有元标记

<meta http-equiv="Content-Security-Policy: default-src 'self'; script-src 'unsafe-inline' 'unsafe-eval'">

在我的index.html中,它似乎不适用于Android设备。

这是我的config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.android" version="1.0" 
  xmlns="http://www.w3.org/ns/widgets">
  <name></name>
  <description></description>
  <author email="" href=""></author>
  <preference name="phonegap-version" value="cli-8.1.1" />
  <preference name="permissions" value="none" />
  <preference name="orientation" value="portrait" />
  <preference name="target-device" value="universal" />
  <preference name="fullscreen" value="false" />

  <plugin name="cordova-plugin-device" spec="1.1.2" />
  <plugin name="cordova-plugin-inappbrowser" spec="1.3.0" />
  <plugin name="cordova-plugin-splashscreen" spec="3.2.2" />
  <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
  <plugin name="cordova-plugin-csp-override" spec="1.0.0" />


  <access origin="*"/>
  <allow-intent href="http://*/*" />
  <allow-intent href="https://*/*" />
  <allow-intent href="tel:*" />
  <allow-intent href="sms:*" />
  <allow-intent href="mailto:*" />
  <allow-intent href="geo:*" />

  <icon src="src/assets/appicon.png" />
  <splash src="src/assets/splash.png"/>
</widget>

注意:我猜它不是cordova项目,但Adobe Phonegap Build需要它们。如果我错了请纠正我。

0 个答案:

没有答案