Skip to content

Commit

Permalink
add prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Nov 30, 2024
1 parent 6bb2564 commit 32ec2cf
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 103 deletions.
11 changes: 11 additions & 0 deletions kitsune/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "jinja-template"
}
}
],
"plugins": ["prettier-plugin-jinja-template"]
}
1 change: 1 addition & 0 deletions kitsune/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@tailwindcss/typography": "^0.5.15",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"prettier": "^3.4.1",
"prettier-plugin-jinja-template": "^2.0.0",
"prettier-plugin-tailwindcss": "^0.6.9",
"tailwindcss": "^3.4.15"
}
Expand Down
4 changes: 2 additions & 2 deletions kitsune/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/public/app.css" />
<title>{% block title %} {% endblock %}</title>
<title>{% block title %}{% endblock %}</title>
</head>

<body>
{% block body %} {% endblock %}
{% block body %}{% endblock %}
</body>
</html>
107 changes: 54 additions & 53 deletions kitsune/templates/oauth/consent.html
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
{% extends "base.html" %}

<br />
{% block title %} OAuth Login {% endblock %}
{% block title %}
OAuth Login
{% endblock %}

<br />
{% block body %} {% macro add_query_params() %}
<input type="hidden" name="client_id" value="{{ query.client_id }}" />
<input type="hidden" name="redirect_uri" value="{{ query.redirect_uri }}" />
<input type="hidden" name="response_type" value="{{ query.response_type }}" />
<input type="hidden" name="scope" value="{{ query.scope }}" />
<input type="hidden" name="state" value="{{ query.state }}" />
<input type="hidden" name="csrf_token" value="{{ csrf_token }}" />
{% macro add_query_params() %}
<input type="hidden" name="client_id" value="{{ query.client_id }}" />
<input type="hidden" name="redirect_uri" value="{{ query.redirect_uri }}" />
<input type="hidden" name="response_type" value="{{ query.response_type }}" />
<input type="hidden" name="scope" value="{{ query.scope }}" />
<input type="hidden" name="state" value="{{ query.state }}" />
<input type="hidden" name="csrf_token" value="{{ csrf_token }}" />
{% endmacro %}

<main
class="flex flex-col place-content-center items-center w-screen min-h-screen"
>
<h1 class="italic text-shade1-dark">Kitsune</h1>
{% block body %}
<main
class="flex flex-col place-content-center items-center w-screen min-h-screen"
>
<h1 class="italic text-shade1-dark">Kitsune</h1>

<div class="flex flex-col items-center">
<div>
<span class="font-bold text-shade1-dark">{{app_name}}</span> wants the
following access to your Kitsune account:
<p></p>
<ul class="list-['>']">
{% for scope in scopes %}
<li>{{ scope }}</li>
{% endfor %}
</ul>
</div>
<div class="flex flex-col items-center">
<div>
<span class="font-bold text-shade1-dark">{{ app_name }}</span> wants the
following access to your Kitsune account:
<p></p>
<ul class="list-['>']">
{% for scope in scopes %}
<li>{{ scope }}</li>
{% endfor %}
</ul>
</div>

<form class="w-full" method="get">
{{ add_query_params() }}
<input type="hidden" name="login_consent" value="accept" />
<input
class="w-full [&:not(:hover)]:text-dark-1 bg-shade1-dark hover:enabled:bg-shade2-dark min-h-1 cursor-pointer rounded p-2 transition duration-500"
type="submit"
value="Accept"
/>
</form>
<form class="w-full" method="get">
{{ add_query_params() }}
<input type="hidden" name="login_consent" value="accept" />
<input
class="w-full [&:not(:hover)]:text-dark-1 bg-shade1-dark hover:enabled:bg-shade2-dark min-h-1 cursor-pointer rounded p-2 transition duration-500"
type="submit"
value="Accept"
/>
</form>

