标签: meteor-slingshot

允许GCS存储桶上的公共读取访问权限?

我试图允许匿名(或仅从我的应用程序域)读取我的存储桶中的文件的访问权限.

当我试图读取我得到的文件时

```

<Error>
    <Code>AccessDenied</Code>
    <Message>Access denied.</Message>
    <Details>
        Anonymous users does not have storage.objects.get access to object.
    </Details>
</Error>
Run Code Online (Sandbox Code Playgroud)

```

我还尝试在Google云端控制台中添加具有对象默认权限对话框的域.这给了我错误"您的一个权限无效.请确保您为组和用户以及域的域输入授权ID或电子邮件"

我还研究了为桶做ACL public-read.我唯一的问题是它删除了我对存储桶的所有权.我需要拥有该所有权,因为我希望允许从特定的Google Access ID上传.

google-cloud-storage google-cloud-platform meteor-slingshot

38
推荐指数
4
解决办法
2万
查看次数

使用Meteor的Slingshot软件包与localhost中的Google Cloud时出错

我正在尝试在我的网站上设置一个小的上传部分,供用户上传个人资料图片.我正在使用Slingshot和Google Cloud并从localhost进行测试,但是我收到了以下错误:

OPTIONS https://mybucket.storage.googleapis.com/ net::ERR_INSECURE_RESPONSE
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我认为这个错误是因为我的CORS配置,所以我尝试了各种不同的设置,没有任何作用.

这是我最近的CORS设置:

[
    {
      "origin": ["http://localhost:3000/"],
      "responseHeader": ["Content-Type"],
      "method": ["GET", "HEAD", "DELETE"],
      "maxAgeSeconds": 3600
    }
]
Run Code Online (Sandbox Code Playgroud)

我也尝试过这样:

[
    {
      "origin": ["*"],
      "responseHeader": ["*"],
      "method": ["GET", "HEAD", "DELETE"],
      "maxAgeSeconds": 3600
    }
]
Run Code Online (Sandbox Code Playgroud)

依然没有.和以前一样的错误.

这是Slingshot的服务器代码:

if(Meteor.isServer){

// Initiate file upload restrictions
  Slingshot.fileRestrictions("userLogoUpload", {
  //Only images are allowed
  allowedFileTypes: ["image/png", "image/jpeg", "image/gif"],
  //Maximum file size:
  maxSize: 2 * 1024 * 1024 // 2 MB (null for unlimited)
});

  // Google Cloud Directives
  Slingshot.createDirective("userLogoUpload", Slingshot.GoogleCloud, {
    bucket: Meteor.settings.public.GoogleCloudBucket,
    GoogleAccessId: …
Run Code Online (Sandbox Code Playgroud)

meteor meteor-slingshot

7
推荐指数
1
解决办法
145
查看次数

Meteor autoform,钩前异步回调

我正在使用Autoform和Slingshot进行S3交互.当用户提交表单时,我想拦截进程,通过Slingshot将文件上传到S3,doc使用返回的对象扩展对象,downloadUrl然后返回新的更新文档,并继续自动化过程

我有以下代码:

{{#autoForm collection="Tabs" id="newTabForm" type="method" meteormethod="createTab"}}

   ...
    <div class="modal-body">
      <fieldset>
         {{> afFormGroup name='downloadUrl' type='file' class='file-bag'}}
    ...

AutoForm.hooks({
  newTabForm: {
    before: {
      insert: function(doc, template) {
        console.log(doc);
        var file     = $('.file-bag')[0].files[0];

        var self = this;
        uploader.send(file, function(error, downloadUrl) {
          if (error) { throw new Meteor.Error(error); }

          doc = _.extend(doc, { downloadUrl: downloadUrl });
          self.result(doc);
        });
      }
    },
 ....

Meteor.methods({
createTab: function(doc) {
  check(doc, TabSchema);

  var priceInCents = doc.price * 100;
  var extraTabAttributes = {
    userId: Meteor.userId(), …
Run Code Online (Sandbox Code Playgroud)

meteor meteor-slingshot

6
推荐指数
1
解决办法
1392
查看次数

调整大小并将文件保存到流星中的s3

是否有任何最佳方法来调整大小并将文件保存到流星中的s3。

我虽然打算使用cfs软件包,但是它们给服务器带来了太多的负担。

要将图像直接上传到我正在使用的s3 slingshot,这很好。

但弹弓仅将文件对象作为输入,而无需流来存储文件。

是否有任何选项可以在客户端调整图像大小并将其传递给slingshot程序包

包:https : //github.com/CulturalMe/meteor-slingshot 问题:https : //github.com/CulturalMe/meteor-slingshot/issues/36

amazon-s3 meteor meteor-slingshot

3
推荐指数
1
解决办法
1616
查看次数

Meteor slingshot文件上传到Google Cloud Storage内部服务器错误

我正在尝试使用edgee:slingshot上传文件,但我有几个错误.我已经完成了github页面中描述的所有内容.这是我在服务器上的设置:

Slingshot.GoogleCloud.directiveDefault.GoogleSecretKey = Assets.getText('google-cloud-service-key.pem');

Slingshot.createDirective("myFileUploads", Slingshot.GoogleCloud, {
    bucket: 'dossum-app',
    GoogleAccessId: "GOOGXXXX",
    GoogleSecretKey: "qZEsLZ/NiXXXXXXXXXXXXUW8NVjSvRb8SgdxXXXXX2",
    acl: 'bucket-owner-full-control',
    authorize: function() {
        if (!this.userId) {
            var message = 'Please login before posting file';
            throw new Meteor.Error('Login Required', message);
        }

        return true;
    },
    key: function(file) {
        var user = Meteor.users.findOne(this.userId);
        return user.username + '/' + file.name;
    }
});
Run Code Online (Sandbox Code Playgroud)

这是cors.json:

[{"origin": ["http://localhost:3000", "http://qnekt.zehinz.com"], "responseHeader": ["Origin", "Accept", "X-Requested-With", "Authorization", "Content-Type", "Content-Length", "Accept-Encoding", "X-CSRF-Token"], "method": ["GET", "HEAD", "DELETE", "PUT", "POST", "HEAD"], "maxAgeSeconds": 3600}]
Run Code Online (Sandbox Code Playgroud)

如果我运行上面的配置我得到这个错误没有任何细节:{error: 500, …

google-cloud-storage meteor meteor-slingshot

0
推荐指数
1
解决办法
901
查看次数