-
Notifications
You must be signed in to change notification settings - Fork 174
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
Juno Website Hosting Update #939
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a8d3b6a
Add Zip File Integration (CW WIP)
joelsmith-2019 c28bec1
Remove Write Header
joelsmith-2019 031308f
Hook Into Contract For Zip Support,
joelsmith-2019 f79d41a
Update Error Handling & Debug Msgs
joelsmith-2019 564f041
Code Cleanup & Refactoring
joelsmith-2019 7abcd67
Limit File Sizes & Lint
joelsmith-2019 c6f95c2
Update app/webhost/_scripts.sh
Reecepbcups 7b8908a
Update app/webhost/_scripts.sh
Reecepbcups e6ff282
Update app/webhost/_scripts.sh
Reecepbcups File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
juno-local | ||
# EXECUTE THIS SCRIPT FROM THIS DIRECTORY | ||
|
||
junod tx wasm store /home/reece/Desktop/cw-webhost/artifacts/cw_webhost.wasm --from=juno1 --keyring-backend=test --chain-id=local-1 --gas=auto --gas-adjustment=1.5 --gas-prices=0.025ujuno --yes | ||
junod tx wasm store cw_webhost.wasm --from=juno1 --keyring-backend=test --chain-id=local-1 --gas=auto --gas-adjustment=1.5 --gas-prices=0.025ujuno --yes --home=$HOME/.juno1 | ||
|
||
junod tx wasm instantiate 1 '{}' --from=juno1 --keyring-backend=test --chain-id=local-1 --label=cw_webhost --gas=auto --gas-adjustment=1.5 --gas-prices=0.025ujuno --yes --no-admin | ||
sleep 3 | ||
|
||
junod tx wasm instantiate 1 '{}' --from=juno1 --keyring-backend=test --chain-id=local-1 --label=cw_webhost --gas=auto --gas-adjustment=1.5 --gas-prices=0.025ujuno --yes --no-admin --home=$HOME/.juno1 | ||
ADDRESS=juno14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9skjuwg8 | ||
|
||
sleep 3 | ||
|
||
junod tx wasm execute $ADDRESS '{"new_website":{"name":"test","source":"<html><script>alert(\"popup\")</script><style>body {background-color: lightblue;}</style><h1>Test Website Header</h1><p>Paragraph</p></html>"}}' --from=juno1 --keyring-backend=test --chain-id=local-1 --gas=auto --gas-adjustment=1.5 --gas-prices=0.025ujuno --yes | ||
# Encode zip file to base64, generate new_web_cmd.txt | ||
# ENSURE YOU HAVE A FILE NAMED 'web.zip' in the same directory as this script | ||
python3 encode_zip_to_base64.py | ||
JSON="$(cat new_web_cmd.txt)" | ||
junod tx wasm execute $ADDRESS $JSON --from=juno1 --keyring-backend=test --chain-id=local-1 --gas=auto --gas-adjustment=1.5 --gas-prices=0.025ujuno --yes --home=/home/joel/.juno1 | ||
|
||
junod q wasm contract-state smart $ADDRESS '{"get_website":{"name":"test"}}' | ||
sleep 3 | ||
|
||
junod q wasm contract-state smart $ADDRESS '{"get_website":{"name":"test"}}' --home=$HOME/.juno1 | ||
|
||
# Website should be available at: http://localhost:1317/webhost/juno14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9skjuwg8/test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import base64 | ||
import json | ||
|
||
with open("web.zip", "rb") as f: | ||
bytes = f.read() | ||
encoded = base64.b64encode(bytes) | ||
|
||
with open("web.zip.txt", "wb") as f: | ||
f.write(encoded) | ||
|
||
with open("new_web_cmd.txt", "w") as f: | ||
wasm_execute_json = json.dumps({"new_website": {"name": "test", "source": encoded.decode("utf-8")}}) | ||
f.write(wasm_execute_json.replace(" ", "")) |
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am good with a py script, but if you prefer bash is also possible
cat web.zip | base64 -w 0