The new Ripple frontend.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Giuseppe Guerra 3fc0620d69 Merge branch 'master' of zxq.co:ripple/hanayo преди 3 месеца
data Ranking criteria fixes преди 4 месеца
modules Updated hardcoded server ips преди 6 месеца
routers Bancho API privs, Bancho OAuth, update api vendor преди 4 месеца
scripts Update locales преди 1 година
semantic Fix placeholder color being completely white преди 2 години
services Finish token creation pages преди 2 години
static Bancho API privs, Bancho OAuth, update api vendor преди 4 месеца
templates Ranking criteria fixes преди 4 месеца
vendor Bancho API privs, Bancho OAuth, update api vendor преди 4 месеца
website-docs @ 1bd4238f62 Updated submodule website-docs преди 3 месеца
.drone.yml add drone преди 1 година
.editorconfig add drone преди 1 година
.eslintrc eslint config преди 1 година
.gitignore Add basic oauth flow преди 2 години
.gitmodules Add submodule website-docs преди 2 години
2fa.go append query to redir URL in 2fa преди 2 години
Gopkg.lock Bancho API privs, Bancho OAuth, update api vendor преди 4 месеца
Gopkg.toml require license to be agreed before starting hanayo преди 1 година
LICENSE Forgetting we are using GNU AGPL: check преди 3 години
README.md Explain why you shouldn't write code like hanayo in the README преди 1 година
avatar.go ADD EVERYTHING TO TEMPLATES FILE OH YEAH преди 2 години
beatmap.go merge appends and remove shiet преди 1 година
context.go fix breaking changes преди 1 година
dev.go Bancho API privs, Bancho OAuth, update api vendor преди 4 месеца
doc.go ⬆️ v1.8.6 ⬆️ преди 1 година
errors.go ADD EVERYTHING TO TEMPLATES FILE OH YEAH преди 2 години
funcmap.go Play Time преди 6 месеца
gulpfile.js make dark site a real setting instead of an easter egg преди 1 година
helpers.go pass valid context to Exchange code преди 1 година
irc.go ADD EVERYTHING TO TEMPLATES FILE OH YEAH преди 2 години
loadchangelog.go Support for new changelog format преди 11 месеца
localisation.go Make website show localised text преди 2 години
login.go ADD EVERYTHING TO TEMPLATES FILE OH YEAH преди 2 години
main.go require license to be agreed before starting hanayo преди 1 година
messages.go Add messages system (for {error,success,info,...} messages) преди 3 години
oauth.go Add X-Frame-Options: deny to OAuth token requests преди 2 години
package.json Start implementing localisation in JavaScript преди 2 години
profbackground.go Slight increase of 13% of profile background quality преди 2 години
profile.go ADD EVERYTHING TO TEMPLATES FILE OH YEAH преди 2 години
pw.go Create token revocation page преди 2 години
rate_limiter.go use getContext instead of MustGet("context").(context) преди 3 години
recovery.go Update vendor преди 2 години
register.go Don't add user to leaderboard when they register преди 2 години
semantic.json Display achievements on user profiles преди 1 година
sessions.go Make Language set in the Context, not by the template преди 2 години
simple.go ADD EVERYTHING TO TEMPLATES FILE OH YEAH преди 2 години
startuato_linux.go deploy a specific branch преди 2 години
startuato_windows.go When refreshing templates, restart the entire webserver преди 3 години
templates.go ignore non-html files while loading templates преди 1 година
tracking.go Move from git.zxq.co to zxq.co преди 2 години
yarn.lock Start implementing localisation in JavaScript преди 2 години

README.md

Hanayo build status

This repository has a mirror here. The original repo is still here.

To fellow developers: this is not how you do it!

The biggest flaw of hanayo are that when I set out to create it, I wanted to create a template system that:

  • Created a handler by simply having the file “be there”
  • Could fetch the data it needed on its own, often from the Ripple API
  • Had the actual Go code be as little as possible

This was not immediately evident to me, a Go beginner, but what I did there was basically make Go be PHP.

The biggest lesson I learned on how to properly do templates, was learning to use Vue. Yes, Vue can be used for the frontend and not really for server-rendered stuff, but even just learning how to do stuff with it can help you understand what a template is actually supposed to be in order to be maintainable.

The key concepts and insights for me where:

  • Separating clearly code and markup, making the template declarative and keeping as little code in the template
  • A template should be purely functional. Its mere creation should not generate side effects, nor should it be dependent on things that are not its precise inputs: for a given input there is a specific output.
  • The concept of component as a single self-contained entity which is the same wherever you use it is very powerful.
  • Once a template/component starts becoming too big, split it into more components.

But don’t stop here. Actually making a project using Vue helps you to understand this much more easily than using mere words. Go ahead and build something, even if just to play around!