Anahita Project

The #Anahita #project management group. Visit https://github.com/anahitasocial for more information about Anahita code and how to get started.

Stories

Rastin Mehr

Rastin Mehr shared a note

We are now ready to implement the READ views in the Anahita React app. Then we implement the content composers. #Anahita #Hackathon #ReactJS #ReduxJS #MaterialUI
Rastin Mehr

Rastin Mehr published a new Article

What are the changes in Anahita 4.4.1

Anahita 4.4.1 Birth release provides several security fixes and enhancement. For those of you who are developing custom apps for Anahita, you need to be aware of these changes. 

Signup endpoint has...

Read More

Anahita 4.4.1 Birth release provides several security fixes and enhancement. For those of you who are developing custom apps for Anahita, you need to be aware of these changes. 

Signup endpoint has changed

The REST endpoint for signing up a new person is now a POST request to https://www.yourdomain.com/people/signup.json

String attribute validations

We have improved field validation in Anahita entities, and you can enforce minimum, and maximum length constrains to an entity attribute. To follow a convention, we are using the numbers: 3-30, 8-80, 10-100, 1,000, 5,000, and 40,000. Here is an example of how to use limit constrains in the Person entity: 

https://github.com/anahitasocial/anahita/blob/master/src/components/com_people/domains/entities/person.php#L55

Default selected Item in configurations forms

In the component or plugin configuration files, we used to use the term default for the selected item in a list. We are now using the term selected, which is more appropriate for lists. Here is an example:

https://github.com/anahitasocial/anahita/blob/master/src/components/com_people/config.json#L16

#Anahita #BirthRelease

Read Less
Umesh liked this
Rastin Mehr

Rastin Mehr shared a note

I've just tagged the 4.4.1 release and will be writing an announcement this week for those who have custom apps working with Anahita. In the meantime, if you could please test the new release and r... Read More
I've just tagged the 4.4.1 release and will be writing an announcement this week for those who have custom apps working with Anahita. In the meantime, if you could please test the new release and report any issues, I'll really appreciate it. #Anahita #BirthRelease Read Less
Rastin Mehr

Rastin Mehr commented on the topic

Revising Anahita's S3 Storage Plugin

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as...

Read More

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.

Here is an AWS source document I've found describing recent changes:

https://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html

Key points:

Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.

The original s3lib.php file includes a link in the header comments that is no longer functional.  In researching an updated version of the file, I've found two sources on GitHub:

https://github.com/racklin/amazon-s3-php-class

and

https://github.com/tpyo/amazon-s3-php-class

According to an article I found on Medium, the fork maintained by Rack Lin is preferable:

https://medium.com/@martindrapeau/simple-php-code-to-push-files-to-aws-s3-3396f9b3d02a

So I'm using the Rack Lin fork as the starting point for the updates.  Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.

What's new - variables:

  • $region
  • $progressFunction
  • $signVer

What's new - functions:

  • setRegion()
  • getRegion()
  • setSignatureVersion()
  • setProgressFunction()
  • __getSignatureV4()

What changed - functions:

  • __construct() now includes $region
  • putBucket() now calls getRegion()
  • inputFile() now includes sha256sum encoding
  • putObject() now includes sha256sum encoding
  • __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
  • getResponse() now checks $signVer for 'v2' versus 'v4'
  • getResponse() now includes the $progressFunction

Anahita's PlgStorageS3 class:

A little intro on Anahita's PlgStorageS3 class, then the questions to follow...

So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region.  It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.

The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.

Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.

Read Less
Rastin Mehr liked this
Rastin Mehr
Rastin Mehr
September 24 2019 Permalink
@scott the issues with person signup and s3 folder should be resolved now. Could you please do another test and let me know if your installation is working as expected? I appreciate it.
Rastin Mehr

Rastin Mehr commented on the topic

Revising Anahita's S3 Storage Plugin

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as...

Read More

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.

Here is an AWS source document I've found describing recent changes:

https://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html

Key points:

Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.

The original s3lib.php file includes a link in the header comments that is no longer functional.  In researching an updated version of the file, I've found two sources on GitHub:

https://github.com/racklin/amazon-s3-php-class

and

https://github.com/tpyo/amazon-s3-php-class

According to an article I found on Medium, the fork maintained by Rack Lin is preferable:

https://medium.com/@martindrapeau/simple-php-code-to-push-files-to-aws-s3-3396f9b3d02a

So I'm using the Rack Lin fork as the starting point for the updates.  Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.

What's new - variables:

  • $region
  • $progressFunction
  • $signVer

