Compare commits
No commits in common. "ba9ea87aaa4beb5b3b341a35ea511bbdfc4b5bde" and "168272761a6d5bfc8951e2caf9e0a9c0b656421c" have entirely different histories.
ba9ea87aaa
...
168272761a
12
saddle.py
12
saddle.py
|
@ -31,7 +31,6 @@ async def index(request):
|
|||
return render_template("index.html", request, locals())
|
||||
data = await request.post()
|
||||
rand_name = bool(data.get('rand_name'))
|
||||
response_type = data.get('reponse_type')
|
||||
|
||||
files = []
|
||||
for filefield in data.getall('files'):
|
||||
|
@ -60,20 +59,13 @@ async def index(request):
|
|||
for file in files:
|
||||
t = (int(request.cookies.get('userid')), file[0], file[1], expiration_date)
|
||||
files_insert.append(t)
|
||||
|
||||
async with request.app['pool'].acquire() as conn:
|
||||
async with request.app['pool'] as conn:
|
||||
await conn.executemany(
|
||||
"INSERT INTO upload (user_id, id, filename, expiration_date) "
|
||||
"VALUES ($1, $2, $3, $4)",
|
||||
files_insert)
|
||||
|
||||
urls = [config.upload_url + f[1] for f in files]
|
||||
if response_type == 'html':
|
||||
return render_template("result.html", request, locals())
|
||||
elif response_type == 'plain':
|
||||
return web.Response(body='\n'.join(urls))
|
||||
elif response_type == 'json':
|
||||
return web.json_response(urls)
|
||||
|
||||
|
||||
@routes.get('/gallery/{user_id}', name='gallery')
|
||||
|
@ -84,7 +76,7 @@ async def gallery(request):
|
|||
except ValueError:
|
||||
raise web.HTTPNotFound
|
||||
|
||||
async with request.app['pool'].acquire() as conn:
|
||||
async with request.app['pool'] as conn:
|
||||
uploads = await conn.fetch(
|
||||
"SELECT * FROM upload WHERE user_id = $1",
|
||||
user_id)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<header>
|
||||
{% include 'header.html' %}
|
||||
<h1>Saddle</h1>
|
||||
</header>
|
||||
<main>
|
||||
<section>
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<div id="logo_line">
|
||||
<object id="logo" title="Saddle Logo" data="/static/saddle.svg"></object>
|
||||
<h1>Saddle</h1>
|
||||
</div>
|
||||
<nav><span><a href="./gallery/{{ request.cookies.get('userid') }}">Gallery</a></span></nav>
|
|
@ -8,7 +8,11 @@
|
|||
</head>
|
||||
<body>
|
||||
<header>
|
||||
{% include 'header.html' %}
|
||||
<div id="logo_line">
|
||||
<object id="logo" title="Saddle Logo" data="/static/saddle.svg"></object>
|
||||
<h1>Saddle</h1>
|
||||
</div>
|
||||
<nav><span><a href="./gallery/{{ request.cookies.get('userid') }}">Gallery</a></span></nav>
|
||||
</header>
|
||||
<main>
|
||||
<section>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<header>
|
||||
{% include 'header.html' %}
|
||||
<h1>Saddle</h1>
|
||||
</header>
|
||||
<main>
|
||||
<section>
|
||||
|
|
Loading…
Reference in New Issue
Block a user