目前我能够优化性能,但它仍然有点慢:/
最新编辑:
我目前的解决方案(最快的atm(但仍然很慢)并保持秩序):
服务器
router.post('/images', function(req, res, next) {
var image = bucket.file(req.body.image);
image.download(function(err, contents) {
if (err) {
console.log(err);
} else {
var resultImage = base64_encode(contents);
var index = req.body.index;
var returnObject = {
image: resultImage,
index: index
}
res.send(returnObject);
}
});
});
Run Code Online (Sandbox Code Playgroud)
客户端查询
$scope.getDataset = function() {
fb.orderByChild('id').startAt(_start).limitToFirst(_n).once("value", function(dataSnapshot) {
dataSnapshot.forEach(function(childDataSnapshot) {
_start = childDataSnapshot.child("id").val() + 1;
var post = childDataSnapshot.val();
var image = post.image;
var imageObject = {
image: image,
index: position
};
position++;
$.ajax({
type: "POST", …Run Code Online (Sandbox Code Playgroud) javascript node.js google-cloud-storage firebase google-cloud-platform
我发现的只有这个老答案:
https://groups.google.com/forum/#!topic/firebase-talk/rApG8QQd6t4
SOer的同事是否知道任何信息,或者Firebase工程师能否提供更详细的答案?
我目前正在尝试使用此库对Steam用户进行身份验证:
https://github.com/liamcurry/passport-steam
然后使用Firebase自定义令牌在Firebase身份验证系统中获取用户.
我不知道这是不是正确的方法.无论如何,我被卡住了.
编辑:
这是我目前的代码:
app.js
var passport = require('passport');
var SteamStrategy = require('passport-steam').Strategy;
app.use(passport.initialize());
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(obj, done) {
done(null, obj);
});
passport.use(new SteamStrategy({
returnURL: 'http://localhost:8080/users/steam/return',
realm: 'http://localhost:8080/',
apiKey: steamKey.steam,
stateless:true
},
function(identifier, profile, done) {
profile.identifier = identifier;
return done(null, profile);
}
));
Run Code Online (Sandbox Code Playgroud)
users.js
router.get('/steam', passport.authenticate('steam', { failureRedirect: 'login' }), function(req, res, next) {
});
router.get('/steam/return',
function(req, res, next) {
req.url = req.originalUrl;
next();
},
passport.authenticate('steam', { failureRedirect: 'users/login' }), …Run Code Online (Sandbox Code Playgroud) 题:
在我的本地机器上执行"节点应用程序"时,一切正常.
但是,当我将项目部署到Google App Engine时,实例被终止,我在日志中发现以下错误:
npm ERR! Invalid version: "1"
Run Code Online (Sandbox Code Playgroud)
我在看:
我需要纠正的错误是什么?
部署过程始于 gcloud app deploy --version=deploy
总是以:
ERROR: (gcloud.app.deploy) Error Response: [4] Timed out waiting for the app infrastructure to become healthy.
Run Code Online (Sandbox Code Playgroud)
这是我的package.json
码:
的package.json
{
"name": "Name",
"version": "1.0.0",
"description": "Desc",
"main": "app.js",
"engines": {
"node": "6.9.4",
"npm": "4.2.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js",
"minify": "html-minifier --input-dir ./viewsCopy --output-dir ./views-minified --collapse-whitespace --html5 --minify-js true"
}, …Run Code Online (Sandbox Code Playgroud) 问题:
本质上遇到以下问题(但使用不同的文件):https ://github.com/vercel/next.js/discussions/17977
已经尝试了那里建议的一切。
这是开发模式下页面加载的样子:
有人对如何优化这个有任何建议吗?
代码:
next.config.js:
const withPlugins = require('next-compose-plugins');
const webpack = require("webpack")
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
const withTM = require('next-transpile-modules')(['swr']);
nextConfig = {
images: {
domains: ['storage.googleapis.com'],
},
webpack: config => {
config.resolve.extensions = [ '.mjs', '.js', '.jsx', '.json' ];
config.plugins.push(
new webpack.ProgressPlugin((percentage, message, ...args) => {
// e.g. Output each progress message directly to the console:
console.info(percentage, message, ...args);
})
);
return config
}
}
module.exports = withPlugins([
withBundleAnalyzer, …Run Code Online (Sandbox Code Playgroud) 有没有办法从我的服务器发送电子邮件验证电子邮件?
这是在客户端上完成的方式:
authData.sendEmailVerification().then(function() {
Run Code Online (Sandbox Code Playgroud)
有没有办法在服务器上做到这一点?
SITUATION:
It works fine on Chrome. But there is a small gap every time the "Waterfall 1" sound loops, only on Safari.
Website: http://mymindflow.com
WHAT I TRIED SO FAR:
1) With the HTML 5 audio element:
audio.addEventListener('timeupdate', function(){
var buffer = 0.44;
if(this.currentTime > this.duration - buffer){
this.currentTime = 0
this.play()
}}, false);
Run Code Online (Sandbox Code Playgroud)
2) Gapless.js https://github.com/regosen/Gapless-5
3) Howler.js https://github.com/goldfire/howler.js
4) Web Audio API alone: How to seamlessly loop sound with web audio api
QUESTION:
How can I get rid of …
我遵循了本教程:https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react
从一开始,我的应用程序加载速度非常慢,包括更改选项卡时,包括通过 ngrok 加载并在本地主机上运行或部署在应用程序引擎上时。
可能是什么原因造成的?
PS:我是 React、Next.js 和 Shopify 应用程序开发的新手,所以答案可能非常基本。
PPS:基于红色,构建输出似乎表明“所有人共享的首次加载 JS”太大。我不知道如何调查这个问题并减少所述块的大小,尽管仅仅 214KB 无法解释如此缓慢的加载时间,不是吗?
建造
React 开发工具分析器
@next/bundle-analyzer 输出:
已解析
压缩
包.json
{
"name": "ShopifyApp1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "node server.js NODE_ENV=dev",
"build": "next build",
"deploy": "next build && gcloud app deploy --version=deploy",
"start": "NODE_ENV=production node server.js",
"analyze": "cross-env ANALYZE=true npm run build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@google-cloud/storage": "^5.2.0",
"@next/bundle-analyzer": …Run Code Online (Sandbox Code Playgroud) 文件:
https://material-ui.com/guides/minimizing-bundle-size/#development-environment
“在项目的根目录中创建一个 .babelrc.js 文件:
const plugins = [
[
'babel-plugin-transform-imports',
{
'@material-ui/core': {
// Use "transform: '@material-ui/core/${member}'," if your bundler does not support ES modules
'transform': '@material-ui/core/esm/${member}',
'preventFullImport': true
},
'@material-ui/icons': {
// Use "transform: '@material-ui/icons/${member}'," if your bundler does not support ES modules
'transform': '@material-ui/icons/esm/${member}',
'preventFullImport': true
}
}
]
];
module.exports = {plugins};"
Run Code Online (Sandbox Code Playgroud)
https://nextjs.org/docs/advanced-features/customizing-babel-config
“要添加具有自定义配置的预设/插件,请在 next/babel 预设上执行此操作,如下所示:
{
"presets": [
[
"next/babel",
{
"preset-env": {},
"transform-runtime": {},
"styled-jsx": {},
"class-properties": {}
}
]
],
"plugins": []
}" …Run Code Online (Sandbox Code Playgroud) 我发现的只是这个使用 Rails 的问题:Email Forwarding like Craigslist - Rails
我用 google 搜索了很长时间,但找不到任何使用 Node.js 的东西。
我知道这不是通常接受的问题,但此时我确实没有其他办法。
您能给我指出一个我可以使用的资源或一些教程吗?或者也许您知道自己该怎么做?
编辑:我最终使用了 Sendgrid。
问题:
我有一个模型的镜面/光泽度纹理图像,该图像尚未被 GLTF 模型使用。
如何使用/添加纹理到我的模型中,使其在应有的位置具有反光/光泽?
我不知道要在 .gltf 文件中更改什么才能使用纹理。
编辑:添加了更多 GLTF 行以更好地了解情况。
GLTF JSON:
"images": [
{
"name": "...",
"uri": "..."
},
{
"name": "...",
"uri": "..."
},
{
"name": "...",
"uri": "..."
},
{
"name": "...",
"uri": "..."
},
{
"name": "...",
"uri": "..."
}
],
"samplers": [
{}
],
"textures": [
{
"name": "T_N",
"sampler": 0,
"source": 0
},
{
"name": "Map #9",
"sampler": 0,
"source": 1
},
{
"name": "T_D",
"sampler": 0,
"source": 2
},
{
"name": …Run Code Online (Sandbox Code Playgroud)