Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle complex website #61

Merged
5 commits merged into from
May 30, 2022
Merged

Conversation

Neylix
Copy link
Member

@Neylix Neylix commented May 25, 2022

This PR is the first implementation to solve the issue #60

Actually the CLI do:

  • Create a JSON object based on the directory tree
  • Compress file content using gzip to reduce size and encode the result in base64
  • Create a hosting transaction with stringified JSON object in the content
  • Ask user to validate fees
  • Send the transaction and show the website URL
  • Indicate to the user the current step during all flow

This has been tested with actual archethic.net site and with wallet site.

But the problem is that both sites have a bigger size than the maximum content size allowed in a transaction, even after compression.
So the next step will be to reduce content of a transaction to 3.5 MB max.
We can split content in different transactions and refer the transaction address in the JSON object :

{
 "index.html":{
  "address":"000123456789"
 }
}

And so the node API will get the content of this file inside the transaction at "address".

But for files above 3.5 MB we need to split the file, maybe by using esbuild for example.

@Neylix Neylix added feature new feature or enhancement core team Contribution by core team labels May 25, 2022
@Neylix Neylix requested review from a user, imnik11 and manujuniris May 25, 2022 15:53
@Neylix Neylix marked this pull request as draft May 25, 2022 15:54
@Neylix
Copy link
Member Author

Neylix commented May 25, 2022

Here you can find the site I used to test. (I removed the white paper pdf because size was to big for Github)
website.zip
To handle over sized tx, you have to update node git apply patch.txt
patch.txt

Copy link
Contributor

@manujuniris manujuniris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Neylix

I tried to deploy a simple html file, but it failed.

web.zip

Can you please also update the README file in PR?

@Neylix
Copy link
Member Author

Neylix commented May 27, 2022

Hi @Neylix

I tried to deploy a simple html file, but it failed.

web.zip

Can you please also update the README file in PR?

Yes I'll update the Readme later. As the PR is in draft, it will surely change again.

What is the error you got ?

@manujuniris
Copy link
Contributor

Hi @Neylix
I tried to deploy a simple html file, but it failed.
web.zip
Can you please also update the README file in PR?

Yes I'll update the Readme later. As the PR is in draft, it will surely change again.

What is the error you got ?

Hi @Neylix
I tried to deploy a simple html file, but it failed.
web.zip
Can you please also update the README file in PR?

Yes I'll update the Readme later. As the PR is in draft, it will surely change again.

What is the error you got ?

Screenshot from 2022-05-27 12-49-03

@Neylix Neylix marked this pull request as ready for review May 30, 2022 07:37
@Neylix Neylix requested a review from manujuniris May 30, 2022 07:37
Copy link
Contributor

@manujuniris manujuniris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from 2022-05-30 13-35-28

@Neylix
Copy link
Member Author

Neylix commented May 30, 2022

Screenshot from 2022-05-30 13-35-28

Yes there is a problem with getOriginKey API on testnet, try with a local node

Copy link
Contributor

@manujuniris manujuniris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from 2022-05-30 14-01-28

Single File deployment failed

@Neylix
Copy link
Member Author

Neylix commented May 30, 2022

Screenshot from 2022-05-30 14-01-28

Single File deployment failed

It do not fail, this error is a problem in libjs. It is corrected in master but not pushed in npm version.
If you go to the url you will see the file

@manujuniris
Copy link
Contributor

manujuniris commented May 30, 2022

Screenshot from 2022-05-30 14-01-28
Single File deployment failed

It do not fail, this error is a problem in libjs. It is corrected in master but not pushed in npm version. If you go to the url you will see the file

Screenshot from 2022-05-30 14-22-03

Can you display the complete transaction url along with filename and extension

@manujuniris
Copy link
Contributor

Hello Julien

Screenshot from 2022-05-30 16-34-15

I just checked cli is not able to convert image file path to transaction url

@manujuniris manujuniris self-requested a review May 30, 2022 11:26
@ghost ghost merged commit 8b033bd into archethic-foundation:main May 30, 2022
@Neylix Neylix deleted the Handle-complex-website branch May 30, 2022 15:52
@gvqualite
Copy link

gvqualite commented Jun 1, 2022

This PR is the first implementation to solve the issue #60

Actually the CLI do:

  • Create a JSON object based on the directory tree
  • Compress file content using gzip to reduce size and encode the result in base64
  • Create a hosting transaction with stringified JSON object in the content
  • Ask user to validate fees
  • Send the transaction and show the website URL
  • Indicate to the user the current step during all flow

This has been tested with actual archethic.net site and with wallet site.

But the problem is that both sites have a bigger size than the maximum content size allowed in a transaction, even after compression. So the next step will be to reduce content of a transaction to 3.5 MB max. We can split content in different transactions and refer the transaction address in the JSON object :

{
 "index.html":{
  "address":"000123456789"
 }
}

And so the node API will get the content of this file inside the transaction at "address".

But for files above 3.5 MB we need to split the file, maybe by using esbuild for example.

Hello,

It will be nice to open links to external links such as https ou ipfs, such as
{
“picture.png”:{
“href”:”ipfs://xxxxxxxxxx”
},
“overview.mp4”:{
“href”:”http://xxxxxx”
},
“app.js”:{
“href”:”archethic://000123456789“
}
}

This is more flexible, not sure that we will store everything in ArchEthic and apps like I am développer will be able to implement different statregies.

It will be also a big limitation if we point to a transaction only on a content et not to another JSON description as children. For exemple, one transaction can contain a lib with js & css, (shared by other site) called from another transaction containing the website.
Thanks to study this

Valette P

@Neylix
Copy link
Member Author

Neylix commented Jun 1, 2022

This PR is the first implementation to solve the issue #60
Actually the CLI do:

  • Create a JSON object based on the directory tree
  • Compress file content using gzip to reduce size and encode the result in base64
  • Create a hosting transaction with stringified JSON object in the content
  • Ask user to validate fees
  • Send the transaction and show the website URL
  • Indicate to the user the current step during all flow

This has been tested with actual archethic.net site and with wallet site.
But the problem is that both sites have a bigger size than the maximum content size allowed in a transaction, even after compression. So the next step will be to reduce content of a transaction to 3.5 MB max. We can split content in different transactions and refer the transaction address in the JSON object :

{
 "index.html":{
  "address":"000123456789"
 }
}

And so the node API will get the content of this file inside the transaction at "address".
But for files above 3.5 MB we need to split the file, maybe by using esbuild for example.

Hello,

It will be nice to open links to external links such as https ou ipfs, such as { “picture.png”:{ “href”:”ipfs://xxxxxxxxxx” }, “overview.mp4”:{ “href”:”http://xxxxxx” }, “app.js”:{ “href”:”archethic://000123456789“ } }

This is more flexible, not sure that we will store everything in ArchEthic and apps like I am développer will be able to implement different statregies.

It will be also a big limitation if we point to a transaction only on a content et not to another JSON description as children. For exemple, one transaction can contain a lib with js & css, (shared by other site) called from another transaction containing the website. Thanks to study this

Valette P

Hi ! Thanks for your contribution :)

I don't really understand when you will use this because let's say you want to use the script from another transaction, in your html file you can directly use the url like:

<script src="archethic://000123456789"></script>
<img src="ipfs://xxxxxxxxxx" />

And so the browser will directly request for the good url

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core team Contribution by core team feature new feature or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants