mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-08 14:08:56 -06:00
fixed '/' distinction, added history buttons, modified models
This commit is contained in:
@@ -25,6 +25,7 @@ class User(UserMixin, db.Model):
|
|||||||
|
|
||||||
class Search(db.Model):
|
class Search(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
exact_url = db.Column(db.String(160))
|
||||||
query = db.Column(db.String(120))
|
query = db.Column(db.String(120))
|
||||||
timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow)
|
timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow)
|
||||||
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
|
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
|
||||||
|
|||||||
@@ -106,19 +106,26 @@ def validate_id(id):
|
|||||||
def get_hidden():
|
def get_hidden():
|
||||||
return "/hidden{}/".format(app.config['HIDDEN_URL'])
|
return "/hidden{}/".format(app.config['HIDDEN_URL'])
|
||||||
|
|
||||||
|
@app.route('/hidden<id>/history')
|
||||||
|
@login_required
|
||||||
|
def hidden_history(id):
|
||||||
|
if not validate_id(id):
|
||||||
|
return '<span style="color: red;">error:</span> bad id'
|
||||||
|
return render_template('hidden_history.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/hidden<id>/help')
|
@app.route('/hidden<id>/help')
|
||||||
@login_required
|
@login_required
|
||||||
def hidden_help(id):
|
def hidden_help(id):
|
||||||
if validate_id(id):
|
if not validate_id(id):
|
||||||
|
return '<span style="color: red;">error:</span> bad id'
|
||||||
return render_template('hidden_help.html')
|
return render_template('hidden_help.html')
|
||||||
else:
|
|
||||||
return 'error: bad id'
|
|
||||||
|
|
||||||
@app.route('/hidden<id>/')
|
@app.route('/hidden<id>/')
|
||||||
@login_required
|
@login_required
|
||||||
def hidden(id):
|
def hidden(id):
|
||||||
if not validate_id(id):
|
if not validate_id(id):
|
||||||
return 'bad id'
|
return '<span style="color: red;">error:</span> bad id'
|
||||||
# Handled within request
|
# Handled within request
|
||||||
tags = request.args.get('tags') or 'trap'
|
tags = request.args.get('tags') or 'trap'
|
||||||
try:
|
try:
|
||||||
@@ -142,6 +149,10 @@ def hidden(id):
|
|||||||
count = min(25, count)
|
count = min(25, count)
|
||||||
else:
|
else:
|
||||||
count = min(50, count)
|
count = min(50, count)
|
||||||
|
print(request.args)
|
||||||
|
# search = Search(query=)
|
||||||
|
# db.session.add(search)
|
||||||
|
# db.session.commit()
|
||||||
return render_template('hidden.html', title='Gelbooru Browser', data=data, tags=tags, page=page, count=count, base64=base64, showfull=showfull, showtags=showtags)
|
return render_template('hidden.html', title='Gelbooru Browser', data=data, tags=tags, page=page, count=count, base64=base64, showfull=showfull, showtags=showtags)
|
||||||
|
|
||||||
def base64ify(url):
|
def base64ify(url):
|
||||||
|
|||||||
@@ -78,13 +78,16 @@
|
|||||||
{% if showtags %}checked{% endif %} />
|
{% if showtags %}checked{% endif %} />
|
||||||
</div>
|
</div>
|
||||||
<div class="columns is-centered">
|
<div class="columns is-centered">
|
||||||
<div class="column is-4">
|
<div class="column">
|
||||||
<input class="button" type="submit" />
|
<input class="button is-success is-outlined" type="submit" />
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<a class="button is-link is-outlined"
|
||||||
|
href="{{ request.path + 'history' }}">History</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-5"></div>
|
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<a class="button is-info is-outlined"
|
<a class="button is-info is-outlined"
|
||||||
href="{{ request.path + '/help' }}">Help</a>
|
href="{{ request.path + 'help' }}">Help</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
26
app/templates/hidden_history.html
Normal file
26
app/templates/hidden_history.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
{% block body %}
|
||||||
|
<!-- Search History Section -->
|
||||||
|
<section class="section section-padding">
|
||||||
|
<div class="container">
|
||||||
|
<div class="columns is-mobile is-multiline is-centered">
|
||||||
|
<div class="column">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-header-title">
|
||||||
|
<h1 class="title">Search History</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
{% for post in current_user.search_history %}
|
||||||
|
Post : {{ post }}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<!-- End Search History Section -->
|
||||||
|
{% endblock body %}
|
||||||
Reference in New Issue
Block a user