~sircmpwn/core.sr.ht

Upgrade to Alpine 3.17
graphql: set GraphQLError.data

Even if errors occured, the server may return data. Store that
data in GraphQLError.data so that callers can easily access it.
graphql: parse response JSON once on error
crypto: fix invalid JSON

Fixes the following TypeError:

    Traceback (most recent call last):
      File "/usr/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
        response = self.full_dispatch_request()
      File "/usr/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
        rv = self.handle_user_exception(e)
      File "/usr/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
        rv = self.dispatch_request()
      File "/usr/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
        return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
      File "/usr/lib/python3.9/site-packages/srht/oauth/decorator.py", line 83, in wrapper
        return _internal_auth(f, token[1], *args, **kwargs)
      File "/usr/lib/python3.9/site-packages/srht/oauth/decorator.py", line 23, in _internal_auth
        auth = verify_encrypted_authorization(auth)
      File "/usr/lib/python3.9/site-packages/srht/crypto.py", line 99, in verify_encrypted_authorization
        response=json.dumps({
    TypeError: unhashable type: 'dict'
flask: Enable the ``do'' Jinja2 extension
srht/Makefile: Use minify cli to minify CSS

https://github.com/tdewolff/minify

minify is available in Alpine Linux package repositories. This also
removes a build-time dependency on node.
Make favicon visible in a light theme

The SVG version now switches colors with the browser's theme. An outline
is added to both SVG and PNG versions for browsers that do not support
`prefers-color-scheme` or SVG favicons. The PNG version now has an added
`sizes="any"` attribute to work around Chrome preferring it over SVG.
markdown: fix TypeError on bleach 6

Fixes the following error:

    Traceback (most recent call last):
      File "/home/simon/src/meta.sr.ht/./metasrht-initdb", line 10, in <module>
        import metasrht.types
      File "/home/simon/src/meta.sr.ht/metasrht/types/__init__.py", line 1, in <module>
        from .user import *
      File "/home/simon/src/meta.sr.ht/metasrht/types/user.py", line 5, in <module>
        from srht.oauth import UserMixin, UserType
      File "/home/simon/src/core.sr.ht/srht/oauth/__init__.py", line 61, in <module>
        from srht.oauth.blueprint import oauth_blueprint
      File "/home/simon/src/core.sr.ht/srht/oauth/blueprint.py", line 6, in <module>
        from srht.flask import csrf_bypass
      File "/home/simon/src/core.sr.ht/srht/flask.py", line 11, in <module>
        from srht.markdown import markdown
      File "/home/simon/src/core.sr.ht/srht/markdown.py", line 175, in <module>
        tags=bleach.sanitizer.ALLOWED_TAGS + [
    TypeError: unsupported operand type(s) for +: 'frozenset' and 'list'
Don't inline favicon, offer SVG version

Currently, the favicon is served as inline data with every page. This
commit makes it an external resource instead, so it can benefit from
caching. In addition, an SVG version is added, which is not supported by
all browsers [1], but is roughly one tenth of the size. It is the one
displayed in the header on every page, only in white.

[1]: https://caniuse.com/link-icon-svg
27509d25 — Adnan Maolood 10 months ago 0.69.7
srht/oauth: Use canonical user IDs

When adding users to the database, use the canonical user ID from
meta.sr.ht.
graphql/client: add oauth2_token authentication

This executes a GraphQL operation with the specified OAuth 2.0
token used for authentication.

This will be useful to implement OAuth 2.0 token introspection.
flask: add cross_origin

A Flask decorator to enable CORS.

This will be useful to allow browser-based clients to perform
HTTP requests on some endpoints, e.g. to allow gamja to use the
OAuth 2.0 endpoints.
correct disappearing table border

Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
fix bug where circle.svg takes up entire screen

On a cold cache, loading any sr.ht page currently results in the circle logo
covering the entire screen for around 50ms, before the page is fully loaded.

This change ensures that the logo is correctly sized from the beginning,
removing the bothersome flash and making it so that all sr.ht pages display
their content to the user around 50ms faster on first load.

Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
correct a.btn-link border to match regular links

Currently, regular <a> links have a border which disappears on hover.
Elements which use <a class="btn-link"> have the opposite behaviour. I corrected
the latter elements to have the same behaviour as the former.

Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
Add strikethrough support to SrhtRenderer
srht/scss: set $font_family_monospace to monospace

This allows users to override the default monospace font in a browser
configuration.
icons: add gift.svg & file-invoice.svg
d5f6a879 — Adnan Maolood 10 months ago 0.69.1
srht/graphql: Add GraphQLOperation class

Add a new GraphQLOperation class which supports the GraphQL multipart
request spec [1].

[1]: https://github.com/jaydenseric/graphql-multipart-request-spec
Whitelist elements: details, summary, abbr, dfn

<details> + <summary> are a handy pair for having collapsible elements
that have a variety of real world use cases. As a bonus, this does not
require JavaScript.

<abbr> + <dfn> are useful for accessibility and glossaries
Next