<form class="w-full" method="get">
{{ add_query_params() }}
<input type="hidden" name="login_consent" value="deny" />
<input
class="w-full my-3 [&:not(:hover)]:text-dark-1 bg-shade1-dark hover:enabled:bg-shade2-dark min-h-1 cursor-pointer rounded p-2 transition duration-500"
type="submit"
value="Deny"
/>
</form>
<form class="w-full" method="get">
{{ add_query_params() }}
<input type="hidden" name="login_consent" value="deny" />
<input
class="w-full my-3 [&:not(:hover)]:text-dark-1 bg-shade1-dark hover:enabled:bg-shade2-dark min-h-1 cursor-pointer rounded p-2 transition duration-500"
type="submit"
value="Deny"
/>
</form>

<div>
Authenticated as
<span class="font-bold">{{ authenticated_username }}</span> ~
<a
href="#"
onclick="document.cookie='user_id=; expires=Thu, 01 Jan 1970 00:00:00 UTC;';window.location.reload();"
>Logout</a
>
<div>
Authenticated as
<span class="font-bold">{{ authenticated_username }}</span> ~
<a
href="#"
onclick="document.cookie='user_id=; expires=Thu, 01 Jan 1970 00:00:00 UTC;';window.location.reload();"
>Logout</a
>
</div>
</div>
</div>
</main>
</main>
{% endblock %}
80 changes: 40 additions & 40 deletions kitsune/templates/oauth/login.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
{% extends "base.html" %}

<div></div>
{% block title %}OAuth Login{% endblock %}
{% block title %}
OAuth Login
{% endblock %}

<div></div>
{% block body %}
<main
class="flex flex-col place-content-center items-center w-screen min-h-screen"
>
<h1 class="italic text-shade1-dark">Kitsune</h1>
<main
class="flex flex-col place-content-center items-center w-screen min-h-screen"
>
<h1 class="italic text-shade1-dark">Kitsune</h1>

{% if flash_messages|length != 0 %}
<ul class="list-none border-4 border-solid border-red-500 px-4 py-2">
{% for (_level, msg) in flash_messages %}
<li>{{msg}}</li>
{% endfor %}
</ul>
{% endif %}
{% if flash_messages|length != 0 %}
<ul class="list-none border-4 border-solid border-red-500 px-4 py-2">
{% for (_level, msg) in flash_messages %}
<li>{{ msg }}</li>
{% endfor %}
</ul>
{% endif %}

<form class="flex flex-col gap-6" method="post">
<label for="username"
>Username
<input
class="w-full border-0 border-b-2 border-gray-200 bg-transparent"
type="text"
id="username"
name="username"
value=""
/>
</label>
<label for="password"
>Password
<form class="flex flex-col gap-6" method="post">
<label for="username"
>Username
<input
class="w-full border-0 border-b-2 border-gray-200 bg-transparent"
type="text"
id="username"
name="username"
value=""
/>
</label>
<label for="password"
>Password
<input
class="w-full border-0 border-b-2 border-gray-200 bg-transparent"
type="password"
id="password"
name="password"
value=""
/>
</label>
<input
class="w-full border-0 border-b-2 border-gray-200 bg-transparent"
type="password"
id="password"
name="password"
value=""
class="[&:not(:hover)]:text-dark-1 bg-shade1-dark hover:enabled:bg-shade2-dark min-h-1 cursor-pointer rounded p-2 transition duration-500"
type="submit"
value="Submit"
/>
</label>
<input
class="[&:not(:hover)]:text-dark-1 bg-shade1-dark hover:enabled:bg-shade2-dark min-h-1 cursor-pointer rounded p-2 transition duration-500"
type="submit"
value="Submit"
/>
</form>
</main>
</form>
</main>
{% endblock %}
18 changes: 10 additions & 8 deletions kitsune/templates/oauth/token.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{% extends "base.html" %}

<br />
{% block title %} OAuth Token {% endblock %}
{% block title %}
OAuth Token
{% endblock %}

<br />
{% block body %}
<p class="header">{{domain}}</p>
<p class="header">{{ domain }}</p>

<div class="tokenContainer">
<p>Copy & Paste this token into <span class="appName">{{app_name}}</span></p>
<code class="token">{{token}}</code>
</div>
<div class="tokenContainer">
<p>
Copy & Paste this token into <span class="appName">{{ app_name }}</span>
</p>
<code class="token">{{ token }}</code>
</div>
{% endblock %}
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 32ec2cf

Please sign in to comment.