Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
cordova-resource-server
Advanced tools
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.
The npm package cordova-resource-server receives a total of 2 weekly downloads. As such, cordova-resource-server popularity was classified as not popular.
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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.