What's new - functions:

  • setRegion()
  • getRegion()
  • setSignatureVersion()
  • setProgressFunction()
  • __getSignatureV4()

What changed - functions:

  • __construct() now includes $region
  • putBucket() now calls getRegion()
  • inputFile() now includes sha256sum encoding
  • putObject() now includes sha256sum encoding
  • __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
  • getResponse() now checks $signVer for 'v2' versus 'v4'
  • getResponse() now includes the $progressFunction

Anahita's PlgStorageS3 class:

A little intro on Anahita's PlgStorageS3 class, then the questions to follow...

So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region.  It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.

The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.

Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.

Read Less
Rastin Mehr liked this
Rastin Mehr
Rastin Mehr
September 16 2019 Permalink
Thank you; this is excellent feedback. I think I know what's causing the enabled=0 issue. We've improved the domain entity validations and person signup workflow, but looks like the enabled field for the first signup ... Read More
Thank you; this is excellent feedback. I think I know what's causing the enabled=0 issue. We've improved the domain entity validations and person signup workflow, but looks like the enabled field for the first signup has been left out. Also, the s3 folder store could be a parameter issue. I'll check it out. Read Less
Unknown Person liked this
Rastin Mehr

Rastin Mehr commented on the topic

Revising Anahita's S3 Storage Plugin

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as...

Read More

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.

Here is an AWS source document I've found describing recent changes:

https://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html

Key points:

Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.

The original s3lib.php file includes a link in the header comments that is no longer functional.  In researching an updated version of the file, I've found two sources on GitHub:

https://github.com/racklin/amazon-s3-php-class

and

https://github.com/tpyo/amazon-s3-php-class

According to an article I found on Medium, the fork maintained by Rack Lin is preferable:

https://medium.com/@martindrapeau/simple-php-code-to-push-files-to-aws-s3-3396f9b3d02a

So I'm using the Rack Lin fork as the starting point for the updates.  Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.

What's new - variables:

  • $region
  • $progressFunction
  • $signVer

What's new - functions:

  • setRegion()
  • getRegion()
  • setSignatureVersion()
  • setProgressFunction()
  • __getSignatureV4()

What changed - functions:

  • __construct() now includes $region
  • putBucket() now calls getRegion()
  • inputFile() now includes sha256sum encoding
  • putObject() now includes sha256sum encoding
  • __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
  • getResponse() now checks $signVer for 'v2' versus 'v4'
  • getResponse() now includes the $progressFunction

Anahita's PlgStorageS3 class:

A little intro on Anahita's PlgStorageS3 class, then the questions to follow...

So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region.  It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.

The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.

Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.

Read Less
Rastin Mehr
Rastin Mehr
September 10 2019 Permalink
So I decided to use the new s3lib.php instead of AWS PHP SDK because we only need basic operations at this point and the SDK is enormous. I also added region support. It is also using the SSL mode set to TRUE at all t... Read More
So I decided to use the new s3lib.php instead of AWS PHP SDK because we only need basic operations at this point and the SDK is enormous. I also added region support. It is also using the SSL mode set to TRUE at all times. These changes should be sufficient for the next release. Would you be able to test the code in the master branch, please? Read Less
Unknown Person liked this
Rastin Mehr
Rastin Mehr
September 10 2019 Permalink
If I were to add any more features, it would be support for obtaining the secret and access keys from the environment variables, or if parameters were empty, then Anahita would try to check and see if they are in the ... Read More
If I were to add any more features, it would be support for obtaining the secret and access keys from the environment variables, or if parameters were empty, then Anahita would try to check and see if they are in the environment variables. Read Less
Rastin Mehr

Rastin Mehr commented on the topic

Revising Anahita's S3 Storage Plugin

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as...

Read More

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.

Here is an AWS source document I've found describing recent changes:

https://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html

Key points:

Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.

The original s3lib.php file includes a link in the header comments that is no longer functional.  In researching an updated version of the file, I've found two sources on GitHub:

https://github.com/racklin/amazon-s3-php-class

and

https://github.com/tpyo/amazon-s3-php-class

According to an article I found on Medium, the fork maintained by Rack Lin is preferable:

https://medium.com/@martindrapeau/simple-php-code-to-push-files-to-aws-s3-3396f9b3d02a

So I'm using the Rack Lin fork as the starting point for the updates.  Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.

What's new - variables:

  • $region
  • $progressFunction
  • $signVer

What's new - functions:

  • setRegion()
  • getRegion()
  • setSignatureVersion()
  • setProgressFunction()
  • __getSignatureV4()

