|
@@ -233,10 +233,17 @@ def autocompleter():
|
233
|
233
|
|
234
|
234
|
# TODO fix XSS-vulnerability, remove test code
|
235
|
235
|
autocompleter.querry = request_data.get('q')
|
236
|
|
- autocompleter.results = [autocompleter.querry]
|
237
|
|
-
|
238
|
|
- return Response(json.dumps(autocompleter.results),
|
239
|
|
- mimetype='application/json')
|
|
236
|
+ autocompleter.results = []
|
|
237
|
+
|
|
238
|
+ if autocompleter.querry:
|
|
239
|
+ autocompleter.results = [autocompleter.querry + "-searx",autocompleter.querry + " asfded",autocompleter.querry + " asdf"]
|
|
240
|
+
|
|
241
|
+ if request_data.get('format') == 'x-suggestions':
|
|
242
|
+ return Response(json.dumps([autocompleter.querry,autocompleter.results]),
|
|
243
|
+ mimetype='application/json')
|
|
244
|
+ else:
|
|
245
|
+ return Response(json.dumps(autocompleter.results),
|
|
246
|
+ mimetype='application/json')
|
240
|
247
|
|
241
|
248
|
|
242
|
249
|
@app.route('/preferences', methods=['GET', 'POST'])
|