convert templates

This commit is contained in:
Izalia Mae 2020-03-11 20:50:31 -04:00
parent fb0d51c872
commit 9d1445c080
12 changed files with 120 additions and 126 deletions

View file

@ -1,37 +0,0 @@
{% set default_open = 'open' %}
{% set logo_svg %}
{% include 'components/logo.svg' %}
{% endset %}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>PAWS@{{domain}}: {{page}}</title>
<link rel=stylesheet href="/paws/style-{{css_ts()}}.css" media="screen">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div id="content">
<div id="header">
<h1 id="name">{{logo_svg}}</h1>
</div>
{% block content %}{% endblock %}
<div class="section grid-container" id="footer">
<div class="grid-item col1">
<p><a href="https://{{domain}}/about">{{domain}}</a></p>
</div>
<div class="grid-item col2">
{% if request.user %}
<p>{{request.user.handle}}@{{request.user.instance}} [<a href="/paws/logout">logout</a>]</p>
{% else %}
<p>Guest [<a href="/paws/login">login</a>]</p>
{% endif %}
</div>
<div class="grid-item col3">
<p><a href="https://git.barkshark.xyz/izaliamae/paws" target="_new">PAWS/{{VERSION}}</a></p>
</div>
</div>
</div>
</body>
</html>

View file

@ -140,17 +140,17 @@ tr:last-child .col2 {
text-align: center;
}
#auth input[type=text] {
input[type=text] {
width: 25%;
min-width: 200px;
}
#auth input[type=text]:hover {
input[type=text]:hover {
width: 35%;
}
#auth input[type=text]:focus {
width: 80%;
input[type=text]:focus {
width: 90%;
}

View file

@ -0,0 +1,45 @@
-set default_open = 'open'
{% set logo_svg %}
{% include 'components/logo.svg' %}
{% endset %}
!!! Strict
%html
%head
%title<
PAWS@{{domain}}: {{page}}
%link{'rel': 'stylesheet', 'href': '/paws/style-{{css_ts()}}.css', 'media': 'screen'}
%meta{'name': 'viewport', 'content': 'width=device-width, initial-scale=1, shrink-to-fit=no'}
%body
#content
#header
%h1{'id': 'name'}<
{{logo_svg}}
#body
-block content
#footer{'class': 'section grid-container'}
%div{'class': 'grid-item col1'}
%p
%a{'href': '/about'}<
{{domain}}
%div{'class': 'grid-item col2'}
%p<
-if request.user
{{request.user.handle}}@{{request.user.instance}} [
%a{'href': '/paws/logout'}> logout
]
-else
Guest [
%a{'href': '/paws/login'}> login
]
%div{'class': 'grid-item col3'}
%p
%a{'href': 'https://git.barkshark.xyz/izalia/paws', 'target': '_new'}
PAWS/{{VERSION}}

View file

@ -0,0 +1,9 @@
-extends 'base.html'
-set page = 'Error ' + code
-block content
#error{'class': 'section'}
%h2{'class': 'title'}
Error {{code}}
.msg= msg

View file

@ -1,10 +0,0 @@
{% extends "base.html" %}
{% set page = 'Error ' + code %}
{% block content %}
<div class="section" id="error">
<h2 class="title">Error {{code}}</h2>
<div class="msg">{{msg}}</div>
</div>
{% endblock %}

View file

@ -1,11 +0,0 @@
{% extends "base.html" %}
{% set page = 'Home' %}
{% block content %}
<div class="section" id="auth">
<h2 class="title">PAWS</h2>
PAWS is an extra auth layer for public profiles and posts. The main purpose is to prevent web scrapers from hoarding posts, but it also prevents banned users from viewing toots they shouldn't see.
</div>
{% endblock %}

View file

@ -0,0 +1,20 @@
-extends 'base.html'
-set page = 'Login'
-block content
#auth{'class': 'section'}
%h2{'class': 'title'} Login
-if msg
.error= msg
%form{'action': '/paws/login', 'method': 'post'}
.msg This instance requires you to login via oauth to view public pages
%br
Please input the instance of the account you'd like to login with
%input{'type': 'hidden', 'name': 'redir', 'value': '{{redir}}'}
%input{'type': 'hidden', 'name': 'numid', 'value': '{{numid}}'}
%input{'type': 'text', 'name': 'domain', 'placeholder': 'mastodon.social'}
%br
%input{'type': 'submit', 'value': 'Login'}

