Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import qiniu from 'qiniu.js';
import crypto from 'crypto-browserify';
const qiniuBucketUrl = 'ohjhqmsxe.bkt.clouddn.com';
const filmyBucket = qiniu.bucket('filmy', {
url: (qiniuBucketUrl ? qiniuBucketUrl : `${location.protocol}//${localtion.host}`)
});
console.log(filmyBucket);
function getKeys(password) {
return filmyBucket.getFile(`secret-${password}.json`)
.then(body => JSON.parse(body));
}
filmyBucket.fetchPutToken = function(password, keys = null, returnBody = null) {
return (keys ? Promise.resolve(keys) : getKeys(password))
.then(keys => {
const options = {
scope: 'filmy',
deadline: Math.floor(Date.now() / 1000) + 3600,