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

Change the chat data to having a standard location for the HTML() templates #32

Open
joeyak opened this issue Mar 15, 2019 · 5 comments
Assignees
Labels
hardening Changes that are not new features, but benefit the developer

Comments

@joeyak
Copy link
Collaborator

joeyak commented Mar 15, 2019

It would be better to have a specific spot to store all the html message templates. Perhaps a slice or constants in another file.

@joeyak joeyak added the hardening Changes that are not new features, but benefit the developer label Mar 15, 2019
@zorchenhimer
Copy link
Owner

I thought I had a TODO for this somewhere.

But yes, ideally that stuff should be a template somewhere that's loaded once at the server start. Maybe a global, read-only, map[string]html.Template? Where the string is the use of the template, eg "MsgAction" or "EvBan".

@joeyak
Copy link
Collaborator Author

joeyak commented Mar 15, 2019

I like the map[string]html.Template idea. The keys should be "enum" constants. Maybe with a Tmpl prefix.

@zorchenhimer
Copy link
Owner

This just occurred to me, but the templates cannot just be loaded into the server. They need to be sent to the wasm client, as that's what actually calls .HTML() on the data.

But now that we have some more robust communication between the client and server, this shouldn't pose much of a problem.

@joeyak
Copy link
Collaborator Author

joeyak commented Mar 15, 2019

Were you thinking of having the templates loaded on server start? I was thinking of making the templates "contasts", but I think I might like the load at runtime better.

@zorchenhimer
Copy link
Owner

Yea, on server start. I think I'd like to handle it similarly to how emotes are loaded. Once on server start, but they can be refreshed by an admin with a command.

Refreshing shouldn't update HTML that's already been displayed, only new HTML. Comparing it to emotes again, when emotes are refreshed and new ones are found, old messages are not re-parsed for the new emote.

@zorchenhimer zorchenhimer self-assigned this Apr 13, 2019
zorchenhimer added a commit that referenced this issue Apr 13, 2019
This is for #32.

This adds a starting framework for loading, caching, and executing
templates on the server and the client.  Currently only the server uses
this functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hardening Changes that are not new features, but benefit the developer
Projects
None yet
Development

No branches or pull requests

2 participants