What changed - functions:

  • __construct() now includes $region
  • putBucket() now calls getRegion()
  • inputFile() now includes sha256sum encoding
  • putObject() now includes sha256sum encoding
  • __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
  • getResponse() now checks $signVer for 'v2' versus 'v4'
  • getResponse() now includes the $progressFunction

Anahita's PlgStorageS3 class:

A little intro on Anahita's PlgStorageS3 class, then the questions to follow...

So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region.  It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.

The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.

Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.

Read Less
Rastin Mehr
Rastin Mehr
September 05 2019 Permalink
I'm using the getObjectUrl method which constructs this URL without the SSL turned on.

http://anahitapolis.com.s3.amazonaws.com/assets/public/n5/com_photos/f58df2a8432fa560d0ef62bd08cc98c2_original.jpg
Rastin Mehr
Rastin Mehr
September 05 2019 Permalink
Also, I don't think we even need to check for SSL. It's better if it is on by default. This is the output of getObjectUrl using the latest AWS S3 SDK

https://s3.amazonaws.com/anahitapolis.com/assets/public/n5/com_p... Read More
Also, I don't think we even need to check for SSL. It's better if it is on by default. This is the output of getObjectUrl using the latest AWS S3 SDK

https://s3.amazonaws.com/anahitapolis.com/assets/public/n5/com_photos/f58df2a8432fa560d0ef62bd08cc98c2_original.jpg Read Less
Rastin Mehr
Rastin Mehr
September 05 2019 Permalink
I think it is better if we get the key and secret from environment variables too whenever possible and then check with the params in the plugin. I'm going to experiment with that idea next.
Rastin Mehr

Rastin Mehr commented on the topic

Revising Anahita's S3 Storage Plugin

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as...

Read More

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.

Here is an AWS source document I've found describing recent changes:

https://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html

Key points:

Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.

The original s3lib.php file includes a link in the header comments that is no longer functional.  In researching an updated version of the file, I've found two sources on GitHub:

https://github.com/racklin/amazon-s3-php-class

and

https://github.com/tpyo/amazon-s3-php-class

According to an article I found on Medium, the fork maintained by Rack Lin is preferable:

https://medium.com/@martindrapeau/simple-php-code-to-push-files-to-aws-s3-3396f9b3d02a

So I'm using the Rack Lin fork as the starting point for the updates.  Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.

What's new - variables:

  • $region
  • $progressFunction
  • $signVer

What's new - functions:

  • setRegion()
  • getRegion()
  • setSignatureVersion()
  • setProgressFunction()
  • __getSignatureV4()

What changed - functions:

  • __construct() now includes $region
  • putBucket() now calls getRegion()
  • inputFile() now includes sha256sum encoding
  • putObject() now includes sha256sum encoding
  • __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
  • getResponse() now checks $signVer for 'v2' versus 'v4'
  • getResponse() now includes the $progressFunction

Anahita's PlgStorageS3 class:

A little intro on Anahita's PlgStorageS3 class, then the questions to follow...

So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region.  It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.

The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.

Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.

Read Less
Rastin Mehr liked this
Rastin Mehr
Rastin Mehr
September 03 2019 Permalink
So this long weekend, I created a branch and worked on an updated S3 plugin using the AWS SDK. For some reason, I'm getting an Access Denied 403 error when I use the putObject method. That is despite the permissions a... Read More
So this long weekend, I created a branch and worked on an updated S3 plugin using the AWS SDK. For some reason, I'm getting an Access Denied 403 error when I use the putObject method. That is despite the permissions and CORS configurations that I did on the bucket. Surprisingly, the old PHP library is still working fine. #AWS

https://github.com/anahitasocial/anahita/issues/513 Read Less
Unknown Person liked this
Rastin Mehr

Rastin Mehr shared a note

We updated the Anahitapolis website with a lot of improvements in the domain entities and overall security of the system. I'll post a blog post after the release to inform you about the changes tha... Read More
We updated the Anahitapolis website with a lot of improvements in the domain entities and overall security of the system. I'll post a blog post after the release to inform you about the changes that you need to make in your projects. #Anahita #Hackathon Read Less
Rastin Mehr

Rastin Mehr shared a note

There is an upcoming Anahita release with bug fixes in the core domain entity and validation system. We will be able to assert min and max value for string lengths. Also, some code improvement in t... Read More
There is an upcoming Anahita release with bug fixes in the core domain entity and validation system. We will be able to assert min and max value for string lengths. Also, some code improvement in the people component makes the code more DRY and secure. Our goal is to prepare Anahita to be a high-quality back-end API for browser, mobile, and desktop applications development. #Anahita #Hackathon #DomainEntity Read Less
Rastin Mehr

