随着Meteor停止免费托管,我正在迁移到Galaxy.我正在关注他们的迁移教程,但却陷入倒数第二步,"将您的应用程序部署到Galaxy".我创建了一个galaxy帐户(假设我的用户名是"appname")并cd到我的meteor app目录,并执行了以下操作:
$ DEPLOY_HOSTNAME=galaxy.meteor.com meteor deploy appname.meteorapp.com --settings ./settings.json
Run Code Online (Sandbox Code Playgroud)
有了这个结果:
Error deploying application: Your account is not authorized to deploy to Galaxy.
Run Code Online (Sandbox Code Playgroud)
具有完整路径或相对路径的命令的变化以及字符串周围的引号没有区别.
我已经在我的网络浏览器和meteor的文档中登录(例如,如何将应用程序部署到Galaxy?)没有提到具体要求.我是否需要以某种方式授权自己进行部署?
在我正在处理的代码库中,我遇到了这样的代码:
try {
price = parseFloat(price);
} catch (err) {
console.log(err);
}
Run Code Online (Sandbox Code Playgroud)
我知道在大多数情况下,price无法将其变成数字,它只会获得相应的价值NaN.我的问题是:是否会出现错误,使try-catch-construction成为必要?
我按照这篇文章(第 6 步的代码)制作了一个录音机,如下所示。制作完成后audioBlob,我调用一个自定义函数来上传 blob。此功能适用于其他文件类型。
我传递{ type: 'audio/wav' }给Blob构造函数。生成的文件确实假装是一个波形文件,可以在浏览器中正常播放,但在 iOS 上则不能。我检查了http://checkfiletype.com/并发现该文件实际上是 WebM:
我如何确保该文件实际上是一个.wav文件?
从那篇文章中编辑的代码:
navigator.mediaDevices.getUserMedia({ audio: true })
.then(stream => {
const mediaRecorder = new MediaRecorder(stream);
mediaRecorder.start();
const audioChunks = [];
mediaRecorder.addEventListener("dataavailable", event => {
audioChunks.push(event.data);
});
mediaRecorder.addEventListener("stop", () => {
const audioBlob = new Blob(audioChunks, { type: 'audio/wav' });
// Custom upload function
uploadFile(audioBlob);
});
setTimeout(() => {
mediaRecorder.stop();
}, 3000);
});
Run Code Online (Sandbox Code Playgroud) 我设置了一个Typeform webhook,它运行良好。
现在我正在尝试保护它,但我被困在Typeform部分的验证有效负载中。
我将概述的步骤和 Ruby 示例(以及Typeform Helpcenter 发送给我的PHP 示例)改编为 Node (Meteor):
const crypto = require('crypto');
function post() {
const payload = this.bodyParams;
const stringifiedPayload = JSON.stringify(payload);
const secret = 'the-random-string';
const receivedSignature = lodash.get(request, 'headers.typeform-signature', '');
const hash = crypto
.createHmac('sha256', secret)
.update(stringifiedPayload, 'binary')
.digest('base64');
const actualSignature = `sha256=${hash}`;
console.log('actualSignature:', actualSignature);
console.log('receivedSignature:', receivedSignature);
if (actualSignature !== receivedSignature) {
return { statusCode: 200 };
}
// .. continue ..
});
Run Code Online (Sandbox Code Playgroud)
但是actualSignature和 …