~sircmpwn/man.sr.ht

Import Markup from markupsafe

Using jinja2 here is deprecated.
Fix repo creation during "new wiki" workflow

Currently, creating new repos when setting up a new wiki fails because
man.sr.ht does not specify the visibility of the repo to be created.
This commit fixes this by allowing the user to choose the visibility
in the "Create a new repo" form and passing the selected value to the
API call for repo creation.

Fixes: https://todo.sr.ht/~sircmpwn/man.sr.ht/58
.builds/alpine.yml: upgrade to 3.15
Instrument caches
c685181d — Peter Sanchez 9 months ago
Updating config example for new mail options
new-wiki.html: fix suggested git commands

See #55
Fix issues with "first paragraph" rehoming

This code is designed to put the first paragraph ahead of the table of
contents, but it could cause issues if the first HTML element was not a
paragraph tag, or if the page had the ToC disabled or had no headings.
Make wiki names match [A-Za-z0-9._-]+

Also prohibits use of '.git' and '.hg' as wiki names.
create: fix logic error with existing refs

The "existing" branch in the template is used on the repo select screen
to filter out repositories which already have a wiki created for them.
This change adds a short-circuit which avoids the check in other
situations.

While I'm here I also tweaked the appearance of this page a bit.
.builds/alpine.yml: upgrade to 3.14
Remove whitespace before wiki name
Add links back to wiki root on wiki pages

This adds links back to the wiki root index in two places: on the
pseudo-breadcrumbs with the username and wiki name, and on the "article"
tab.  This makes it possible to navigate back to the wiki index from any
wiki page, whereas before it was impossible.  The new links also fixes
the most counterintuitive link on the page, as the "article" tab linking
back to the site root (/) is very strange and unexpected.
Fix double-tilde bug in the delete wiki page

The routes for `user_content` in mansrht/blueprints/html.py include a
tilde ('~') in them, which is required for the route to function
properly.  However, .canonical_name already includes a tilde[a].  This
causes in a bug where any usage of user_content with the
owner.canonical_name field will result in a generated url where the
username is prefixed with two tildes ("~~nytpu") rather than one.

This replaces the usages of owner.canonical_name with owner.username
which is identical to .canonical_name (see link [a]) except that it does
not have a leading tilde.

[a]: https://git.sr.ht/~sircmpwn/core.sr.ht/tree/99a8168de436c576ec98242d255a71a2b94c9658/item/srht/oauth/user.py#L37
Prohibit . and .. in wiki names
Fix Flask 2.0.x incompatible blueprint names
Revert "Link back to wiki index"

This reverts commit 0c6887ca55502abfe78103d45380566e8e3cf876.
Validate existence of branch
Fix 500 when creating a wiki from branch containing invalid utf-8
Next