![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
cordova-resource-server
Advanced tools
Readme
Cordova Plugin to automatically update and off-line running.
cordova plugin add /path/libs/cordova-plugin-zip
cordova build ios
cordova build android
document.addEventListener('deviceready', function() {
resolveLocalFileSystemURL(
cordova.file.dataDirectory,
function (dataDirectoryEntity) {
// resouce directory
Entity.getDirectory("resources", {create: true, exclusive: false}, success, fail);
// context directory
Entity.getDirectory("web", {create: true, exclusive: false}, success, fail);
}
);
}, false);
document.addEventListener('deviceready', function() {
// create context / resouce directory
// ...
resolveLocalFileSystemURL(
cordova.file.cacheDirectory,
function (cacheDirectoryEntity) {
// download archive
}
);
}, false);
// download archive
// use with "cordova-plugin-file-transfer"
var fileTransfer = new FileTransfer();
fileTransfer.download(
"https://www.domain.com/path/update.zip",
cacheDirectoryEntity.nativeURL + "update.zip",
function (entity) {
// optional, md5 checksum for the file downloaded
// ...
console.log(entity.toURL());
// uncompress the zip file to context directory
var contextDirectory = cordova.file.dataDirectory + "web";
var archiveFilePath = cordova.file.cacheDirectory + "update.zip";
var resourceDirectory = cordova.file.dataDirectory + "resources";
// use with "cordova-plugin-zip"
window.zip.unzip(archiveFilePath, contextDirectory,
function () {
// use with "cordova-resource-server"
// server startup
ResourceServer.start(contextDirectory, 10429, resourceDirectory, 10433,
function () {
var url = "http://localhost:10429");
ResourceServer.redirect(url, function () {});
},
function (err) {}
);
},
function (err) {},
function (progressEvent) {}
);
}
);
web/
├── index.html
└── index.js
resources/
└── images/
└── logo.png
└── audio/
└── music.mp3
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=<device-width>, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<audio src="http://localhost:10433/resource/audio/music.mp3" controls/>
<img src="http://localhost:10433/resource/images/logo.png"/>
</body>
</html>
cordova.js
will automatically inject intoindex.html
- response result :
<html> <body> <script src="other.js"></script> <script src="http://localhost:10433/assets/www/cordova.js"></script> </body> </html>
window.onload = function() {
// check cordova plugin accessibility
console.log(cordova.file.dataDirectory);
}
import axios from "axios";
axios.get("http://localhost:10433/list/images").then((res)=>{
const {children} = res.data.data;
const imagesDir = cordova.file.dataDirectory + "resources/images";
children.forEach((i)=>{
const imageURI = imagesDir + "/" + i.name;
// resize or compress local image
// ...
});
});
Audio, AirPlay and Picture in Picture
FAQs
Cordova Plugin to automatically update and off-line running.
We found that cordova-resource-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.