Rastin Mehr commented on the topic

Revising Anahita's S3 Storage Plugin

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as...

Read More

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.

Here is an AWS source document I've found describing recent changes:

https://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html

Key points:

Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.

The original s3lib.php file includes a link in the header comments that is no longer functional.  In researching an updated version of the file, I've found two sources on GitHub:

https://github.com/racklin/amazon-s3-php-class

and

https://github.com/tpyo/amazon-s3-php-class

According to an article I found on Medium, the fork maintained by Rack Lin is preferable:

https://medium.com/@martindrapeau/simple-php-code-to-push-files-to-aws-s3-3396f9b3d02a

So I'm using the Rack Lin fork as the starting point for the updates.  Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.

What's new - variables:

  • $region
  • $progressFunction
  • $signVer

What's new - functions:

  • setRegion()
  • getRegion()
  • setSignatureVersion()
  • setProgressFunction()
  • __getSignatureV4()

What changed - functions:

  • __construct() now includes $region
  • putBucket() now calls getRegion()
  • inputFile() now includes sha256sum encoding
  • putObject() now includes sha256sum encoding
  • __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
  • getResponse() now checks $signVer for 'v2' versus 'v4'
  • getResponse() now includes the $progressFunction

Anahita's PlgStorageS3 class:

A little intro on Anahita's PlgStorageS3 class, then the questions to follow...

So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region.  It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.

The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.

Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.

Read Less
Create the S3 object in the plugin's __construct method because at that point; all the parameters are initialized previously in the _initialize method. When you are passing parameters to the s3lib object, they need to... Read More
Create the S3 object in the plugin's __construct method because at that point; all the parameters are initialized previously in the _initialize method. When you are passing parameters to the s3lib object, they need to be in the correct order as the s3lib's __construct method.

Yes, the other methods in this plugin pass the required values to the S3 object or return a value received from the s3 object. This plugin is an adaptor to make the S3 library work with Anahita.

Did I answer your questions? Read Less
yes the order of the passed parameters is important. If you are passing all of them, just pass 's3.amazonaws.com' for the endpoint. That should happen in the _initialize method where you are adding default values.
Unknown Person liked this
Rastin Mehr

Rastin Mehr commented on the topic

Revising Anahita's S3 Storage Plugin

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as...

Read More

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.

Here is an AWS source document I've found describing recent changes:

https://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html

Key points:

Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.

The original s3lib.php file includes a link in the header comments that is no longer functional.  In researching an updated version of the file, I've found two sources on GitHub:

https://github.com/racklin/amazon-s3-php-class

and

https://github.com/tpyo/amazon-s3-php-class

According to an article I found on Medium, the fork maintained by Rack Lin is preferable:

https://medium.com/@martindrapeau/simple-php-code-to-push-files-to-aws-s3-3396f9b3d02a

So I'm using the Rack Lin fork as the starting point for the updates.  Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.

What's new - variables:

  • $region
  • $progressFunction
  • $signVer

What's new - functions:

  • setRegion()
  • getRegion()
  • setSignatureVersion()
  • setProgressFunction()
  • __getSignatureV4()

What changed - functions:

  • __construct() now includes $region
  • putBucket() now calls getRegion()
  • inputFile() now includes sha256sum encoding
  • putObject() now includes sha256sum encoding
  • __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
  • getResponse() now checks $signVer for 'v2' versus 'v4'
  • getResponse() now includes the $progressFunction

Anahita's PlgStorageS3 class:

A little intro on Anahita's PlgStorageS3 class, then the questions to follow...

So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region.  It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.

The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.

Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.

Read Less
I think the code you have written in __construct need to move to _initialize method. __construct only receives the custom configurations, if there are any. In the _initialize you'll check to see if there are any custo... Read More
I think the code you have written in __construct need to move to _initialize method. __construct only receives the custom configurations, if there are any. In the _initialize you'll check to see if there are any custom values passed in the $config object, otherwise use the ones provided by the plugin parameters or default hardcoded values. Read Less
Ok, I was wrong. I checked the order of execution. The _initialize gets called first, so you need to set the $config default values in the _initialize method. Then the constructor is called, in __construct if a $confi... Read More
Ok, I was wrong. I checked the order of execution. The _initialize gets called first, so you need to set the $config default values in the _initialize method. Then the constructor is called, in __construct if a $config object is passed to the function, then use it. Perhaps it is even more comfortable if you merge it, so the fields that contain a value overwrite the default values. Otherwise, use the default values that you set in the _initialize function. Read Less
Rastin Mehr