View file

@ -1,22 +0,0 @@
{% extends "base.html" %}
{% set page = 'Login' %}
{% block content %}
<div class="section" id="auth">
<h2 class="title">Login</h2>
{% if msg %}
<div class="error">{{msg}}</div>
{% endif %}
<form action="/paws/login" method="post">
<input type="hidden" name="redir" value="{{redir}}" />
<input type="hidden" name="numid" value="{{numid}}" />
<div class="msg">This instance requres you to login via oauth to view public pages<br />
Please input the instance of the account you'd like to login with</div>
<input type="text" name="domain" placeholder="bofa.lol" /><br />
<input type="submit" value="Submit">
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,39 @@
-extends 'base.html'
-set page = 'Home'
-block content
#panel{'class': 'section'}
%h2{'class': 'title'} PAWS
%p
PAWS is an extra auth layer for public profiles and posts. The main purpose is to prevent web scrapers from hoarding posts, but it also prevents banned users from viewing toots they shouldn't see
-if admin
%center
%h2 Whitelist
%table{'id': 'whitelist'}
%tr{'class': 'header'}
%td
%td
-if len(whitelist) > 0
-for instance in whitelist
%tr{'class': 'instance'}
%td{'class': 'col1'}
%a{'href': 'https://{{instance}}/about', 'target': '_new'}= instance
%td{'class': 'col2'}
%form{'action': '/paws/action/remove', 'method': 'post'}
%input{'name': 'name', 'value': '{{instance}}', 'hidden': None}
%input{'type': 'submit', 'value': 'Remove'}
-else
%tr{'class': 'instance'}
%td none
%td
%tr{'class': 'instance'}
%form{'action': '/paws/action/add', 'method': 'post'}
%td{'class': 'col1'}
%input{'type': 'text', 'name': 'name', 'placeholder': 'mastodon.social'}
%td{'class': 'col2'}
%input{'type': 'submit', 'value': 'Add'}

View file

@ -1,39 +0,0 @@
{% extends "base.html" %}
{% set page = 'Home' %}
{% block content %}
<div class="section" id="panel">
<h2 class="title">PAWS</h2>
PAWS is an extra auth layer for public profiles and posts. The main purpose is to prevent web scrapers from hoarding posts, but it also prevents banned users from viewing toots they shouldn't see.<br /><br />
{% if admin %}
<center><h2>Whitelist</h2></center>
<table id="whitelist">
<tr class="header"><td></td><td></td></tr>
{% if len(whitelist) > 0 %}
{% for instance in whitelist %}
<tr class="instance">
<td class="col1"><a href="https://{{instance}}/about" target="_new">{{instance}}</a></td>
<td class="col2">
<form action="/paws/action/remove" method="post">
<input name="name" value="{{instance}}" hidden>
<input type="submit" value="X">
</form>
</td>
{% endfor %}
</tr>
{% else %}
<tr><td>none</td><td></td></tr>
{% endif %}
<tr class="instance">
<form action="/paws/action/add" method="post">
<td class="col1"><input type="text" name="name" placeholder="bofa.lol"></td>
<td class="col2">
<input type="submit" value="Add">
</td>
</form>
</table>
{% endif %}
</div>
{% endblock %}

View file

@ -19,7 +19,7 @@ masto_host = MASTOCONFIG['domain']
async def get_home(request):
return aiohttpTemplate('pages/home.html', {}, request)
return aiohttpTemplate('home.html', {}, request)
async def get_paws(request):
@ -36,7 +36,7 @@ async def get_paws(request):
whitelist = None
data = {'admin': admin, 'whitelist': whitelist}
return aiohttpTemplate('pages/panel.html', data, request)
return aiohttpTemplate('panel.html', data, request)
async def post_paws(request):
@ -75,7 +75,7 @@ async def get_login(request):
return aiohttp.web.HTTPFound('/paws')
data = {'redir': redir, 'numid': numid}
return aiohttpTemplate('pages/login.html', data, request)
return aiohttpTemplate('login.html', data, request)
async def post_login(request):