-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix_pop_push_slice
- Loading branch information
Showing
20 changed files
with
488 additions
and
83 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
Please provide a detailed description of the changes made in this pull request. | ||
<!-- please provide a detailed description of the changes made in this pull request. --> | ||
|
||
<details><summary>Checklists...</summary> | ||
|
||
## Contributors Checklist | ||
<details><summary>Contributors' checklist...</summary> | ||
|
||
- [ ] Added new tests, or not needed, or not feasible | ||
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory | ||
- [ ] Updated the official documentation or not needed | ||
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description | ||
- [ ] Added references to related issues and PRs | ||
- [ ] Provided any useful hints for running manual tests | ||
- [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](../.benchmarks/README.md). | ||
|
||
## Maintainers Checklist | ||
|
||
- [ ] Checked that the author followed the guidelines in `CONTRIBUTING.md` | ||
- [ ] Checked the conventional-commit (especially PR title and verb, presence of `BREAKING CHANGE:` in the body) | ||
- [ ] Ensured that this PR is not a significant change or confirmed that the review/consideration process was appropriate for the change | ||
- [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). | ||
</details> |
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,27 +1,51 @@ | ||
# This configuration file was automatically generated by Gitpod. | ||
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) | ||
# and commit this file to your remote git repository to share the goodness with others. | ||
# http://gitpod.io/#github.com/gnolang/gno | ||
|
||
tasks: | ||
- name: Dev Shell | ||
init: > | ||
echo "install developer tools" && | ||
(cd misc/devdeps && make install) && | ||
echo "download dependencies" && | ||
go mod download && | ||
go install ./gnovm/cmd/gno | ||
- name: Gno Shell | ||
before: cd ./examples/ | ||
init: | | ||
( | ||
set -xe | ||
cd .. | ||
echo "install developer tools" | ||
(cd misc/devdeps && make install) | ||
echo "download dependencies" | ||
go mod download | ||
go install ./gnovm/cmd/gno | ||
echo "Deps installed." | ||
) | ||
command: gno --help | ||
|
||
- name: Gnoland Node | ||
before: cd ./gno.land/ | ||
init: go install ./cmd/gnoland | ||
command: gnoland start | ||
|
||
- name: Gnoland Website | ||
init: go install ./gno.land/cmd/gnoweb | ||
before: cd ./gno.land/ | ||
init: go install ./cmd/gnoweb | ||
command: gnoweb --bind=0.0.0.0:8888 | ||
|
||
- name: Gnoland Node | ||
init: go install ./gno.land/cmd/gnoland | ||
command: gnoland start | ||
#- name: faucet | ||
# ... | ||
|
||
ports: | ||
- port: 8888 | ||
- name: gnoweb | ||
description: "the Gno.land web server" | ||
port: 8888 | ||
onOpen: open-preview | ||
- port: 36657 | ||
|
||
- name: "gnoland RPC" | ||
description: "the RPC server, managed by tendermint2" | ||
port: 36657 | ||
onOpen: notify | ||
|
||
github: | ||
prebuilds: | ||
master: true | ||
branches: false | ||
pullRequests: false | ||
pullRequestsFromForks: false | ||
addCheck: false | ||
addComment: false | ||
addBadge: false |
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
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
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,86 @@ | ||
package gnopages | ||
|
||
import ( | ||
"std" | ||
"strings" | ||
|
||
"gno.land/p/demo/avl" | ||
) | ||
|
||
var ( | ||
adminAddr std.Address | ||
moderatorList avl.Tree | ||
inPause bool | ||
) | ||
|
||
func init() { | ||
// adminAddr = std.GetOrigCaller() // FIXME: find a way to use this from the main's genesis. | ||
adminAddr = "g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq" | ||
} | ||
|
||
func AdminSetAdminAddr(addr std.Address) { | ||
assertIsAdmin() | ||
adminAddr = addr | ||
} | ||
|
||
func AdminSetInPause(state bool) { | ||
assertIsAdmin() | ||
inPause = state | ||
} | ||
|
||
func AdminAddModerator(addr std.Address) { | ||
assertIsAdmin() | ||
moderatorList.Set(addr.String(), true) | ||
} | ||
|
||
func AdminRemoveModerator(addr std.Address) { | ||
assertIsAdmin() | ||
moderatorList.Set(addr.String(), false) // XXX: delete instead? | ||
} | ||
|
||
func ModAddPost(slug, title, body, tags string) { | ||
assertIsModerator() | ||
|
||
caller := std.GetOrigCaller() | ||
tagList := strings.Split(tags, ",") | ||
err := b.NewPost(caller, slug, title, body, tagList) | ||
checkErr(err) | ||
} | ||
|
||
func ModEditPost(slug, title, body, tags string) { | ||
assertIsModerator() | ||
|
||
tagList := strings.Split(tags, ",") | ||
err := b.GetPost(slug).Update(title, body, tagList) | ||
checkErr(err) | ||
} | ||
|
||
func isAdmin(addr std.Address) bool { | ||
return addr == adminAddr | ||
} | ||
|
||
func isModerator(addr std.Address) bool { | ||
_, found := moderatorList.Get(addr.String()) | ||
return found | ||
} | ||
|
||
func assertIsAdmin() { | ||
caller := std.GetOrigCaller() | ||
if !isAdmin(caller) { | ||
panic("access restricted.") | ||
} | ||
} | ||
|
||
func assertIsModerator() { | ||
caller := std.GetOrigCaller() | ||
if isAdmin(caller) || isModerator(caller) { | ||
return | ||
} | ||
panic("access restricted") | ||
} | ||
|
||
func assertNotInPause() { | ||
if inPause { | ||
panic("access restricted (pause)") | ||
} | ||
} |
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,6 @@ | ||
module gno.land/r/gnoland/pages | ||
|
||
require ( | ||
"gno.land/p/demo/avl" v0.0.0-latest | ||
"gno.land/p/demo/blog" v0.0.0-latest | ||
) |
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,21 @@ | ||
package gnopages | ||
|
||
import ( | ||
"gno.land/p/demo/blog" | ||
) | ||
|
||
var b = &blog.Blog{ | ||
Title: "Gnoland's Pages", | ||
Prefix: "/r/gnoland/pages:", | ||
} | ||
|
||
func init() { | ||
_ = b.NewPost("", "gor", "Game of Realms", "Lorem Ipsum", nil) | ||
_ = b.NewPost("", "events", "Events", "Lorem Ipsum", nil) | ||
_ = b.NewPost("", "tokenomics", "Tokenomics", "Lorem Ipsum", nil) | ||
_ = b.NewPost("", "start", "Getting Started", "Lorem Ipsum", nil) | ||
} | ||
|
||
func Render(path string) string { | ||
return b.Render(path) | ||
} |
Oops, something went wrong.