Rastin Mehr commented on the topic

Revising Anahita's S3 Storage Plugin

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as...

Read More

Starting a topic on the S3 storage plugin to document the upgrades that appear to be required.  I'll use the topic itself to post relevant background and then post questions I have at the moment as comments on the topic.

Here is an AWS source document I've found describing recent changes:

https://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html

Key points:

Previous method was referred to as Signature Version 2, the new method is referred to as Signature Version 4.

The original s3lib.php file includes a link in the header comments that is no longer functional.  In researching an updated version of the file, I've found two sources on GitHub:

https://github.com/racklin/amazon-s3-php-class

and

https://github.com/tpyo/amazon-s3-php-class

According to an article I found on Medium, the fork maintained by Rack Lin is preferable:

https://medium.com/@martindrapeau/simple-php-code-to-push-files-to-aws-s3-3396f9b3d02a

So I'm using the Rack Lin fork as the starting point for the updates.  Copying down the library file ('S3.php') I found a few extra spaces which once deleted helps focus strictly on what's changed by running a diff against Anahita's 's3lib.php' file.

What's new - variables:

  • $region
  • $progressFunction
  • $signVer

What's new - functions:

  • setRegion()
  • getRegion()
  • setSignatureVersion()
  • setProgressFunction()
  • __getSignatureV4()

What changed - functions:

  • __construct() now includes $region
  • putBucket() now calls getRegion()
  • inputFile() now includes sha256sum encoding
  • putObject() now includes sha256sum encoding
  • __getCloudFrontDistributionConfigXML() now checks that $trustedSigners is not empty
  • getResponse() now checks $signVer for 'v2' versus 'v4'
  • getResponse() now includes the $progressFunction

Anahita's PlgStorageS3 class:

A little intro on Anahita's PlgStorageS3 class, then the questions to follow...

So Anahita's PlgStorageS3 class appears to need revisions in order to account for the signature version and region.  It seems these should be parameters that can be assigned in the Plugin's settings through additions to the s3.json file, with the signature version as a drop-down selector, and the region a text field with the default value of 'us-east-1'.

The "core" functions in PlgStorageS3 (_read, _write, _exists, and _delete) appear they should be compatible with the Rack Lin replacement for the s3lib.php file.

Protected variables would need to be added for $_region and $_signature, and it appears the __construct function would need to be amended to account for both.

Read Less
Rastin Mehr liked this
I wanted to let you know how much I appreciate this!
Unknown Person liked this
Rastin Mehr

Rastin Mehr shared a photo

Added react-player which supports platforms such as youtube, vimeo, soundcloud, twitch, and dailymotion. #Anahita #Hackathon #Players #ReactJS #MaterialUI #ReactPlayer
Rastin Mehr

Rastin Mehr shared a note

Going to try the react player library this weekend for Anahita. I think it would be a more suitable option than plyr.io https://www.npmjs.com/package/react-player #Anahita #Hackathon #ReactJS #Pla... Read More
Going to try the react player library this weekend for Anahita. I think it would be a more suitable option than plyr.io https://www.npmjs.com/package/react-player #Anahita #Hackathon #ReactJS #Players Read Less
Rastin Mehr

Rastin Mehr shared a photo

Content Filters for Hashtags, Mentions, and URLs

Today we added content filters for hashtags, mentions, and URLs. Quite likely we won't be using plyr.io for the anahita-react app, because it is processing heavy and throwing way too many errors. We are going to try the react-player library instead which has support for youtube, vimeo, soundcloud, and facebook videos. It seems to be less processing intensive too. We'll see about that. #Anahita #Hackathon #ContentFilters
Rastin Mehr

Rastin Mehr shared a photo

Anahita Locations - Browse View, now with addresses #ReactJS #MaterialUI
Rastin Mehr

Rastin Mehr shared a photo

Anahita Locations Read View

Locations Read View. This was quite simple and there was already a React component for rendering the map. #ReactJS #MaterialUI
Rastin Mehr

Rastin Mehr shared a photo

Anahita Locations Browse

Locations Browse view. This was surprisingly easy using the new HOC approach
Rastin Mehr

Rastin Mehr shared new photos

Photos View All

Articles View All

Topics View All

To-dos View All

Powered by Anahita