diff --git a/app/models.py b/app/models.py index 27254f7..0ade97e 100644 --- a/app/models.py +++ b/app/models.py @@ -25,6 +25,7 @@ class User(UserMixin, db.Model): class Search(db.Model): id = db.Column(db.Integer, primary_key=True) + exact_url = db.Column(db.String(160)) query = db.Column(db.String(120)) timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) diff --git a/app/routes.py b/app/routes.py index d7e9cbb..331f170 100644 --- a/app/routes.py +++ b/app/routes.py @@ -106,19 +106,26 @@ def validate_id(id): def get_hidden(): return "/hidden{}/".format(app.config['HIDDEN_URL']) +@app.route('/hidden/history') +@login_required +def hidden_history(id): + if not validate_id(id): + return 'error: bad id' + return render_template('hidden_history.html') + + @app.route('/hidden/help') @login_required def hidden_help(id): - if validate_id(id): - return render_template('hidden_help.html') - else: - return 'error: bad id' + if not validate_id(id): + return 'error: bad id' + return render_template('hidden_help.html') @app.route('/hidden/') @login_required def hidden(id): if not validate_id(id): - return 'bad id' + return 'error: bad id' # Handled within request tags = request.args.get('tags') or 'trap' try: @@ -142,6 +149,10 @@ def hidden(id): count = min(25, count) else: 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) def base64ify(url): diff --git a/app/templates/hidden.html b/app/templates/hidden.html index f914a6f..3c78830 100644 --- a/app/templates/hidden.html +++ b/app/templates/hidden.html @@ -78,13 +78,16 @@ {% if showtags %}checked{% endif %} />
-
- +
+ +
+ -
Help + href="{{ request.path + 'help' }}">Help
diff --git a/app/templates/hidden_history.html b/app/templates/hidden_history.html new file mode 100644 index 0000000..3676b14 --- /dev/null +++ b/app/templates/hidden_history.html @@ -0,0 +1,26 @@ +{% extends 'base.html' %} +{% block body %} + +
+
+
+
+
+
+
+

Search History

+
+
+
+ {% for post in current_user.search_history %} + Post : {{ post }} + {% endfor %} +
+
+
+ +
+
+
+ +{% endblock body %} \ No newline at end of file