Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #15 from manifoldjs/v0.1.0
Browse files Browse the repository at this point in the history
v0.1.0
  • Loading branch information
msrodri committed Jun 3, 2015
2 parents 61e485e + 9279105 commit dbc6d78
Show file tree
Hide file tree
Showing 31 changed files with 434 additions and 370 deletions.
26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
{
"name": "ManifoldCordova",
"version": "0.0.5",
"description": "This package is to be used as a workaround to be consumed fromt he ManifestJS tool. Its a Cordova plugin.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"name": "cordova-plugin-hostedwebapp",
"version": "0.1.0",
"description": "Hosted Web App Plugin",
"cordova": {
"id": "cordova-plugin-hostedwebapp",
"platforms": [
"android",
"windows",
"ios"
]
},
"repository": {
"type": "git",
"url": "https://github.com/manifoldjs/ManifoldCordova.git"
},
"keywords": [
"Cordova",
"plugin",
"cordova",
"manifest",
"hosted",
"web",
"manifest"
"ecosystem:cordova",
"cordova-android",
"cordova-windows",
"cordova-ios"
],
"author": "",
"license": "ISC",
"license": "MIT",
"bugs": {
"url": "https://github.com/manifoldjs/ManifoldCordova/issues"
},
Expand Down
9 changes: 5 additions & 4 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="com.manifoldjs.hostedwebapp"
version="0.0.6">
id="cordova-plugin-hostedwebapp"
version="0.1.0">
<name>HostedWebApp</name>
<description>Hosted Web App Plugin</description>
<license>MIT License</license>
<keywords>cordova,manifest,hosted,web,manifoldjs</keywords>
<repo>https://github.com/manifoldjs/ManifoldCordova.git</repo>
<issue>https://github.com/manifoldjs/ManifoldCordova/issues</issue>

<dependency id="org.apache.cordova.network-information" version=">=0.2.15" />

<dependency id="cordova-plugin-whitelist" version=">=1.0.1" />
<dependency id="cordova-plugin-network-information" version=">=1.0.0" />

<hook type="before_prepare" src="scripts/updateConfiguration.js" />
<hook type="after_prepare" src="scripts/updateConfigurationAfterPrepare.js" />
<hook type="after_build" src="scripts/updateConfigurationAfterBuild.js" />
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ When the application is launched, the plugin automatically handles navigation to
Lastly, since network connectivity is essential to the operation of a hosted web application, the plugin implements a basic offline feature that will show an offline page whenever connectivity is lost and will prevent users from interacting with the application until the connection is restored.

## Installation
`cordova plugin add com.manifoldjs.hostedwebapp`
`cordova plugin add cordova-plugin-hostedwebapp`

> **IMPORTANT:** Before using the plugin, make sure to copy the W3C manifest file to the **root** folder of the Cordova application, alongside **config.xml**, and name it **manifest.json**.
Expand Down Expand Up @@ -68,7 +68,7 @@ The plugin enables using content hosted in a web site inside a Cordova applicati
> **Note:** You can find a sample manifest file at the start of this document.

1. Add the **Hosted Web Application** plugin to the project.
`cordova plugin add com.manifoldjs.hostedwebapp`
`cordova plugin add cordova-plugin-hostedwebapp`

1. Add one or more platforms, for example, to support Android.
`cordova platform add android`
Expand Down Expand Up @@ -131,7 +131,7 @@ For example, the following manifest references icons from the _/resources_ path
</pre>

### URL Access Rules
For a hosted web application, the W3C manifest defines a scope that restricts the URLs to which the application can navigate. Additionally, the manifest can include a proprietary setting named **mjs_urlAccess** that defines an array of access rules each one consisting of a _url_ attribute that identifies the target of the rule and indicates whether URLs matching the rule should be navigated to by the application. Non-matching URLs will be launched externally.
For a hosted web application, the W3C manifest defines a scope that restricts the URLs to which the application can navigate. Additionally, the manifest can include a proprietary setting named **mjs_access_whitelist** that defines an array of access rules each one consisting of a _url_ attribute that identifies the target of the rule and indicates whether URLs matching the rule should be navigated to by the application. Non-matching URLs will be launched externally.

Typically, Cordova applications define access rules to implement a security policy that controls access to external domains. The access rules must not only allow access to the scope defined by the W3C manifest but also to external content used within the site, for example, to reference script files hosted by a CDN origin.

Expand All @@ -140,9 +140,9 @@ To configure the security policy, the plugin hook maps the scope and URL access
**Manifest.json**
<pre>
...
"start_url": "http://www.xyz.com/"
"start_url": "http://www.xyz.com/",
"scope": "/",
"mjs_urlAccess": [
"mjs_access_whitelist": [
{ "url": "http//googleapis.com/*" },
{ "url": "http//login.anotherdomain.com/" }
]
Expand Down
2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"builder": "node ./node_modules/mocha/bin/mocha --reporter mocha-teamcity-reporter"
},
"devDependencies": {
"cordova-lib": "^4.3.0",
"cordova-lib": "^5.0.0",
"mocha": "^2.2.1",
"mocha-teamcity-reporter": "0.0.4",
"q": "^1.2.0"
Expand Down
22 changes: 22 additions & 0 deletions scripts/test/assets/fullAccessRules/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget id="com.example.hello" version="0.0.1">
<name>HelloWorld</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<preference name="Orientation" value="default" />
<preference name="Fullscreen" value="false" />
<access origin="http://*/*" />
<access origin="https://*/*" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="*" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"orientation": "landscape",
"display": "fullscreen",
"scope": "http://wat-docs.azurewebsites.net/*",
"mjs_urlAccess": [
{ "url": "http://ajax.googleapis.com/*" },
"mjs_access_whitelist": [
{ "url": "http://wat.codeplex.com", "external": true }
]
}
1 change: 1 addition & 0 deletions scripts/test/assets/fullAccessRules/www/empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty folder
9 changes: 8 additions & 1 deletion scripts/test/assets/jsonEmpty/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="http://com.example.hello/home" />

<allow-navigation href="general-navigation-rule" />
<allow-intent href="general-intent-rule" />

<platform name="ios">
<access origin="ios-access-rule" />
</platform>

<preference name="Orientation" value="default" />
<preference name="Fullscreen" value="true" />
</widget>
1 change: 1 addition & 0 deletions scripts/test/assets/jsonEmpty/www/empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty folder
12 changes: 0 additions & 12 deletions scripts/test/assets/noExternalRulesNorScope/config.xml

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/test/assets/noExternalRulesNorScope/www/manifest.json

This file was deleted.

9 changes: 6 additions & 3 deletions scripts/test/assets/normalFlow/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
<widget id="com.example.hello" version="0.0.1">
<name>HelloWorld</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
Apache Cordova Team
</author>
<content src="index.html" />
<preference name="Orientation" value="default" />
<preference name="Fullscreen" value="false" />
<access origin="*" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

</widget>
7 changes: 7 additions & 0 deletions scripts/test/assets/normalFlow/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"start_url": "http://wat-docs.azurewebsites.net/",
"short_name": "WAT Docs",
"name": "WAT Documentation",
"orientation": "landscape",
"display": "fullscreen"
}
1 change: 1 addition & 0 deletions scripts/test/assets/normalFlow/www/empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty folder
17 changes: 17 additions & 0 deletions scripts/test/assets/shortNameMissing/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget id="com.example.hello" version="0.0.1">
<name>HelloWorld</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<preference name="Orientation" value="default" />
<preference name="Fullscreen" value="false" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

</widget>
6 changes: 6 additions & 0 deletions scripts/test/assets/shortNameMissing/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"start_url": "http://wat-docs.azurewebsites.net/",
"name": "WAT Documentation",
"orientation": "landscape",
"display": "fullscreen"
}
1 change: 1 addition & 0 deletions scripts/test/assets/shortNameMissing/www/empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty folder
17 changes: 17 additions & 0 deletions scripts/test/assets/shortNameWithSlashes/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget id="com.example.hello" version="0.0.1">
<name>HelloWorld</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<preference name="Orientation" value="default" />
<preference name="Fullscreen" value="false" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

</widget>
7 changes: 7 additions & 0 deletions scripts/test/assets/shortNameWithSlashes/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"start_url": "http://wat-docs.azurewebsites.net/",
"short_name": "WAT /Docs/",
"name": "WAT Documentation",
"orientation": "landscape",
"display": "fullscreen"
}
1 change: 1 addition & 0 deletions scripts/test/assets/shortNameWithSlashes/www/empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty folder
16 changes: 0 additions & 16 deletions scripts/test/assets/updateAccessRules/config.xml

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/test/assets/updateAccessRules/www/manifest.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"name": "WAT Documentation",
"orientation": "landscape",
"display": "fullscreen",
"scope": "http://wat-docs.azurewebsites.net/*",
"mjs_urlAccess": [
{ "url": "http://ajax.googleapis.com/*" }
"scope": "/scope-path/",
"mjs_access_whitelist": [
{ "url": "whitelist-rule-1" },
{ "url": "whitelist-rule-2" }
]
}
1 change: 1 addition & 0 deletions scripts/test/assets/xmlEmptyWidget/www/empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty folder
Loading

0 comments on commit dbc6d78

Please sign in to comment.