Subdirectory Support - Email SSL Support - Federation Improvements - Mermaid Support - #1658
Conversation
…activity pub to update more information
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…ption, pagename, header, etc on the fly
|
was actually my blogs custom css and not the code itself |
|
@thebaer hi Matt, I’m quite fond of the philosophy behind writefreely, it’s simple, customisable, smart, with the foundation of golang to support it (Working with it for 3 years professionally now, I believe it’s a great language for scale.) Ideally, I would have broken these into separate PRs entirely, but my feature scope became quite broad and i got ahead of myself trying to see it all work together, but each commit or cluster of commits should not be horribly coupled to one another, if at all. However, I’m sure I’ve introduced some new quirks notably in ui, so please feel free to tear this apart, and I will do my due diligence in making sure this code runs correctly. I have it running on my own blog to test everything too. I hope these changes can add a lot of value to writefreely. |
82aed0a to
4396688
Compare
|
Hey @savagebread, I appreciate you having a go at all of this! I would love to get everything merged that makes sense. But in order for me to properly review this, I do need this broken up into separate PRs, ideally by overall functionality and then the individual small fixes (for example, I'd want to know why If you want to start with the subdirectory changes as a branch and set all other changes to be merged into that one, I think that would be a decent strategy. Thanks again for taking an interest in this! |
|
Sweet! |
[Describe the pull request here...]
no don't make me use wordpress for seo no please no please don't make me do it
Changes:
1. Subdirectory Support
subdirectoryconfig option inconfig.ini, allowing WriteFreely to be hosted at a path prefix (e.g.example.com/blog/).AppCfgmethods on the config struct:SubdirectoryPath()— normalizes the configured subdir pathPrefixPath(path)— prepends the subdir prefix to any local pathAbsoluteURL(path)— builds a full absolute URLAbsoluteHost()— returns the canonical host (with subdir stripped){{subdir}}template variable for asset and navigation paths.less/fonts.less,less/icons.less).collections_subdir_test.goto validate path generation.2. ActivityPub / Federation Improvements
ExtendedPersonstruct wrapping the upstreamactivitystreams.Personto add theimage(banner/header) field, which is part of the AP spec and supported by Mastodon but absent from the upstream library.PersonObject()now populates the following fields from collection settings:icon— avatar/profile pictureimage— header/banner imagename— display namesummary— bio/descriptionfederateActor()function sends anUpdate{Person}activity to all followers whenever a collection's profile is updated, so changes to bio, display name, avatar, and header propagate to Mastodon and other ActivityPub servers in real time.collections.gonow callsfederateActorafter saving collection metadata.AbsoluteHost()to ensure correct absolute URLs.3. Mermaid Diagram Rendering
static/js/mermaid.min.js— bundled locally, no CDN dependency.templates/include/post-render.tmplgains a{{define "mermaid"}}block that:<code class="language-mermaid">blocks in rendered posts<div class="mermaid">elements{{subdir}}/js/mermaid.min.jsmermaid.initialize()andmermaid.run(){{subdir}}prefix.4. Additional Fixes
mailer/mailer.go,email.go).alterShortCodeEmailSubFormhelper and spam honeypot injection from the live preview render endpoint.postrender.go— removed leading/that caused double-slashes with the subdir prefix.cfg.App.PrefixPath("/read/t/")and mention prefix usescfg.App.AbsoluteURL("/@/")for correct subdir-aware URLs.5. Test Coverage
Significant new tests added across:
appstats/appstats_test.goauthor/author_test.goconfig/config_test.goconfig/funcs_test.goconfig/validation_test.godb/dialect_test.godb/index_test.godb/raw_test.goparse/posts_test.gopostrender_test.goposts_test.gosemver_test.gospam/spam_test.gorequest_test.goroutes_test.goactivitypub_test.goemail_test.goPhoto Examples:
Mermaid Rendering in blog post
Branding Settings
Mermaid Setting